#!/bin/sh # Build the vendored wxWidgets 3.3.3 for macOS: wxOSX/Cocoa, static, # monolithic, and universal (arm64 + x86_64) so one prefix serves both Rust # targets. Run on a Mac with the Xcode Command Line Tools. # # scripts/build-wx-macos.sh -> ~/.cache/wx-3.3.3-macos # # Dependency tracking is off: its bootstrap fails with several -arch flags. # MACOSX_MIN (default 11.0) is the oldest macOS the app runs on, for both # slices: the libc++ in current SDKs supports nothing older, and macOS 11 is # also where Apple Silicon starts. Image/zlib/regex/expat libraries are # wx's bundled copies, so the app links only against system frameworks. # The repo's vendor tree stays pristine; the build lives in ~/.cache/wxbuild. set -e REPO=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) SRC="$REPO/thirdparty/wxwidgets/wxWidgets-3.3.3" BUILD="$HOME/.cache/wxbuild/wxWidgets-3.3.3-macos" PREFIX="${WX_MACOS_PREFIX:-$HOME/.cache/wx-3.3.3-macos}" MACOSX_MIN="${MACOSX_MIN:-11.0}" JOBS="${JOBS:-$(sysctl -n hw.ncpu)}" [ -d "$SRC" ] || { echo "thirdparty wxWidgets tree missing: $SRC" >&2; exit 1; } rm -rf "$BUILD" mkdir -p "$HOME/.cache/wxbuild" cp -R "$SRC" "$BUILD" trap 'rm -rf "$BUILD"' 0 chmod +x "$BUILD/configure" "$BUILD/config.guess" "$BUILD/config.sub" "$BUILD/install-sh" 2>/dev/null || true mkdir -p "$BUILD/build-macos" cd "$BUILD/build-macos" sh ../configure --prefix="$PREFIX" --with-osx_cocoa \ --disable-shared --enable-monolithic \ --enable-universal_binary=arm64,x86_64 \ --with-macosx-version-min="$MACOSX_MIN" \ --disable-dependency-tracking \ --with-libpng=builtin --with-libjpeg=builtin --without-libtiff \ --with-zlib=builtin --with-expat=builtin --with-regex=builtin \ --without-liblzma --without-libcurl \ --with-opengl=no --disable-stc --disable-webview --disable-mediactrl \ --disable-tests make -j"$JOBS" make install lib=$(ls "$PREFIX"/lib/libwx_osx_cocoau-3.3*.a | head -1) lipo -info "$lib" echo "installed: $PREFIX ($lib)"