diff --git a/README.md b/README.md index 7ad2285..0cea0cd 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,60 @@ # MAME Build Tools -##### Table of Contents +##### Table of Contents * [Introduction](#introduction) -* [Automatic installer](#automatic) -* [Updating build tools](#updating) -* [Optional additional packages](#optional) - * [SDL](#optional-sdl) - * [QT5](#optional-qt5) - * [QT4](#optional-qt4) - * [CCache](#optional-ccache) - * [CMake](#optional-cmake) - * [DOxygen](#optional-doxygen) -* [Manual Steps](#manual) +* [Installation and building](#installandbuild) + * [Downloads](#downloads) + * [Installation](#installation) + * [Building](#building) +* [Updating build tools](#updating) +* [Alternative Shells for advanced usage](#advanced) +* [Optional additional packages](#optional) + * [32-bit tools](#optional-32bit) + * [GNU Debugger (gdb)](#optional-gdb) + * [QT5](#optional-qt5) + * [QT4](#optional-qt4) + * [CCache](#optional-ccache) + * [CMake](#optional-cmake) + * [Clang](#optional-clang) + ## Introduction -The MAME development environment for Windows consists of the GCC compiler (by way of MinGW), and the MSYS2 (POSIX/Unix compatability layer), plus various utilities such as Python and Git. It is available as a prepackaged installer, or can be assembled from upstream components. +The MAME development environment for Windows consists of the GCC compiler (by way of MinGW), and the MSYS2 (POSIX/Unix compatability layer), plus various utilities such as Python and Git. It is available as a prepackaged installer, or can be assembled from upstream components. Source control is handled by github (***https://github.com/mamedev/mame.git***), so you'll need to check out a copy. -Various modules are disabled by default, such as the MAME interactive debugger, but can be enabled through arguments when building and may require additional MSYS2 packages to be installed. +Various modules are disabled by default, but can be enabled through arguments when building and may require additional MSYS2 packages to be installed. + + + +## Installation and building - -## Automatic installer + -Download [msys64-2016-01-07.exe](https://github.com/mamedev/buildtools/releases/download/1.4/msys64-2016-01-07.exe) if you are on 64-bit Windows -or [msys32-2016-01-07.exe](https://github.com/mamedev/buildtools/releases/download/1.4/msys32-2016-01-07.exe) is you are on 32 bit Windows. -If you are on 64-bit Windows but wish to produce binaries for both 32-bit and 64-bit download [msys64-32-2016-01-07.exe](https://github.com/mamedev/buildtools/releases/download/1.4/msys64-32-2016-01-07.exe) -To switch between different mingw versions use **config32.bat** and **config64.bat** +### Downloads +* 64-bit - [msys64-2022-01-12.exe](https://github.com/mamedev/buildtools/releases/download/7.0/msys64-2022-01-12.exe) _(Only 64-bit tools and libraries are included. To build 32-bit binaries, install the 32-bit MinGW tools, and switch between environments using **config32.bat** and **config64.bat**)_ -If you are installing it in a location other than the default (*c:\msys64* or *c:\msys32*), after you unpack double-click : **autorebase.bat** + -In case you wish to use non-posix environment there are two additional batch files: **win32env.bat** for regular windows console, and **win32con.bat** for fancy looking conemu console. +### Installation +If you are installing it in a location other than the default (*C:\Users\Public\msys64*), after you unpack double-click : **autorebase.bat** -For a simple terminal use **buildtools.bat** to start. For a fancy looking one use **conemu.bat**. For more information about Msys2, see [MSYS2 Introduction](http://sourceforge.net/p/msys2/wiki/MSYS2%20introduction/). There are also **buildtools_32.bat** and **conemu_32.bat** enforcing mingw32 on 64-bit tools (makes sense if you use combined distribution). +To open a non-POSIX shell there is a batch file: **win32env.bat** for regular Windows console. **Important** thing is to setup your git environment first ```sh git config --global core.autocrlf true ``` -Since it can be that some of configuration file have altered, first pull latest from root of your tools: -```sh -git pull -``` - -And if you are contributor +And if you are a contributor: ```sh git config --global user.email youremail@something.com git config --global user.name "Firstname Lastname" ``` + + +### Building Then, to download the MAME source under your Msys2 user's homedir: ```sh git clone https://github.com/mamedev/mame.git @@ -66,33 +71,65 @@ make ``` + ## Updating build tools Similar to package managers on Linux like apt-get, yum etc. MSYS2 can automatically update packages for fixes, security updates etc. -To update all installed packages to current: +To update all installed packages to current, from the regular Windows console run the following: ```sh -pacman -Su +pacman -Sy +pacman -S bash pacman msys2-runtime --noconfirm --needed ``` +Next, exit the console and restart Msys2. + +Finally, once back at the console, execute: +```sh +pacman -Su --noconfirm +``` + + + +## Alternative Shells for advanced usage +For a simple MSYS32 terminal use **mingw64.exe** to start or (or **mingw32.exe** for a 32-bit environment). + +For more information about MSYS2, see [MSYS2 Introduction](https://github.com/msys2/msys2/wiki/MSYS2-introduction). + ## Optional additional packages - -### SDL -If you wish to build with the SDL renderer: - **For x64** + + +### 32-bit tools +If you wish to build 32-bit binaries: ```sh - pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf + pacman -S mingw-w64-i686-gcc mingw-w64-i686-libc++ mingw-w64-i686-lld mingw-w64-i686-python mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_ttf ``` - **For x86** + + +### GNU Debugger (gdb) +If you wish to debug with gdb: + + **For MSYS2 x64** ```sh - pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_ttf + pacman -S gdb + ``` + + **For MinGW x64** + ```sh + pacman -S mingw-w64-x86_64-gdb + ``` + + **For MinGW x86** + ```sh + pacman -S mingw-w64-i686-gdb ``` + ### QT5 If you wish to build with the QT5 debugger: @@ -107,6 +144,7 @@ If you wish to build with the QT5 debugger: ``` + ### QT4 If you with to build the QMC2 frontend or similar: @@ -120,39 +158,34 @@ If you with to build the QMC2 frontend or similar: pacman -S mingw-w64-i686-qt4 ``` - -### Doxygen -To be able to generate the documentation from the source: - - ```sh - pacman -S doxygen - ``` - + ### CCache To be able to use ccache to speed-up (re)compilation **For x64** ```sh - pacman -S mingw-w64-x86_64-ccache + pacman -S mingw-w64-x86_64-ccache ``` **For x86** ```sh - pacman -S mingw-w64-i686-ccache + pacman -S mingw-w64-i686-ccache ``` - + + + ### CMake Used as build system for some other project that can be handy **For x64** ```sh - pacman -S mingw-w64-x86_64-cmake + pacman -S mingw-w64-x86_64-cmake ``` **For x86** ```sh - pacman -S mingw-w64-i686-cmake + pacman -S mingw-w64-i686-cmake ``` **To build in Windows environment use from build folder:** @@ -163,84 +196,18 @@ Used as build system for some other project that can be handy ```sh cmake -G "MSYS Makefiles" .. ``` - - -### Clang -If you wish to compile/link with the alternative Clang, go ahead and download **STILL EXPERIMENTAL**: - - **For x64** - ```sh - pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-clang-tools-extra - ``` - - **For x86** - ```sh - pacman -S mingw-w64-i686-clang mingw-w64-i686-clang-analyzer mingw-w64-i686-clang-tools-extra - ``` - - -## Manual steps -1. Download MSYS2. You can do that by downloading from http://msys2.github.io/ or - from our mirror [for 64-bit Windows](https://github.com/mamedev/buildtools/releases/download/1.0/msys2-x86_64-20150916.exe) or [for 32-bit Windows](https://github.com/mamedev/buildtools/releases/download/1.0/msys2-i686-20150916.exe) - -2. Run the installer (location can be changed to suite) and let it complete and it will launch an Msys shell - -3. Update initial installation - - ```sh - pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime - ``` - -4. Type `exit` to close current window and start "MSYS2 Shell" again - -5. Now upgrade already installed packages to current - - ```sh - pacman -Su - ``` - -6. Install ConEmu console, `make`, `wget` and `git` tools - - ```sh - pacman -S conemu-git make wget git - ``` + -7. Install `mingw` and `gdb` including `python` +### Clang +If you wish to compile/link with the alternative Clang, go ahead and download: **For x64** ```sh - pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb - ``` - - **For x86** - ```sh - pacman -S mingw-w64-i686-gcc mingw-w64-i686-gdb + pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-clang-tools-extra ``` -8. Go to root folder and download MAME development environment shell scripts - - **For x86** ```sh - cd / - git clone https://github.com/mamedev/buildtools_x86.git build - cd build - mv * .. - cd .. - rm -r -f build - exit - ``` - - **For x64** - ```sh - cd / - git clone https://github.com/mamedev/buildtools_x64.git build - cd build - mv * .. - cd .. - rm -r -f build - exit + pacman -S mingw-w64-i686-clang mingw-w64-i686-clang-analyzer mingw-w64-i686-clang-tools-extra ``` - -9. Finally, start ```buildtools.bat``` from installed folder (by default it is *C:\msys64* or *c:\msys32*) diff --git a/mame-essentials/PKGBUILD b/mame-essentials/PKGBUILD new file mode 100644 index 0000000..5f100a5 --- /dev/null +++ b/mame-essentials/PKGBUILD @@ -0,0 +1,12 @@ +pkgname=mame-essentials +pkgver=1.0 +pkgrel=0 +pkgdesc="MAME Essentials MSYS2 package" +arch=('x86_64') +depends=('make' 'wget' 'git' 'p7zip' 'mingw-w64-x86_64-gcc' 'mingw-w64-x86_64-python' 'mingw-w64-i686-gcc' 'mingw-w64-i686-python') +url="https://github.com/mamedev/buildtools/" +license=('none') +options=('!strip') +package() { + cp -R "$srcdir/." "$pkgdir/." +} diff --git a/mame-essentials/README.md b/mame-essentials/README.md new file mode 100644 index 0000000..716df16 --- /dev/null +++ b/mame-essentials/README.md @@ -0,0 +1,22 @@ +# MAME Essentials package + +Build with: + +``` +makepkg -f -d +``` + +options: +f - is for force (to recreate if package file already exits) +d - no dependency check (so no need to have deps already preinstalled) + + +To use: + +``` +pacman -U mame-essentials-1.0-0-x86_64.pkg.tar.zst +``` + +Will install this package and all dependencies needed for user to have installed to be able to compile MAME. +This can be installed on vanilla MSYS2 installation. + diff --git a/mame-essentials/src/opt/mamedev/aliases b/mame-essentials/src/opt/mamedev/aliases new file mode 100644 index 0000000..e0c788c --- /dev/null +++ b/mame-essentials/src/opt/mamedev/aliases @@ -0,0 +1,4 @@ +gl=git log --oneline --all --graph --decorate $* +ls=ls --color $* +pwd=cd +clear=cls diff --git a/mame-essentials/src/opt/mamedev/config32.bat b/mame-essentials/src/opt/mamedev/config32.bat new file mode 100644 index 0000000..fd1695d --- /dev/null +++ b/mame-essentials/src/opt/mamedev/config32.bat @@ -0,0 +1,2 @@ +@set CONFIG_ARCHITECTURE=x86 +@env.bat diff --git a/mame-essentials/src/opt/mamedev/config64.bat b/mame-essentials/src/opt/mamedev/config64.bat new file mode 100644 index 0000000..e5dc8dc --- /dev/null +++ b/mame-essentials/src/opt/mamedev/config64.bat @@ -0,0 +1,2 @@ +@set CONFIG_ARCHITECTURE=x64 +@env.bat diff --git a/mame-essentials/src/opt/mamedev/env.bat b/mame-essentials/src/opt/mamedev/env.bat new file mode 100644 index 0000000..4c5d277 --- /dev/null +++ b/mame-essentials/src/opt/mamedev/env.bat @@ -0,0 +1,31 @@ +:: Find root dir +@if not defined MSYS2_ROOT ( + for /f %%i in ("%~dp0\..\..") do @set MSYS2_ROOT=%%~fi +) + +:: Add aliases +@doskey /macrofile="%MSYS2_ROOT%\opt\mamedev\aliases" + +@set MINGW32= +@set MINGW64= +@set ADD_PATH= +@set PATH=%windir%\System32;%windir% +:: Enhance Path +@if "%CONFIG_ARCHITECTURE%"=="x86" ( + @set MINGW32=/mingw32 + @set PYTHON_EXECUTABLE=/mingw32/bin/python.exe + @set MINGW=%MSYS2_ROOT%\mingw32 + @set prompt=[MINGW32] $p$g +) else ( + @set MINGW64=/mingw64 + @set PYTHON_EXECUTABLE=/mingw64/bin/python.exe + @set MINGW=%MSYS2_ROOT%\mingw64 + @set prompt=[MINGW64] $p$g +) +@set MINGW_PATH=%MINGW%\bin + +@set PATH=%ADD_PATH%;%MSYS2_ROOT%\opt\mamedev;%MINGW_PATH%;%MSYS2_ROOT%\usr\bin;%PATH% + +@if not exist "%MSYS2_ROOT%\home" ( + @bash --login /dev/null +) diff --git a/mame-essentials/src/usr/lib/p7zip/7z.sfx b/mame-essentials/src/usr/lib/p7zip/7z.sfx new file mode 100644 index 0000000..41f7b96 Binary files /dev/null and b/mame-essentials/src/usr/lib/p7zip/7z.sfx differ diff --git a/mame-essentials/src/win32env.bat b/mame-essentials/src/win32env.bat new file mode 100644 index 0000000..33ffc30 --- /dev/null +++ b/mame-essentials/src/win32env.bat @@ -0,0 +1,5 @@ +@if not exist src ( + mkdir src +) +@cd src +@cmd /k ..\opt\mamedev\env.bat