From 88640d924ae6f251fe8af27d4960721eb80c5a17 Mon Sep 17 00:00:00 2001 From: "Fr. Samuel Springuel" Date: Mon, 17 Feb 2025 19:37:07 -0500 Subject: [PATCH] Getting Windows cross-compilation to work on my Mac I don't know if this would solve #1289 on Linux machines, but at least on my Mac I can now build a windows executable and installer with this. --- build.sh | 19 +++++++++++++------ windows/windows_README.md | 24 ++++++++++++++++++------ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index da98af69d..d9824fae1 100755 --- a/build.sh +++ b/build.sh @@ -13,7 +13,7 @@ # --jobs= : the number of jobs to run simultaneously in the make step # --force= : force autoreconf # {other) : anything else is passed to configure verbatim - + # try to find bash, in case the standard shell is not capable of # handling the generated configure's += variable assignments if which bash >/dev/null @@ -33,7 +33,7 @@ then export MAKE echo "You have a GNU-make installed as gmake; I will use that" else - echo "I can't find a GNU-make; I'll try to use make and hope that works." + echo "I can't find a GNU-make; I'll try to use make and hope that works." echo "If it doesn't, please install GNU-make." fi @@ -67,12 +67,19 @@ if [ "$MINGWCROSS" = "TRUE" ] then MINGWBUILD=$HOSTTYPE-$OSTYPE MINGWSTR=mingw32 + PREFIX=/usr/ if [ -d /usr/mingw32 ]; then MINGWSTR=mingw32 + PREFIX=/usr/ elif [ -d /usr/i386-mingw32msvc ]; then - MINGWSTR=i386-mingw32msvc + MINGWSTR=i386-mingw32msvc + PREFIX=/usr/ elif [ -d /usr/i586-mingw32msvc ]; then - MINGWSTR=i586-mingw32msvc + MINGWSTR=i586-mingw32msvc + PREFIX=/usr/ + elif [ -d /opt/local/i686-w64-mingw32 ]; then + MINGWSTR=i686-w64-mingw32 + PREFIX=/opt/local/ fi OLDPATH=$PATH PATH=/usr/$MINGWSTR/bin:$PATH @@ -82,7 +89,7 @@ then --with-gnu-ld \ --host=$MINGWSTR \ --build=$MINGWBUILD \ - --prefix=/usr/$MINGWSTR" + --prefix=$PREFIX$MINGWSTR" elif [ "$MACCROSS" = "TRUE" ] then # make sure that architecture parameter is valid @@ -92,7 +99,7 @@ then esac ARCHFLAGS="$ARCHFLAGS" CFLAGS="-arch $ARCH -g -O2 $CFLAGS" - LDFLAGS="-arch $ARCH $LDFLAGS" + LDFLAGS="-arch $ARCH $LDFLAGS" fi diff --git a/windows/windows_README.md b/windows/windows_README.md index 8ee9026d5..d3d2a3555 100644 --- a/windows/windows_README.md +++ b/windows/windows_README.md @@ -2,19 +2,31 @@ This folder is dedicated to the windows installer. This file describes the steps to compile it. -### Building the gregorio executable +## Building the gregorio executable -Building the `gregorio.exe` file cannot currently be made under Windows, but it is possible under Linux: +### Linux Hosts - * install [mingw](http://www.mingw.org/) (`aptitude install mingw32` under Debian) +While building the executable under Windows should be possible, none of the current developers build it that way, so we are unable to provide the exact steps required to do so. + +Building under Linux worked when the mingw32 package was available using the following instructions: + + * install mingw32 (`aptitude install mingw32` under Debian) * run `./build.sh --mingw` in the main directory of the repository -This will create `src/gregorio.exe`. +However, the mingw32 package has not been available in the package repositories for several years (for Ubuntu, the 14.04 repositories are the most recent to contain it). The more recent mingw-w64 package is the appropriate replacement, but as of yet we have not confirmed that it works. + +### macOS Hosts + +Building under macOS is possible using the following steps: + + - install [mingw-w64](https://mingw-w64.sourceforge.net/) using MacPorts: `port install mingw-w6` (most likely requires `sudo`) + - run `./build.sh` in the main directory of the repository to build the native Mac binaries first (this is needed because some intermediate build steps require running files that have been built in earlier steps) + - run `./build.sh --mingw` in the same directory to build the windows executable -**Note:** Currently the build script only supports building a 32-bit executable (using mingw32). This package is not available by default on Ubuntu 16.04 or later. Anyone willing to help us update the build script to use the 64-bit cross compilers that are readily available on more recent versions of Ubuntu (or other *nix distributions) is very much welcome. +This will create `src/gregorio-.exe` ### Building the installer -You need [InnoSetup](http://www.jrsoftware.org/isinfo.php) to be able to compile the installer. It runs fine under [Wine](https://www.winehq.org/). Once you have it installed: run InnoSetup.exe, open the `windows/gregorio.iss` file and compile it, it will produce `windows/Output/setup.exe`. You can also run it from command line: `wine 'C:\\Program Files (x86)\Inno Setup 5\ISCC.exe' gregorio.iss` in the `windows` directory (replace the `ISCC.exe` path with yours if different). +You need [InnoSetup](http://www.jrsoftware.org/isinfo.php) to be able to compile the installer. It runs fine under [Wine](https://www.winehq.org/). Once you have it installed: run InnoSetup.exe, open the `windows/gregorio.iss` file and compile it, it will produce `windows/Output/setup.exe`. You can also run it from command line: `wine 'C:\\Program Files (x86)\Inno Setup 6\ISCC.exe' gregorio.iss` in the `windows` directory (replace the `ISCC.exe` path with yours if different). **Note:** If you're building the compiler on Ubuntu 14.04 (because of the above issue with mingw32) then you will need Inno Setup 5.x. This is because the version of wine available on Ubuntu 14.04 emulates a version of Windows which is not compatible with Inno Setup 6.x.