Set macOS version minimums when building

Allows running on older versions of macOS.
This commit is contained in:
Peter Ammon 2024-10-06 13:36:33 -07:00
parent efa109b62e
commit 0e474768f4
No known key found for this signature in database
3 changed files with 18 additions and 7 deletions

8
.cargo/config.toml Normal file
View file

@ -0,0 +1,8 @@
# For macOS, support 10.9 on x86-64, and 11.0 on aarch64, which
# is the minimum supported version for Apple Silicon.
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-mmacosx-version-min=10.9"]
[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-mmacosx-version-min=11.0"]

View file

@ -67,28 +67,28 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
# and will probably not be built universal, so the package will fail to validate/run on other systems. # and will probably not be built universal, so the package will fail to validate/run on other systems.
# Note CMAKE_OSX_ARCHITECTURES is still relevant for the Mac app. # Note CMAKE_OSX_ARCHITECTURES is still relevant for the Mac app.
{ cd "$PKGDIR/build_arm64" \ { cd "$PKGDIR/build_arm64" \
&& cmake -DMAC_INJECT_GET_TASK_ALLOW=OFF \ && cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \ -DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
-DWITH_GETTEXT=OFF \ -DWITH_GETTEXT=OFF \
-DRust_CARGO_TARGET=aarch64-apple-darwin \ -DRust_CARGO_TARGET=aarch64-apple-darwin \
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \ -DCMAKE_OSX_ARCHITECTURES='arm64' \
-DFISH_USE_SYSTEM_PCRE2=OFF \ -DFISH_USE_SYSTEM_PCRE2=OFF \
"$SRC_DIR" \ "$SRC_DIR" \
&& make VERBOSE=1 -j 12 \ && env MACOSX_DEPLOYMENT_TARGET="11.0" make VERBOSE=1 -j 12 \
&& env DESTDIR="$PKGDIR/root/" make install; && env DESTDIR="$PKGDIR/root/" MACOSX_DEPLOYMENT_TARGET="11.0" make install;
} }
# Build for x86-64 but do not install; instead we will make some fat binaries inside the root. # Build for x86-64 but do not install; instead we will make some fat binaries inside the root.
{ cd "$PKGDIR/build_x86_64" \ { cd "$PKGDIR/build_x86_64" \
&& cmake -DMAC_INJECT_GET_TASK_ALLOW=OFF \ && cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \ -DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
-DWITH_GETTEXT=OFF \ -DWITH_GETTEXT=OFF \
-DRust_CARGO_TARGET=x86_64-apple-darwin \ -DRust_CARGO_TARGET=x86_64-apple-darwin \
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \ -DCMAKE_OSX_ARCHITECTURES='x86_64' \
-DFISH_USE_SYSTEM_PCRE2=OFF "$SRC_DIR" \ -DFISH_USE_SYSTEM_PCRE2=OFF "$SRC_DIR" \
&& make VERBOSE=1 -j 12; } && env MACOSX_DEPLOYMENT_TARGET="10.9" make VERBOSE=1 -j 12; }
# Fatten them up. # Fatten them up.
for FILE in "$PKGDIR"/root/usr/local/bin/*; do for FILE in "$PKGDIR"/root/usr/local/bin/*; do

View file

@ -6,6 +6,9 @@ endif (NOT APPLE)
# The source tree containing certain macOS resources. # The source tree containing certain macOS resources.
set(OSX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/osx) set(OSX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/osx)
# 10.9 is the minimum supported version.
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
set(RESOURCE_FILES set(RESOURCE_FILES
${OSX_DIR}/launch_fish.scpt ${OSX_DIR}/launch_fish.scpt
${OSX_DIR}/fish_term_icon.icns ${OSX_DIR}/fish_term_icon.icns