Adapt macOS libraries to the new build flow.

This commit is contained in:
Nicolas Auvray 2024-08-20 19:10:25 +02:00
parent 5c1195f66a
commit 0aeaa8f70a
9 changed files with 33 additions and 18 deletions

4
.gitignore vendored
View File

@ -14,9 +14,7 @@ build/workspaces/vc2015
build/workspaces/vs2017 build/workspaces/vs2017
# Libraries # Libraries
libraries/osx/* libraries/macos
!libraries/osx/patches
!libraries/osx/build-osx-libs.sh
libraries/source libraries/source
libraries/win32 libraries/win32

View File

@ -7,7 +7,7 @@
-- directory in which OS-specific library subdirectories reside. -- directory in which OS-specific library subdirectories reside.
if os.istarget("macosx") then if os.istarget("macosx") then
libraries_dir = rootdir.."/libraries/osx/" libraries_dir = rootdir.."/libraries/macos/"
elseif os.istarget("windows") then elseif os.istarget("windows") then
libraries_dir = rootdir.."/libraries/win32/" libraries_dir = rootdir.."/libraries/win32/"
else else

View File

@ -38,7 +38,7 @@ if [ "$enable_atlas" = "true" ]; then
premake_args="${premake_args} --atlas" premake_args="${premake_args} --atlas"
if [ "$(uname -s)" = "Darwin" ]; then if [ "$(uname -s)" = "Darwin" ]; then
# Provide path to wx-config on OS X (as wxwidgets doesn't support pkgconfig) # Provide path to wx-config on OS X (as wxwidgets doesn't support pkgconfig)
export WX_CONFIG="${WX_CONFIG:="$(pwd)/../../libraries/osx/wxwidgets/bin/wx-config"}" export WX_CONFIG="${WX_CONFIG:="$(pwd)/../../libraries/macos/wxwidgets/bin/wx-config"}"
else else
export WX_CONFIG="${WX_CONFIG:="wx-config"}" export WX_CONFIG="${WX_CONFIG:="wx-config"}"
fi fi

View File

@ -1,7 +1,7 @@
This directory holds libraries that are used by the game. This directory holds libraries that are used by the game.
Libraries are downloaded by running the correct script for your platform. Libraries are downloaded by running the correct script for your platform.
osx/ contains a script for download and building required libraries on OS X. build-macos-libs.sh downloads and builds required libraries on macOS.
build-source-libs.sh downloads and builds a checkout of source libraries build-source-libs.sh downloads and builds a checkout of source libraries
that we bundle, when the game requires a specific library version that we bundle, when the game requires a specific library version
@ -10,10 +10,10 @@ build-source-libs.sh downloads and builds a checkout of source libraries
get-windows-libs.bat downloads a checkout of headers and precompiled get-windows-libs.bat downloads a checkout of headers and precompiled
libraries that we bundle for Windows builds. libraries that we bundle for Windows builds.
osx/build-osx-libs.sh build-macos-libs.sh
MIT MIT
osx/patches macos-patches
see license of applicable library see license of applicable library
source/cxxtest-4.4 source/cxxtest-4.4

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Script for acquiring and building OS X dependencies for 0 A.D. # Script for acquiring and building macOS dependencies for 0 A.D.
# #
# The script checks whether a source tarball exists for each # The script checks whether a source tarball exists for each
# dependency, if not it will download the correct version from # dependency, if not it will download the correct version from
@ -54,7 +54,9 @@ MOLTENVK_VERSION="1.2.2"
# * SpiderMonkey # * SpiderMonkey
# * NVTT # * NVTT
# * FCollada # * FCollada
# --------------------------------------------------------------
source_svnrev="28083"
# --------------------------------------------------------------
# Provided by OS X: # Provided by OS X:
# * OpenAL # * OpenAL
# * OpenGL # * OpenGL
@ -143,9 +145,9 @@ already_built()
echo -e "Skipping - already built (use --force-rebuild to override)" echo -e "Skipping - already built (use --force-rebuild to override)"
} }
# Check that we're actually on OS X # Check that we're actually on macOS
if [ "`uname -s`" != "Darwin" ]; then if [ "`uname -s`" != "Darwin" ]; then
die "This script is intended for OS X only" die "This script is intended for macOS only"
fi fi
# Parse command-line options: # Parse command-line options:
@ -159,8 +161,10 @@ do
esac esac
done done
cd "$(dirname $0)" cd "$(dirname $0)" # Now in libraries/ (where we assume this script resides)
# Now in libraries/osx/ (where we assume this script resides) mkdir -p macos
cd macos
# Create a location to create copies of dependencies' *.pc files, so they can be found by pkg-config # Create a location to create copies of dependencies' *.pc files, so they can be found by pkg-config
PC_PATH="$(pwd)/pkgconfig/" PC_PATH="$(pwd)/pkgconfig/"
@ -192,7 +196,7 @@ then
pushd $LIB_DIRECTORY pushd $LIB_DIRECTORY
# patch zlib's configure script to use our CFLAGS and LDFLAGS # patch zlib's configure script to use our CFLAGS and LDFLAGS
(patch -Np0 -i ../../patches/zlib_flags.diff \ (patch -Np0 -i ../../../macos-patches/zlib_flags.diff \
&& CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \ && CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
./configure --prefix="$ZLIB_DIR" \ ./configure --prefix="$ZLIB_DIR" \
--static \ --static \
@ -758,7 +762,7 @@ then
# Patch GNUTLS for a linking issue with isdigit # Patch GNUTLS for a linking issue with isdigit
# Patch by Ross Nicholson: https://gitlab.com/gnutls/gnutls/-/issues/1033#note_379529145 # Patch by Ross Nicholson: https://gitlab.com/gnutls/gnutls/-/issues/1033#note_379529145
(patch -Np1 -i ../../patches/03-undo-libtasn1-cisdigit.patch \ (patch -Np1 -i ../../../macos-patches/03-undo-libtasn1-cisdigit.patch \
&& ./configure CFLAGS="$CFLAGS" \ && ./configure CFLAGS="$CFLAGS" \
CXXFLAGS="$CXXFLAGS" \ CXXFLAGS="$CXXFLAGS" \
LDFLAGS="$LDFLAGS" \ LDFLAGS="$LDFLAGS" \
@ -1020,7 +1024,7 @@ then
pushd $LIB_DIRECTORY pushd $LIB_DIRECTORY
# It appears that older versions of Clang require constexpr statements to have a user-set constructor. # It appears that older versions of Clang require constexpr statements to have a user-set constructor.
patch -Np1 -i ../../patches/fmt_constexpr.diff patch -Np1 -i ../../../macos-patches/fmt_constexpr.diff
mkdir -p build mkdir -p build
pushd build pushd build
@ -1071,7 +1075,17 @@ popd > /dev/null
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# The following libraries are shared on different OSes and may # The following libraries are shared on different OSes and may
# be customized, so we build and install them from bundled sources # be customized, so we build and install them from bundled sources
# (served over SVN)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
if [ -e ../source/.svn ]; then
pushd ../source > /dev/null
svn cleanup && svn up -r $source_svnrev
popd > /dev/null
else
svn co -r $source_svnrev https://svn.wildfiregames.com/public/source-libs/trunk ../source
fi
# SpiderMonkey - bundled, no download # SpiderMonkey - bundled, no download
pushd ../source/spidermonkey/ > /dev/null pushd ../source/spidermonkey/ > /dev/null
@ -1082,6 +1096,7 @@ fi
# Use the regular build script for SM. # Use the regular build script for SM.
JOBS="$JOBS" ZLIB_DIR="$ZLIB_DIR" ARCH="$ARCH" ./build.sh || die "Error building spidermonkey" JOBS="$JOBS" ZLIB_DIR="$ZLIB_DIR" ARCH="$ARCH" ./build.sh || die "Error building spidermonkey"
cp bin/* ../../../binaries/system/
popd > /dev/null popd > /dev/null
@ -1095,6 +1110,7 @@ then
fi fi
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CMAKE_FLAGS=$CMAKE_FLAGS JOBS="$JOBS" ./build.sh || die "Error building NVTT" CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" CMAKE_FLAGS=$CMAKE_FLAGS JOBS="$JOBS" ./build.sh || die "Error building NVTT"
cp bin/* ../../../binaries/system/
popd > /dev/null popd > /dev/null
@ -1108,5 +1124,6 @@ then
fi fi
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building FCollada" CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building FCollada"
cp bin/* ../../../binaries/system/
popd > /dev/null popd > /dev/null

View File

@ -11,7 +11,7 @@ die()
source_svnrev="28083" source_svnrev="28083"
if [ "`uname -s`" = "Darwin" ]; then if [ "`uname -s`" = "Darwin" ]; then
echo 'This script should not be used on macOS: use build-osx-libs.sh instead.' echo 'This script should not be used on macOS: use build-macos-libs.sh instead.'
exit 1 exit 1
fi fi