From d38fde3682cf32ffdb3ef4e20356bc9a4187b06b Mon Sep 17 00:00:00 2001 From: Stan Date: Tue, 1 Dec 2020 19:29:21 +0000 Subject: [PATCH] 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. --- build/workspaces/clean-workspaces.sh | 2 + build/workspaces/update-workspaces.sh | 2 +- libraries/osx/build-osx-libs.sh | 71 ++++----------------------- 3 files changed, 13 insertions(+), 62 deletions(-) mode change 100644 => 100755 build/workspaces/update-workspaces.sh diff --git a/build/workspaces/clean-workspaces.sh b/build/workspaces/clean-workspaces.sh index 9795dcb616..2edfae36a1 100755 --- a/build/workspaces/clean-workspaces.sh +++ b/build/workspaces/clean-workspaces.sh @@ -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) diff --git a/build/workspaces/update-workspaces.sh b/build/workspaces/update-workspaces.sh old mode 100644 new mode 100755 index be8ca773cc..c31e16bc77 --- a/build/workspaces/update-workspaces.sh +++ b/build/workspaces/update-workspaces.sh @@ -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" diff --git a/libraries/osx/build-osx-libs.sh b/libraries/osx/build-osx-libs.sh index 231a1f4ae2..bfc4997b77 100755 --- a/libraries/osx/build-osx-libs.sh +++ b/libraries/osx/build-osx-libs.sh @@ -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