From a31c76403d8fdc347c01c9888a3dd8bf0e3423d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Fri, 8 Dec 2023 12:04:52 +0100 Subject: [PATCH] Windows and macOS packages: move meson native/cross files to OS-specific directory --- README.md | 2 +- macOS/build.sh | 4 ++-- macOS/deps/Makefile | 2 +- {scripts => macOS}/homebrew-native-arm64.ini | 0 {scripts => macOS}/homebrew-native-x86_64.ini | 0 windows/build.sh | 6 +++--- .../mingw-cross-matlab.ini | 0 .../mingw-cross-octave.ini | 0 scripts/windows-cross.ini => windows/mingw-cross.ini | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename {scripts => macOS}/homebrew-native-arm64.ini (100%) rename {scripts => macOS}/homebrew-native-x86_64.ini (100%) rename scripts/windows-cross-matlab.ini => windows/mingw-cross-matlab.ini (100%) rename scripts/windows-cross-octave.ini => windows/mingw-cross-octave.ini (100%) rename scripts/windows-cross.ini => windows/mingw-cross.ini (96%) diff --git a/README.md b/README.md index 9c3061f3b9..fb14a555d7 100644 --- a/README.md +++ b/README.md @@ -479,7 +479,7 @@ If you want a certain version (e.g. 5.x) , then add `--single-branch --branch 5. ```sh export BUILDDIR=build-matlab export MATLABPATH=/Applications/MATLAB_R2023b.app -arch -$ARCH meson setup --native-file scripts/homebrew-native-$ARCH.ini -Dmatlab_path=$MATLABPATH -Dbuildtype=debugoptimized -Dfortran_args="['-B','$DYNAREDIR/slicot/lib']" $BUILDDIR +arch -$ARCH meson setup --native-file macOS/homebrew-native-$ARCH.ini -Dmatlab_path=$MATLABPATH -Dbuildtype=debugoptimized -Dfortran_args="['-B','$DYNAREDIR/slicot/lib']" $BUILDDIR ``` where you need to adapt the path to MATLAB. Similarly, if you want to compile for Octave, replace the `-Dmatlab_path` option by `-Dbuild_for=octave`, and change the build directory to `build-octave`. diff --git a/macOS/build.sh b/macOS/build.sh index 18c6fbc9e6..ff4423b34e 100755 --- a/macOS/build.sh +++ b/macOS/build.sh @@ -54,7 +54,7 @@ LIB64="$ROOTDIR"/macOS/deps/"$PKG_ARCH"/lib64 ## - the macOS linker is different from GNU ld and does not have the equivalent of -Bstatic/-Bdynamic ## - libgfortran.spec does not include --as-needed on macOS, hence it will link the library anyways ## Also, it does not seem possible to override libgfortran.spec with the --specs option. -GCC_VERSION=$(sed -En "/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/\1/p" "$ROOTDIR"/scripts/homebrew-native-"$PKG_ARCH".ini) +GCC_VERSION=$(sed -En "/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/\1/p" "$ROOTDIR"/macOS/homebrew-native-"$PKG_ARCH".ini) QUADMATH_DIR=$(mktemp -d) ln -s "$BREWDIR"/opt/gcc/lib/gcc/"$GCC_VERSION"/libquadmath.a "$QUADMATH_DIR" @@ -67,7 +67,7 @@ cd "$ROOTDIR" # NB: the addition of -Wl,-ld_classic is a workaround for https://github.com/mesonbuild/meson/issues/12282 (see also the native file) common_meson_opts=(-Dbuild_for=matlab -Dbuildtype=release -Dprefer_static=true -Dfortran_args="[ '-B', '$LIB64/Slicot/' ]" \ -Dc_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" -Dcpp_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" -Dfortran_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" \ - --native-file scripts/homebrew-native-$PKG_ARCH.ini) + --native-file macOS/homebrew-native-$PKG_ARCH.ini) # Build for MATLAB ⩾ R2018b (x86_64) and MATLAB ⩾ R2023b (arm64) arch -"$PKG_ARCH" meson setup "${common_meson_opts[@]}" -Dmatlab_path="$MATLAB_PATH" build-matlab --wipe diff --git a/macOS/deps/Makefile b/macOS/deps/Makefile index 0edf3d132f..dd89649f86 100644 --- a/macOS/deps/Makefile +++ b/macOS/deps/Makefile @@ -22,7 +22,7 @@ DEPS_ARCH ?= x86_64 # use x86_64 by default BREWDIR := $(if $(filter arm64,$(DEPS_ARCH)),/opt/homebrew,/usr/local) -GCC_VERSION = $(shell sed -En "/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/\1/p" ../../scripts/homebrew-native-$(DEPS_ARCH).ini) +GCC_VERSION = $(shell sed -En "/^c[[:space:]]*=/s/c[[:space:]]*=[[:space:]]*'.*gcc-([0-9]+)'/\1/p" ../homebrew-native-$(DEPS_ARCH).ini) ROOT_PATH = $(realpath .) diff --git a/scripts/homebrew-native-arm64.ini b/macOS/homebrew-native-arm64.ini similarity index 100% rename from scripts/homebrew-native-arm64.ini rename to macOS/homebrew-native-arm64.ini diff --git a/scripts/homebrew-native-x86_64.ini b/macOS/homebrew-native-x86_64.ini similarity index 100% rename from scripts/homebrew-native-x86_64.ini rename to macOS/homebrew-native-x86_64.ini diff --git a/windows/build.sh b/windows/build.sh index 9c1c854de1..7dd42ddb86 100755 --- a/windows/build.sh +++ b/windows/build.sh @@ -53,15 +53,15 @@ ln -s "$ROOT_DIRECTORY"/deps/mkoctfile64 /tmp/windeps/ # Go to source root directory cd .. -common_meson_opts=(-Dbuildtype=release --cross-file scripts/windows-cross.ini) +common_meson_opts=(-Dbuildtype=release --cross-file windows/mingw-cross.ini) # Create Windows 64-bit DLL binaries for MATLAB ≥ R2018b -meson setup --cross-file scripts/windows-cross-matlab.ini -Dmatlab_path=/tmp/windeps/matlab64/R2018b \ +meson setup --cross-file windows/mingw-cross-matlab.ini -Dmatlab_path=/tmp/windeps/matlab64/R2018b \ "${common_meson_opts[@]}" build-win-matlab meson compile -v -C build-win-matlab # Create Windows DLL binaries for Octave/MinGW (64bit) -meson setup --cross-file scripts/windows-cross-octave.ini \ +meson setup --cross-file windows/mingw-cross-octave.ini \ "${common_meson_opts[@]}" build-win-octave meson compile -v -C build-win-octave diff --git a/scripts/windows-cross-matlab.ini b/windows/mingw-cross-matlab.ini similarity index 100% rename from scripts/windows-cross-matlab.ini rename to windows/mingw-cross-matlab.ini diff --git a/scripts/windows-cross-octave.ini b/windows/mingw-cross-octave.ini similarity index 100% rename from scripts/windows-cross-octave.ini rename to windows/mingw-cross-octave.ini diff --git a/scripts/windows-cross.ini b/windows/mingw-cross.ini similarity index 96% rename from scripts/windows-cross.ini rename to windows/mingw-cross.ini index 69b127e076..e198993707 100644 --- a/scripts/windows-cross.ini +++ b/windows/mingw-cross.ini @@ -1,5 +1,5 @@ # Meson common cross file for targeting Windows from Linux -# To be included after windows-cross-{matlab,octave}.ini +# To be included after mingw-cross-{matlab,octave}.ini [constants] # For the architectural baseline, we follow MSYS2: -- GitLab