1
0
forked from 0ad/0ad

Do not attempt to rebuild bundled libs every time, and do not run CMAKE for nvtt everytime. Also pass -fpic for NVTT to prevent build failures on FreeBSD (reported by @nephele).

Unify the build scripts between macOS and Linux.

Reviewed by: @Freagarach, @wraitii
Differential Revision: https://code.wildfiregames.com/D3173
This was SVN commit r24310.
This commit is contained in:
Stan 2020-12-01 19:29:21 +00:00
parent 6f841d0ccb
commit d38fde3682
3 changed files with 13 additions and 62 deletions

View File

@ -31,7 +31,9 @@ if [ "$preserve_libs" != "true" ]; then
echo "Cleaning bundled third-party dependencies..."
(cd ../../libraries/source/fcollada/src && rm -rf ./output)
(cd ../../libraries/source/fcollada && rm -f .already-built)
(cd ../../libraries/source/nvtt/src && rm -rf ./build)
(cd ../../libraries/source/nvtt && rm -f .already-built)
(cd ../../libraries/source/spidermonkey && rm -f .already-built)
(cd ../../libraries/source/spidermonkey && rm -rf ./lib/*.a && rm -rf ./lib/*.so)
(cd ../../libraries/source/spidermonkey && rm -rf ./include-unix-debug)

2
build/workspaces/update-workspaces.sh Normal file → Executable file
View File

@ -85,7 +85,7 @@ if [ "`uname -s`" != "Darwin" ]; then
echo
# Build/update bundled external libraries
(cd ../../libraries/source/fcollada/src && ${MAKE} ${JOBS}) || die "FCollada build failed"
(cd ../../libraries/source/fcollada && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "FCollada build failed"
echo
if [ "$with_system_mozjs" = "false" ]; then
(cd ../../libraries/source/spidermonkey && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "SpiderMonkey build failed"

View File

@ -52,11 +52,7 @@ FMT_VERSION="7.1.3"
# * SpiderMonkey
# * NVTT
# * FCollada
# --------------------------------------------------------------
# We use suffixes here in order to force rebuilding when patching these libs
NVTT_VERSION="nvtt-2.1.1+wildfiregames.2"
FCOLLADA_VERSION="fcollada-3.05+wildfiregames.2"
# --------------------------------------------------------------
# Provided by OS X:
# * OpenAL
# * OpenGL
@ -956,73 +952,26 @@ popd > /dev/null
# --------------------------------------------------------------
# NVTT - bundled, no download
echo -e "Building NVTT..."
LIB_VERSION="${NVTT_VERSION}"
pushd ../source/nvtt > /dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
if [[ "$force_rebuild" = "true" ]]
then
rm -f .already-built
rm -f lib/*.a
pushd src
rm -rf build
mkdir -p build
pushd build
# Could use CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT
# but they're not as flexible for cross-compiling
# Disable png support (avoids some conflicts with MacPorts)
(cmake .. \
-DCMAKE_LINK_FLAGS="$LDFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DBINDIR=bin \
-DLIBDIR=lib \
-DPNG=0 \
-G "Unix Makefiles" \
&& make clean && make nvtt ${JOBS}) || die "NVTT build failed"
popd
mkdir -p ../lib
cp build/src/bc*/libbc*.a ../lib/
cp build/src/nv*/libnv*.a ../lib/
cp build/src/nvtt/squish/libsquish.a ../lib/
popd
echo "$LIB_VERSION" > .already-built
else
already_built
fi
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building NVTT"
popd > /dev/null
# --------------------------------------------------------------
# FCollada - bundled, no download
echo -e "Building FCollada..."
pushd ../source/fcollada/ > /dev/null
LIB_VERSION="${FCOLLADA_VERSION}"
pushd ../source/fcollada > /dev/null
if [[ "$force_rebuild" = "true" ]] || [[ ! -e .already-built ]] || [[ "$(<.already-built)" != "$LIB_VERSION" ]]
if [[ "$force_rebuild" = "true" ]]
then
rm -f .already-built
rm -f lib/*.a
pushd src
rm -rf output
mkdir -p ../lib
# The Makefile refers to pkg-config for libxml2, but we
# don't have that (replace with xml2-config instead)
sed -i.bak -e 's/pkg-config libxml-2.0/xml2-config/' Makefile
(make clean && CXXFLAGS=$CXXFLAGS make ${JOBS}) || die "FCollada build failed"
# Undo Makefile change
mv Makefile.bak Makefile
popd
echo "$LIB_VERSION" > .already-built
else
already_built
fi
CXXFLAGS="$CXXFLAGS" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" JOBS="$JOBS" ./build.sh || die "Error building FCollada"
popd > /dev/null