Simplify the wxWidgets build script

Since we're not using a specific SDK any longer, I cleaned
up the script but still left the ability to specify an SDK
if we need to in the future.
This commit is contained in:
Leland Lucius 2020-01-04 03:14:26 -06:00
parent 9e0c1b0bd4
commit 3f22cbe549
1 changed files with 51 additions and 72 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# You can use this to build wxWidgets. Just run it from within the root of the # You can use this to build wxWidgets. Just run it from within the root of the
# wxWidgets source tree like so: # wxWidgets source tree like so:
@ -6,87 +6,66 @@
# sudo <path to this script>/build_wxwidgets # sudo <path to this script>/build_wxwidgets
# #
# Currently, Audacity is built using the 10.9 SDK, but you may choose to target # The minimum OS X version supported by Audacity is 10.7.
# 10.8 or greater by changing this variable. minver=10.7
min=10.9
# You shouldn't need to change this, but just in case you put Xcode in a non-standard # If you want to use a specific SDK, specify the full path here
# location, update this appropriately. sdkdir=""
sdk="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${min}.sdk/"
if [ ! -d "${sdk}" ]
then
echo "You must install the ${min} SDK at this location:"
echo "${sdk}"
exit 1
fi
max=${min/./}0
ver="-DMAC_OS_X_VERSION_MAX_ALLOWED=${max} -mmacosx-version-min=${min}"
# Build a specific configuration # Build a specific configuration
function bld function bld
{ {
rm -rf "${1}" flavour="${1}"
mkdir -p "${1}"
pushd "${1}"
shift shift
arch_option="--enable-macosx-arch=${1}" # Create and change to our build directory
prefix_option="--prefix=/usr/local/${1}" rm -rf "bld_${flavour}_${arch}"
shift mkdir -p "bld_${flavour}_${arch}"
pushd "bld_${flavour}_${arch}"
../configure ${prefix_option} \ # Force Audacity specific options
${arch_option} \ export CXX="g++ -std=c++1z -stdlib=libc++"
--with-expat=builtin \ export LD="g++ -std=c++1z -stdlib=libc++"
--with-zlib=builtin \
--with-regex=builtin \ # Ensure configure uses the proper SDK while performing its tests
--enable-universal_binary=no \ run="xcrun ${sdkdir:+-sdk ${asdf}}"
--enable-unicode=yes \
--enable-webkit=no \ # NOTES: liblzma isn't available on MacOS 10.8 or older and Audacity doesn't
--with-macosx-version-min=${min} \ # need it. So, build wxWidgets without the support to allow Audacity
${@} # to run on MacOS 10.7 or newer.
export LDFLAGS="${LDFLAGS1}" ${run} ../configure --prefix="/usr/local/${arch}" \
xcrun make -j 4 --enable-macosx-arch="${arch}" \
export LDFLAGS="" --enable-shared=yes \
--enable-unicode=yes \
--enable-universal_binary=no \
--enable-webkit=no \
--with-expat=builtin \
--with-flavour="${flavour}" \
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-libtiff=builtin \
--with-macosx-sdk="${sdkdir}" \
--with-macosx-version-min="${minver}" \
--with-regex=builtin \
--with-zlib=builtin \
--without-liblzma \
${@}
${run} make -j $(sysctl -n hw.ncpu) install
popd popd
} }
# Install a specific configuration # If building on 10.15 (Catalina) or newer, 32-bit versions can't be
function inst # created without forcing "configure" to cross compile.
{ arches="x86_64"
pushd "${1}" osver=$(sw_vers -productVersion)
xcrun make install if [ "${osver}" \< "10.15" ]
popd then
} arches="${arches} i386"
fi
for architecture in 'i386' 'x86_64'; do { for arch in ${arches}
std='' do
stdlib='-stdlib=libstdc++' bld "debug" --enable-debug=yes
if [ ${max} -gt 1060 ] bld "release" --enable-debug=no
then done
std='-std=c++1z'
stdlib='-stdlib=libc++'
fi
arch="-arch ${architecture}"
export CPPFLAGS="${ver}"
export CFLAGS1="${arch} ${ver} -isysroot $sdk"
export CXXFLAGS1="${arch} ${ver} -isysroot $sdk ${std} ${stdlib}"
export LDFLAGS1="${arch} ${ver} -syslibroot,$sdk ${std} ${stdlib}"
# Make sure our flags are included
export CC="gcc $CFLAGS1"
export CXX="g++ $CXXFLAGS1"
export LD="g++ $LDFLAGS1"
# Build all configurations
debug_dir="bld_debug_${architecture}"
release_dir="bld_release_${architecture}"
bld ${debug_dir} ${architecture} --enable-debug=yes --enable-shared=yes --with-flavour=debug
bld ${release_dir} ${architecture} --enable-debug=no --enable-shared=yes --with-flavour=release
# Install all configurations
inst ${debug_dir}
inst ${release_dir}
}; done # loop over architectures