From 491bc1c00900214765debb6d1c16500003685660 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Fri, 2 May 2025 23:51:26 +0000 Subject: [PATCH] build: set framework search path in Mac builder Use `-F` to pass the `Frameworks` path of the selected SDK to clang. Also remove things already in `CPPFLAGS` from `CFLAGS`, `CXXFLAGS` and `OBJCXXFLAGS`. Signed-off-by: Rafael Kitover --- tools/builder/core.sh | 6 +++--- tools/macOS/builder | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 3dde3588..853d91b5 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -46,9 +46,9 @@ else fi export CPPFLAGS="$CPPFLAGS${CPPFLAGS:+ }-isystem \$BUILD_ROOT/root/include -DCURL_STATICLIB -DGRAPHITE2_STATIC -DFLOAT_APPROX -Diconv=libiconv -Diconv_open=libiconv_open -Diconv_close=libiconv_close" -export CFLAGS="-mtune=generic $CFLAGS${CFLAGS:+ }-fPIC -isystem \$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -pthread -lm -O3 -ffast-math $MARCH -pipe -Wno-error=implicit-int" -export CXXFLAGS="-mtune=generic $CXXFLAGS${CXXFLAGS:+ }-fPIC -isystem \$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm -DCURL_STATICLIB -DGRAPHITE2_STATIC -DFLOAT_APPROX -O3 -ffast-math $MARCH -pipe" -export OBJCXXFLAGS="-mtune=generic $OBJCXXFLAGS${OBJCXXFLAGS:+ }-fPIC -isystem \$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm -DCURL_STATICLIB -DGRAPHITE2_STATIC -DFLOAT_APPROX -O3 -ffast-math $MARCH -mtune=generic -pipe" +export CFLAGS="-mtune=generic $CFLAGS${CFLAGS:+ }-fPIC -L\$BUILD_ROOT/root/lib -pthread -lm -O3 -ffast-math $MARCH -pipe -Wno-error=implicit-int" +export CXXFLAGS="-mtune=generic $CXXFLAGS${CXXFLAGS:+ }-fPIC -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm -O3 -ffast-math $MARCH -pipe" +export OBJCXXFLAGS="-mtune=generic $OBJCXXFLAGS${OBJCXXFLAGS:+ }-fPIC -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm -O3 -ffast-math $MARCH -mtune=generic -pipe" export LDFLAGS="-mtune=generic $LDFLAGS${LDFLAGS:+ }-fPIC -L\$BUILD_ROOT/root/lib -pthread -lm -O3 -ffast-math $MARCH -pipe" export STRIP="\${STRIP:-strip}" diff --git a/tools/macOS/builder b/tools/macOS/builder index 99f27871..7c0777c4 100755 --- a/tools/macOS/builder +++ b/tools/macOS/builder @@ -89,8 +89,11 @@ fi oldest_sdk=$(find /Library/Developer/CommandLineTools/SDKs -maxdepth 1 -mindepth 1 2>/dev/null | xargs basename | sed -E 's/^MacOSX//; s/\.sdk$//' | grep -E '[[:digit:]]' | sort -V | head -1) extra_includes= +framework_path= + if [ -n "$oldest_sdk" ]; then extra_includes="-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX${oldest_sdk}.sdk/usr/include -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX${oldest_sdk}.sdk/usr/include/c++/v1" + framework_path="-F/Library/Developer/CommandLineTools/SDKs/MacOSX${oldest_sdk}.sdk/System/Library/Frameworks" fi export BUILD_ROOT="${BUILD_ROOT:-$HOME/vbam-build-mac-${target_cpu}}$BUILD_ROOT_SUFFIX" @@ -133,11 +136,11 @@ export PATH="$best_llvm_path/bin:/usr/bin:/bin:/usr/sbin:/sbin:$BREW_PREFIX/bin" export CC="$clang_path/bin/clang" export CPP="$clang_path/bin/clang -E" export CXX="$clang_path/bin/clang++" -export CPPFLAGS="-DICONV_CONST= $extra_includes" -export CFLAGS="$target_build_arch -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" -export CXXFLAGS="$target_build_arch -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" -export OBJCXXFLAGS="$target_build_arch -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" -export LDFLAGS="$target_build_arch -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -Wl,-no_compact_unwind" +export CPPFLAGS="-DICONV_CONST= $extra_includes $framework_path" +export CFLAGS="$target_build_arch $framework_path -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -Wl,-no_compact_unwind" +export CXXFLAGS="$target_build_arch $framework_path -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -Wl,-no_compact_unwind" +export OBJCXXFLAGS="$target_build_arch $framework_path -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -Wl,-no_compact_unwind" +export LDFLAGS="$target_build_arch $framework_path -framework Carbon -framework Foundation -framework CoreServices -framework SystemConfiguration -Wno-unused-command-line-argument -Wl,-no_compact_unwind" export UUID_CFLAGS="-I\$BUILD_ROOT/root/stow/libuuid/include" export UUID_LIBS="-L\$BUILD_ROOT/root/stow/libuuid/lib -luuid"