diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 41569f3d..3519de3c 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -824,7 +824,9 @@ mac_install_core_deps() { error 'Please install Mac Homebrew: https://brew.sh/' fi - "$BREW_PREFIX"/bin/brew install -q m4 perl perl-xml-parser meson ninja pyenv cmake + "$BREW_PREFIX"/bin/brew install -q m4 perl perl-xml-parser meson ninja pyenv cmake gnu-getopt + + ln -sf "$(find "$BREW_PREFIX"/Cellar/gnu-getopt -path '*/bin/getopt' | head -1)" "$BUILD_ROOT/root/bin/getopt" if ! [ -d "$(pyenv root)/versions/2.7.18" ]; then pyenv install -s 2.7.18 diff --git a/tools/macOS/builder b/tools/macOS/builder index cf6d7aaa..a2387df9 100755 --- a/tools/macOS/builder +++ b/tools/macOS/builder @@ -86,14 +86,20 @@ if [ -n "$BREW_PREFIX" ]; then "$BREW_PREFIX"/bin/brew unlink gettext >/dev/null 2>&1 || : 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) +latest_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 | tail -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" +if [ -n "$latest_sdk" ]; then + extra_includes="-nostdinc -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX${latest_sdk}.sdk/usr/include -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX${latest_sdk}.sdk/usr/include/c++/v1" + framework_path="-F/Library/Developer/CommandLineTools/SDKs/MacOSX${latest_sdk}.sdk/System/Library/Frameworks" +fi + +latest_clang_includes=/Library/Developer/CommandLineTools/usr/lib/clang/$(find /Library/Developer/CommandLineTools/usr/lib/clang/ -mindepth 1 -maxdepth 1 | xargs basename | sort -V | tail -1)/include + +if [ -d "$latest_clang_includes" ]; then + extra_includes="-isystem $latest_clang_includes $extra_includes" fi export BUILD_ROOT="${BUILD_ROOT:-$HOME/vbam-build-mac-${target_cpu}}$BUILD_ROOT_SUFFIX" @@ -161,13 +167,10 @@ fi BUILD_ENV=$(printf '%s' "$BUILD_ENV" | sed 's/ -lm / /g') export BUILD_ENV -for dist in flex libsecret c2man graphviz zip; do - table_line_remove DISTS "$dist" +for dist in XML-Parser c2man cmake cmake flex getopt graphviz libffi libgcrypt libsecret m4 ninja python2 shared-mime-info zip; do + table_line_remove DISTS $dist done -# issues with perl modules linked to our libs and brew perl -table_line_remove DISTS shared-mime-info - table_line_replace DIST_PREFIX libuuid /usr/stow/libuuid table_line_append DIST_PRE_BUILD zip " \ @@ -218,8 +221,6 @@ if [ "$target_cpu" = i386 ]; then table_line_append DIST_ARGS libicu '--host= --build=' fi -table_line_remove DISTS ninja - table_line_replace DIST_CONFIGURE_TYPES libmodplug autoreconf table_line_append DIST_PRE_BUILD libmodplug " \ sed -i.bak '/-mmacosx-version-min=/d' configure.ac; \ @@ -249,18 +250,11 @@ table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg "--disable-videotoolbox --extr #table_line_append DIST_PATCHES ffmpeg "-p0 https://gist.githubusercontent.com/rkitover/db75d083b74617b186eec11965c1da74/raw/20da2f8c6d8c02ce284096c5e805ae671351cc6e/ffmpeg-macos10-7.patch" -table_line_remove DISTS python2 if [ -n "$APPLE_SILICON" ] && [ "$target_cpu" != ARM64 ]; then - table_line_remove DISTS m4 - table_line_remove DISTS XML-Parser - table_line_remove DISTS libffi - table_line_remove DISTS libgcrypt table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg '--disable-asm' fi -table_line_remove DISTS cmake - builder "$@" if [ -n "$PREV_XCODE" ]; then