From df83b4ba80581851cd8d4319cb8518f61e605c5e Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Wed, 18 Oct 2023 23:40:22 +0000 Subject: [PATCH] build: macOS builder updates Bump openssl, curl, glib, sdl2, sfml, wxWidgets and ffmpeg. Add support for DIST_INSTALL_TARGETS in order to use `make install_sw` instead of `make install` for openssl because installing the man pages and symlinks to them is very painfully slow with my install code. It's even more painfully slow with whatever whoever did to my macOS virtual machine. Add `brew unlink openssl@3` in the brew setup code because someone broke my compiler and it's not giving precedence to the include directories passed on the command line, breaking the build. Remove `-stdlib=libc++` from compiler flags. This was only necessary when using a 10.7 macOS target, which has both libstdc++ and libc++, libc++ being the newer and current distribution of the C++ standard library for clang and macOS. We are now using a 10.10 macOS target which does not have the old libstdc++, and this compiler option no longer exists, causing a build failure in glib due to -Werror and an unused command line option warning. Remove my patch to link gettext statically for glib, this has been fixed in the newer versions. Install meson using pip in the python3 POST_BUILD instead of using a dist. Add the variables MAKE and MESON to point to the respective invoking commands. Check for /usr/bin/perl before /usr/local/bin/perl, the brew perl no longer works but the macOS perl does. Fix overwriting meson with a symlink when meson has already been installed. Signed-off-by: Rafael Kitover --- tools/builder/core.sh | 94 +++++++++++++++++++++++++------------------ tools/macOS/builder | 14 +++---- 2 files changed, 60 insertions(+), 48 deletions(-) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 74623e16..8a0dadbe 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -108,8 +108,8 @@ DISTS=$DISTS' unzip https://downloads.sourceforge.net/project/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/unzip60.tar.gz bin/unzip zlib-ng https://github.com/zlib-ng/zlib-ng/archive/ce01b1e41da298334f8214389cc9369540a7560f.tar.gz lib/libz.a zip https://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz bin/zip - openssl https://www.openssl.org/source/openssl-1.1.1g.tar.gz lib/libssl.a - curl https://curl.haxx.se/download/curl-7.85.0.tar.xz lib/libcurl.a + openssl https://www.openssl.org/source/openssl-1.1.1w.tar.gz lib/libssl.a + curl https://github.com/curl/curl/releases/download/curl-8_4_0/curl-8.4.0.tar.bz2 lib/libcurl.a cmake https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1.tar.gz bin/cmake zstd https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz lib/libzstd.a hiredis https://github.com/redis/hiredis/archive/refs/tags/v1.0.2.tar.gz lib/libhiredis.a @@ -123,7 +123,7 @@ DISTS=$DISTS' help2man https://ftp.gnu.org/gnu/help2man/help2man-1.49.2.tar.xz bin/help2man libiconv https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz lib/libiconv.a gettext http://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.xz lib/libintl.a - getopt https://fossies.org/linux/misc/getopt-1.1.6.tar.gz bin/getopt + getopt http://frodo.looijaard.name/system/files/software/getopt/getopt-1.1.6.tar.gz bin/getopt gsed http://ftp.gnu.org/gnu/sed/sed-4.8.tar.xz bin/sed bison https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz bin/bison texinfo http://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.xz bin/makeinfo @@ -175,21 +175,18 @@ DISTS=$DISTS' XML-Parser https://cpan.metacpan.org/authors/id/T/TO/TODDR/XML-Parser-2.46.tar.gz perl5/man/man3/XML*Parser.3* intltool https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz bin/intltoolize ninja https://github.com/ninja-build/ninja/archive/v1.11.1.tar.gz bin/ninja - meson https://github.com/mesonbuild/meson/releases/download/0.63.2/meson-0.63.2.tar.gz bin/meson - - glib https://gitlab.gnome.org/GNOME/glib/-/archive/6fc6d9ea3e497e2b77789a61bc9cf80bfb3d367d/glib-6fc6d9ea3e497e2b77789a61bc9cf80bfb3d367d.tar.bz2 lib/libglib-2.0.a - + glib https://gitlab.gnome.org/GNOME/glib/-/archive/046f70cc0ddd1db310d30b02c692ee1364c41e16/glib-046f70cc0ddd1db310d30b02c692ee1364c41e16.tar.bz2 lib/libglib-2.0.a libgpg-error https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.45.tar.bz2 lib/libgpg-error.a libgcrypt https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.10.1.tar.bz2 lib/libgcrypt.a libsecret https://gitlab.gnome.org/GNOME/libsecret/-/archive/0.20.5/libsecret-0.20.5.tar.bz2 lib/libsecret-1.a - sdl2 https://github.com/libsdl-org/SDL/releases/download/release-2.28.0/SDL2-2.28.0.tar.gz lib/libSDL2.a + sdl2 https://github.com/libsdl-org/SDL/releases/download/release-2.28.4/SDL2-2.28.4.tar.gz lib/libSDL2.a flac https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.3.4.tar.xz lib/libFLAC.a libogg http://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.xz lib/libogg.a libvorbis http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz lib/libvorbis.a harfbuzz https://github.com/harfbuzz/harfbuzz/releases/download/5.1.0/harfbuzz-5.1.0.tar.xz lib/libharfbuzz.a - sfml https://github.com/SFML/SFML/releases/download/2.5.1/SFML-2.5.1-sources.zip lib/libsfml-system-s.a + sfml https://github.com/SFML/SFML/archive/refs/tags/2.6.0.tar.gz lib/libsfml-system-s.a shared-mime-info https://gitlab.freedesktop.org/xdg/shared-mime-info/-/archive/2.2/shared-mime-info-2.2.tar.bz2 bin/update-mime-database - wxwidgets https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2 lib/libwx_baseu-3.*.a + wxwidgets https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.3/wxWidgets-3.2.3.tar.bz2 lib/libwx_baseu-3.*.a graphite2 https://github.com/silnrsi/graphite/archive/425da3d08926b9cf321fc0014dfa979c24d2cf64.tar.gz lib/libgraphite2.a xvidcore https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.bz2 lib/libxvidcore.a fribidi https://github.com/fribidi/fribidi/releases/download/v1.0.12/fribidi-1.0.12.tar.xz lib/libfribidi.a @@ -212,7 +209,7 @@ DISTS=$DISTS' libxavs https://github.com/Distrotech/xavs/archive/8300fbf4918bca2af1af2aee6a337815e90b51e1.tar.gz lib/libxavs.a libzmq https://github.com/zeromq/libzmq/releases/download/v4.3.4/zeromq-4.3.4.tar.gz lib/libzmq.a # libzvbi https://downloads.sourceforge.net/project/zapping/zvbi/0.2.35/zvbi-0.2.35.tar.bz2 lib/libzvbi.a - ffmpeg http://ffmpeg.org/releases/ffmpeg-5.1.1.tar.xz lib/libavformat.a + ffmpeg http://ffmpeg.org/releases/ffmpeg-6.0.tar.xz lib/libavformat.a ' BUILD_FFMPEG=1 @@ -233,6 +230,9 @@ export CONFIGURE_INSTALL_ARGS="--prefix=/usr --sysconfdir=/etc" export CMAKE_INSTALL_ARGS="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_FULL_SYSCONFDIR=/etc" +export MESON=meson +export MAKE=make + export MESON_INSTALL_ARGS="--prefix /usr --sysconfdir /etc" if [ -z "$target_os" ] && [ "$os" = linux ] && [ "$bits" = 64 ]; then @@ -326,6 +326,8 @@ DIST_POST_BUILD="$DIST_POST_BUILD xmlcatalog --noout --create \"\$(cygpath -m \"\$BUILD_ROOT/root/etc/xml/catalog.xml\")\" || :; python2 python2 -m pip install six; python3 python3 -m pip install six; \ + rm \"\$BUILD_ROOT/root/bin/meson\"; \ + python3 -m pip install meson; \ rebuild_dist libxml2 --with-python --with-python3; fontconfig mkdir -p \"\$BUILD_ROOT/root/etc/fonts\"; \ touch \"\$BUILD_ROOT/root/etc/fonts/fonts.conf\"; \ @@ -345,9 +347,9 @@ DIST_CONFIGURE_OVERRIDES="$DIST_CONFIGURE_OVERRIDES DIST_BUILD_OVERRIDES="$DIST_BUILD_OVERRIDES c2man ./Configure -de -Dprefix=/usr -Dmansrc=/usr/share/man/man1 -Dcc=\"\$CC\"; \ sed -i.bak \"s|/[^ ][^ ]*/libfl[.][^ ]*|-L\$BUILD_ROOT/root/lib -lfl|\" Makefile; \ - make -j\$NUM_CPUS; \ - make install bin=\"\$BUILD_ROOT/root/bin\" mansrc=\"\$BUILD_ROOT/root/share/man/man1\" privlib=\"\$BUILD_ROOT/root/lib/c2man\" - zstd make -j\$NUM_CPUS -C lib install-static DESTDIR=\"\$BUILD_ROOT/root\" LIBDIR=/lib + \$MAKE -j\$NUM_CPUS; \ + \$MAKE install bin=\"\$BUILD_ROOT/root/bin\" mansrc=\"\$BUILD_ROOT/root/share/man/man1\" privlib=\"\$BUILD_ROOT/root/lib/c2man\" + zstd \$MAKE -j\$NUM_CPUS -C lib install-static DESTDIR=\"\$BUILD_ROOT/root\" LIBDIR=/lib setuptools python bootstrap.py; python easy_install.py . pip easy_install . ninja python configure.py --bootstrap && cp -af ./ninja \"\$BUILD_ROOT/root/bin\" @@ -424,8 +426,8 @@ DIST_MAKE_ARGS="$DIST_MAKE_ARGS libgsm CC=\"\$CC \$CFLAGS\" " -DIST_MAKE_INSTALL_ARGS="$DIST_MAKE_INSTALL_ARGS - openssl MANDIR=/share/man +DIST_INSTALL_TARGETS="$DIST_INSTALL_OVERRIDES + openssl install_sw " DIST_EXTRA_LDFLAGS="$DIST_EXTRA_LDFLAGS @@ -605,7 +607,9 @@ num_cpus() { } setup_perl() { - if [ -x /usr/local/bin/perl ]; then + if [ -x /usr/bin/perl ]; then + perl=/usr/bin/perl + elif [ -x /usr/local/bin/perl ]; then perl=/usr/local/bin/perl else perl=$(command -v perl || :) @@ -619,25 +623,25 @@ setup_perl() { ln -sf "$perl" "$BUILD_ROOT/root/bin/perl" fi - if ! command -v cpanm >/dev/null; then - "$perl" -MApp::Cpan -e 'App::Cpan->run(qw/-f -i App::cpanminus/)' - fi + "$perl" -MCPAN -e 'CPAN::Shell->notest("install", "App::cpanminus")' fi } setup_meson() { - if [ -x /usr/local/bin/meson ]; then - meson=/usr/local/bin/meson - else - meson=$(command -v meson || :) - fi - - if [ -n "$meson" ]; then - if [ -n "$msys2" ] || [ -n "$cygwin" ]; then - ln -sf "$meson" "$BUILD_ROOT/root/bin/meson.exe" - meson="$BUILD_ROOT/root/bin/meson.exe" + if ! [ -x "$BUILD_ROOT/root/bin/meson" ]; then + if [ -x /usr/local/bin/meson ]; then + meson=/usr/local/bin/meson else - ln -sf "$meson" "$BUILD_ROOT/root/bin/meson" + meson=$(command -v meson || :) + fi + + if [ -n "$meson" ]; then + if [ -n "$msys2" ] || [ -n "$cygwin" ]; then + ln -sf "$meson" "$BUILD_ROOT/root/bin/meson.exe" + meson="$BUILD_ROOT/root/bin/meson.exe" + else + ln -sf "$meson" "$BUILD_ROOT/root/bin/meson" + fi fi fi } @@ -838,6 +842,9 @@ mac_install_core_deps() { fi /usr/local/bin/brew install -q perl meson ninja + + # This is necessary because someone broke my compiler. + /usr/local/bin/brew unlink openssl@3 >/dev/null 2>&1 || : } setup_tmp_dir() { @@ -1481,7 +1488,7 @@ build_dist() { echo_eval_run "$configure_override $@" else eval "set -- $(dist_args "$current_dist" meson) $extra_dist_args" - echo_run meson .. "$@" + echo_run $MESON .. "$@" fi dist_post_configure "$current_dist" eval "set -- $(dist_ninja_args "$current_dist")" @@ -1566,7 +1573,7 @@ build_dist() { dist_post_configure "$current_dist" eval "set -- $(dist_make_args "$current_dist")" - echo_run make -j$NUM_CPUS "$@" + echo_run $MAKE -j$NUM_CPUS "$@" if [ -z "$install_override" ]; then rm -rf destdir @@ -1606,7 +1613,7 @@ build_dist() { eval "set -- $(dist_make_install_args "$current_dist")" - echo_run make "$@" install DESTDIR="$PWD/destdir" || : + echo_run $MAKE "$@" install DESTDIR="$PWD/destdir" || : install_dist "$current_dist" else @@ -1627,7 +1634,7 @@ build_dist() { fi dist_post_configure "$current_dist" eval "set -- $(dist_make_args "$current_dist")" - echo_run make -j$NUM_CPUS "$@" + echo_run $MAKE -j$NUM_CPUS "$@" if [ -z "$install_override" ]; then rm -rf destdir @@ -1635,7 +1642,7 @@ build_dist() { eval "set -- $(dist_make_install_args "$current_dist")" - echo_run make "$@" install DESTDIR="$PWD/destdir" || : + echo_run $MAKE "$@" install DESTDIR="$PWD/destdir" || : install_dist "$current_dist" else @@ -1701,7 +1708,7 @@ build_dist() { eval "set -- $DIST_BARE_MAKE_ARGS $(dist_make_args "$current_dist")" - echo_run make -j$NUM_CPUS "$@" + echo_run $MAKE -j$NUM_CPUS "$@" if [ -z "$install_override" ]; then eval "set -- $(dist_make_install_args "$current_dist")" @@ -1755,9 +1762,9 @@ make_install() { unset LIBRARY_PATH if grep -Eq 'DESTDIR|cmake_install\.cmake' $(find . -name Makefile -o -name makefile -o -name '*.mk' -o -name '*.mak') 2>/dev/null; then - echo_eval_run make install $(dist_make_args $current_dist) prefix="${prefix}" PREFIX="${prefix}" DESTDIR="$PWD/destdir" "$@" || : + echo_eval_run $MAKE $(dist_install_target $current_dist) $(dist_make_args $current_dist) prefix="${prefix}" PREFIX="${prefix}" DESTDIR="$PWD/destdir" "$@" || : else - echo_eval_run make install $(dist_make_args $current_dist) prefix="$PWD/destdir${prefix}" PREFIX="$PWD/destdir${prefix}" INSTALL_PREFIX="$PWD/destdir${prefix}" INSTALL_ROOT="$PWD/destdir${prefix}" INSTALLTOP="/..${prefix}/" "$@" || : + echo_eval_run $MAKE $(dist_install_target $current_dist) $(dist_make_args $current_dist) prefix="$PWD/destdir${prefix}" PREFIX="$PWD/destdir${prefix}" INSTALL_PREFIX="$PWD/destdir${prefix}" INSTALL_ROOT="$PWD/destdir${prefix}" INSTALLTOP="/..${prefix}/" "$@" || : fi export LIBRARY_PATH="$ORIG_LIBRARY_PATH" @@ -2285,6 +2292,15 @@ dist_configure_override() { puts "$(table_line DIST_CONFIGURE_OVERRIDES $current_dist)" || : } +dist_install_target() { + current_dist=$1 + [ -n "$current_dist" ] || die 'dist_install_override: dist name required' + + target="$(table_line DIST_INSTALL_TARGETS $current_dist)" || : + [ -z "$target" ] && target=install + puts "$target" +} + dist_install_override() { current_dist=$1 [ -n "$current_dist" ] || die 'dist_install_override: dist name required' diff --git a/tools/macOS/builder b/tools/macOS/builder index d20e84b6..3491ddf4 100755 --- a/tools/macOS/builder +++ b/tools/macOS/builder @@ -80,10 +80,10 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin export CC=clang export CXX=clang++ export CPPFLAGS="-DICONV_CONST=" -export CFLAGS="-m${target_bits} -framework Carbon -framework Foundation -framework CoreServices -stdlib=libc++ -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" -export CXXFLAGS="-m${target_bits} -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" -export OBJCXXFLAGS="-m${target_bits} -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" -export LDFLAGS="-m${target_bits} -framework Carbon -framework Foundation -framework CoreServices -stdlib=libc++ -Wno-unused-command-line-argument -Wl,-no_compact_unwind" +export CFLAGS="-m${target_bits} -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" +export CXXFLAGS="-m${target_bits} -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" +export OBJCXXFLAGS="-m${target_bits} -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind" +export LDFLAGS="-m${target_bits} -framework Carbon -framework Foundation -framework CoreServices -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" @@ -131,10 +131,6 @@ else table_line_replace DIST_CONFIGURE_OVERRIDES openssl './Configure darwin64-x86_64-cc no-shared --prefix=/usr --openssldir=/etc/ssl' fi -table_line_append DIST_PATCHES glib " \ - https://gist.githubusercontent.com/rkitover/9f3cceac7eaa9625ce605f052c56f3ba/raw/2ceb1de9a9592e39a657141684beae4e4b33abcd/glib-static-gettext.patch \ -" - stdint_h= if [ -f "$(xcode-select -p)/SDKs/MacOSX.sdk/usr/include/stdint.h" ]; then @@ -190,7 +186,7 @@ table_line_append DIST_PRE_BUILD ffmpeg "sed -i.bak 's/-lstdc++/-lc++/g' configu #table_line_replace DISTS wxwidgets "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5.1/wxWidgets-3.0.5.1.tar.bz2 lib/libwx_baseu-3.0*.a" # For 10.7 add --disable-stl -table_line_append DIST_ARGS wxwidgets "--with-macosx-version-min=\$MACOSX_DEPLOYMENT_TARGET LDFLAGS=\"\$LDFLAGS -stdlib=libc++\"" +table_line_append DIST_ARGS wxwidgets "--with-macosx-version-min=\$MACOSX_DEPLOYMENT_TARGET" table_line_append DIST_ARGS libmodplug "CC=clang++ CXX=clang++"