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
# wxWidgets source tree like so:
@ -6,87 +6,66 @@
# sudo <path to this script>/build_wxwidgets
#
# Currently, Audacity is built using the 10.9 SDK, but you may choose to target
# 10.8 or greater by changing this variable.
min=10.9
# The minimum OS X version supported by Audacity is 10.7.
minver=10.7
# You shouldn't need to change this, but just in case you put Xcode in a non-standard
# location, update this appropriately.
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}"
# If you want to use a specific SDK, specify the full path here
sdkdir=""
# Build a specific configuration
function bld
{
rm -rf "${1}"
mkdir -p "${1}"
pushd "${1}"
flavour="${1}"
shift
arch_option="--enable-macosx-arch=${1}"
prefix_option="--prefix=/usr/local/${1}"
shift
# Create and change to our build directory
rm -rf "bld_${flavour}_${arch}"
mkdir -p "bld_${flavour}_${arch}"
pushd "bld_${flavour}_${arch}"
../configure ${prefix_option} \
${arch_option} \
--with-expat=builtin \
--with-zlib=builtin \
--with-regex=builtin \
--enable-universal_binary=no \
--enable-unicode=yes \
--enable-webkit=no \
--with-macosx-version-min=${min} \
${@}
export LDFLAGS="${LDFLAGS1}"
xcrun make -j 4
export LDFLAGS=""
# Force Audacity specific options
export CXX="g++ -std=c++1z -stdlib=libc++"
export LD="g++ -std=c++1z -stdlib=libc++"
# Ensure configure uses the proper SDK while performing its tests
run="xcrun ${sdkdir:+-sdk ${asdf}}"
# NOTES: liblzma isn't available on MacOS 10.8 or older and Audacity doesn't
# need it. So, build wxWidgets without the support to allow Audacity
# to run on MacOS 10.7 or newer.
${run} ../configure --prefix="/usr/local/${arch}" \
--enable-macosx-arch="${arch}" \
--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
}
# Install a specific configuration
function inst
{
pushd "${1}"
xcrun make install
popd
}
# If building on 10.15 (Catalina) or newer, 32-bit versions can't be
# created without forcing "configure" to cross compile.
arches="x86_64"
osver=$(sw_vers -productVersion)
if [ "${osver}" \< "10.15" ]
then
arches="${arches} i386"
fi
for architecture in 'i386' 'x86_64'; do {
std=''
stdlib='-stdlib=libstdc++'
if [ ${max} -gt 1060 ]
then
std='-std=c++1z'
stdlib='-stdlib=libc++'
fi
for arch in ${arches}
do
bld "debug" --enable-debug=yes
bld "release" --enable-debug=no
done
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