Allow overriding what archs to build for, or what version to target, for MACOS_REDIST builds

This commit is contained in:
Martin Storsjö committed 2022-10-21 18:00:20 +03:00
1 parent 53e803c424
commit 349877296b
4 files changed
+57 -7

No files matched your search

+19 -2
View File
@@ -74,9 +74,26 @@ else
fi
if [ -n "$MACOS_REDIST" ]; then
if [ -z "$CFLAGS" ]; then
export CFLAGS="-g -O2"
CFLAGS="-g -O2"
fi
export CFLAGS="$CFLAGS -arch arm64 -arch x86_64 -mmacosx-version-min=10.9"
: ${MACOS_REDIST_ARCHS:=arm64 x86_64}
: ${MACOS_REDIST_VERSION:=10.9}
NONNATIVE_ARCH=
for arch in $MACOS_REDIST_ARCHS; do
CFLAGS="$CFLAGS -arch $arch"
if [ "$(uname -m)" != "$arch" ]; then
case $arch in
arm64) NONNATIVE_ARCH=aarch64 ;;
*) NONNATIVE_ARCH=$arch ;;
esac
fi
done
if [ -n "$NONNATIVE_ARCH" ]; then
# If we're not building for the native arch, flag that we're
# cross compiling.
CONFIGFLAGS="$CONFIGFLAGS --host=$NONNATIVE_ARCH-apple-darwin"
fi
export CFLAGS="$CFLAGS -mmacosx-version-min=$MACOS_REDIST_VERSION"
fi
if [ -n "$SKIP_INCLUDE_TRIPLET_PREFIX" ]; then
INCLUDEDIR="$PREFIX/include"