From c054ef2441022928e82d26bdaa23bb01452c1b6f Mon Sep 17 00:00:00 2001 From: gnattu Date: Fri, 12 Jul 2024 14:34:35 +0800 Subject: [PATCH 1/5] ci: remove unnecessary workaround for intel mac --- builder/images/macos/00-dep.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/builder/images/macos/00-dep.sh b/builder/images/macos/00-dep.sh index 45338b118d6..b4e3d59dc8c 100644 --- a/builder/images/macos/00-dep.sh +++ b/builder/images/macos/00-dep.sh @@ -1,12 +1,6 @@ #!/bin/bash ffbuild_macbase() { - if [[ $TARGET == mac64 ]]; then - # For unknown reason ffmpeg insist to link to against libx11 and is hard to debug - # It does not link against libx11 on arm64, which is strange - # Remove everything using libx11 on github's x86 macOS host as a workaround - brew uninstall ant cairo gradle harfbuzz kotlin libxext libxft libxrender maven openjdk r sbt selenium-server libx11 - fi brew install wget subversion mercurial autoconf automake cmake meson ninja pkg-config coreutils gcc make python-setuptools pcre2 libtool gnu-sed gnu-tar nasm quilt mkdir /opt/ffbuild/bin cp "$BUILDER_ROOT"/images/base/git-mini-clone.sh /opt/ffbuild/bin/git-mini-clone From 118b6fced83e1e2bf06bab41aac88c7601e58da7 Mon Sep 17 00:00:00 2001 From: gnattu Date: Fri, 12 Jul 2024 14:37:56 +0800 Subject: [PATCH 2/5] ci: disable glib intergration for harfbuzz for macos --- builder/images/macos/02-pcre2.sh | 18 ------------------ builder/images/macos/03-glib2.sh | 20 -------------------- builder/scripts.d/45-harfbuzz.sh | 6 ++++++ 3 files changed, 6 insertions(+), 38 deletions(-) delete mode 100644 builder/images/macos/02-pcre2.sh delete mode 100644 builder/images/macos/03-glib2.sh diff --git a/builder/images/macos/02-pcre2.sh b/builder/images/macos/02-pcre2.sh deleted file mode 100644 index 40e30cf8384..00000000000 --- a/builder/images/macos/02-pcre2.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# Although newer macOS has libpcre built-in, it is absent on macOS12 -ffbuild_macbase() { - wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2 - tar xvf pcre2-10.42.tar.bz2 - cd pcre2-10.42 - ./configure --prefix="$FFBUILD_PREFIX" \ - --disable-shared \ - --enable-static \ - --disable-dependency-tracking \ - --enable-pcre2-16 \ - --enable-pcre2-32 \ - --enable-pcre2grep-libz \ - --enable-pcre2grep-libbz2 \ - --enable-jit - make -j$(nproc) - make install -} diff --git a/builder/images/macos/03-glib2.sh b/builder/images/macos/03-glib2.sh deleted file mode 100644 index 8b6ef03b0ad..00000000000 --- a/builder/images/macos/03-glib2.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -ffbuild_macbase() { - wget https://download.gnome.org/sources/glib/2.78/glib-2.78.4.tar.xz - tar xvf glib-2.78.4.tar.xz - cd glib-2.78.4 - meson setup build --default-library=both \ - --localstatedir="$FFBUILD_PREFIX"/var \ - -Dgio_module_dir="$FFBUILD_PREFIX"/lib/gio/modules \ - -Dbsymbolic_functions=false \ - -Ddtrace=false \ - -Druntime_dir="$FFBUILD_PREFIX"/var/run \ - -Dtests=false \ - --prefix="$FFBUILD_PREFIX" \ - --buildtype=release \ - --default-library=static - - sed -i '' 's/MacOSX11\.sdk/MacOSX\.sdk/g' build/build.ninja - meson compile -C build --verbose - meson install -C build -} diff --git a/builder/scripts.d/45-harfbuzz.sh b/builder/scripts.d/45-harfbuzz.sh index 934a2710056..e045e23f235 100755 --- a/builder/scripts.d/45-harfbuzz.sh +++ b/builder/scripts.d/45-harfbuzz.sh @@ -23,6 +23,12 @@ ffbuild_dockerbuild() { --host="$FFBUILD_TOOLCHAIN" ) elif [[ $TARGET == mac* ]]; then + myconf+=( + --with-glib=no + --with-cairo=no + --with-chafa=no + --with-icu=no + ) # freetype's pkg-config usage cannot find static libbrotli export FREETYPE_LIBS="$(pkg-config --libs --static freetype2)" else From 2bf215e8aef4227d97575d6ca4471b45ead02ad8 Mon Sep 17 00:00:00 2001 From: gnattu Date: Fri, 12 Jul 2024 14:41:20 +0800 Subject: [PATCH 3/5] ci: properly disable x11 on macos --- builder/variants/defaults-mac.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/builder/variants/defaults-mac.sh b/builder/variants/defaults-mac.sh index fc94e114037..5c716d88f98 100644 --- a/builder/variants/defaults-mac.sh +++ b/builder/variants/defaults-mac.sh @@ -3,14 +3,18 @@ XCODE_MAJOR_VER="$(xcodebuild -version | grep 'Xcode' | awk '{print $2}' | cut - FF_CFLAGS+="-I"$FFBUILD_PREFIX"/include" FF_LDFLAGS+="-L"$FFBUILD_PREFIX"/lib" -FF_CONFIGURE+=" --disable-libjack --disable-indev=jack --enable-neon --enable-runtime-cpudetect --enable-audiotoolbox --enable-videotoolbox" +FF_CONFIGURE+=" --disable-libjack --disable-indev=jack --disable-libxcb --disable-xlib --enable-neon --enable-runtime-cpudetect --enable-audiotoolbox --enable-videotoolbox" FFBUILD_TARGET_FLAGS="--disable-shared --enable-static --pkg-config-flags=\"--static\" --enable-pthreads --cc=clang" FF_HOST_CFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I"$FFBUILD_PREFIX"/include" FF_HOST_LDFLAGS="" -if [ $XCODE_MAJOR_VER -ge 15 ]; then - FF_HOST_LDFLAGS+="-Wl,-ld_classic " - export LDFLAGS="-Wl,-ld_classic" -fi + +# This is no longer needed for latest xcode. +# If you enconters duplicated symbol linker error try uncomment the following +# if [ $XCODE_MAJOR_VER -ge 15 ]; then +# FF_HOST_LDFLAGS+="-Wl,-ld_classic " +# export LDFLAGS="-Wl,-ld_classic" +# fi + FF_HOST_LDFLAGS+="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L"$FFBUILD_PREFIX"/lib" export PKG_CONFIG_LIBDIR="/usr/lib/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/$MACOS_MAJOR_VER:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/$MACOS_MAJOR_VER" export CMAKE_PREFIX_PATH=""$FFBUILD_PREFIX"" From adb5fbd4e75862400faaa923c4ad2789baa47213 Mon Sep 17 00:00:00 2001 From: gnattu Date: Fri, 12 Jul 2024 14:42:09 +0800 Subject: [PATCH 4/5] ci: prefer macOS native vDSP instead of fftw for better performance --- builder/buildmac.sh | 2 +- builder/scripts.d/25-fftw3f.sh | 2 ++ builder/scripts.d/50-chromaprint.sh | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/builder/buildmac.sh b/builder/buildmac.sh index d6520266222..afdd15c428c 100755 --- a/builder/buildmac.sh +++ b/builder/buildmac.sh @@ -53,7 +53,7 @@ FF_HOST_CFLAGS="$(xargs <<< "$FF_HOST_CFLAGS")" FF_HOST_LDFLAGS="$(xargs <<< "$FF_HOST_LDFLAGS")" FFBUILD_TARGET_FLAGS="$(xargs <<< "$FFBUILD_TARGET_FLAGS")" -mkdir build +mkdir -p build for macbase in images/macos/*.sh; do cd "$BUILDER_ROOT"/build source "$BUILDER_ROOT"/"$macbase" diff --git a/builder/scripts.d/25-fftw3f.sh b/builder/scripts.d/25-fftw3f.sh index 6cc526b8ef2..1b6eaef4714 100755 --- a/builder/scripts.d/25-fftw3f.sh +++ b/builder/scripts.d/25-fftw3f.sh @@ -6,6 +6,8 @@ SCRIPT_COMMIT="cab901fe465324cb46bd4953e18ddc610ade29b9" ffbuild_enabled() { # Dependency of GPL-Only librubberband [[ $VARIANT == lgpl* ]] && return -1 + # Prefer macOS native vDSP + [[ $TARGET == mac* ]] && return -1 return 0 } diff --git a/builder/scripts.d/50-chromaprint.sh b/builder/scripts.d/50-chromaprint.sh index 01dc16df732..a08579711d8 100755 --- a/builder/scripts.d/50-chromaprint.sh +++ b/builder/scripts.d/50-chromaprint.sh @@ -14,7 +14,7 @@ ffbuild_dockerbuild() { mkdir build && cd build if [[ $TARGET == mac* ]]; then - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DBUILD_TOOLS=OFF -DBUILD_TESTS=OFF -DFFT_LIB=fftw3f .. + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DBUILD_TOOLS=OFF -DBUILD_TESTS=OFF -DFFT_LIB=vdsp .. else cmake -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DBUILD_SHARED_LIBS=OFF -DBUILD_TOOLS=OFF -DBUILD_TESTS=OFF -DFFT_LIB=fftw3f .. fi @@ -22,7 +22,12 @@ ffbuild_dockerbuild() { make -j$(nproc) make install - echo "Libs.private: -lfftw3f -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/libchromaprint.pc + if [[ $TARGET != mac* ]]; then + echo "Libs.private: -lfftw3f -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/libchromaprint.pc + else + echo "Libs.private: -framework Accelerate -lstdc++" >> "$FFBUILD_PREFIX"/lib/pkgconfig/libchromaprint.pc + fi + echo "Cflags.private: -DCHROMAPRINT_NODLL" >> "$FFBUILD_PREFIX"/lib/pkgconfig/libchromaprint.pc } From 6d69187bae4fcdb5ee1aef4ae7099238e1e47d9f Mon Sep 17 00:00:00 2001 From: gnattu Date: Fri, 12 Jul 2024 16:49:55 +0800 Subject: [PATCH 5/5] ci: use the current xcode version for comment --- builder/variants/defaults-mac.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/variants/defaults-mac.sh b/builder/variants/defaults-mac.sh index 5c716d88f98..f171004576a 100644 --- a/builder/variants/defaults-mac.sh +++ b/builder/variants/defaults-mac.sh @@ -8,7 +8,7 @@ FFBUILD_TARGET_FLAGS="--disable-shared --enable-static --pkg-config-flags=\"--st FF_HOST_CFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I"$FFBUILD_PREFIX"/include" FF_HOST_LDFLAGS="" -# This is no longer needed for latest xcode. +# As of Xcode 15.4, this workaround is no longer needed. # If you enconters duplicated symbol linker error try uncomment the following # if [ $XCODE_MAJOR_VER -ge 15 ]; then # FF_HOST_LDFLAGS+="-Wl,-ld_classic "