New Linux/BSD build flow.
Getting and building libraries is now clearly separated from preparing workspaces. Some disk space is automatically reclaimed and cleanup is streamlined.
This commit is contained in:
parent
17ae3b224d
commit
5c1195f66a
@ -1,83 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Some of our makefiles depend on GNU make, so we set some sane defaults if MAKE
|
# This script remains for backwards compatibility, but consists of a single
|
||||||
# is not set.
|
# git command.
|
||||||
case "`uname -s`" in
|
|
||||||
"FreeBSD" | "OpenBSD" )
|
|
||||||
MAKE=${MAKE:="gmake"}
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
MAKE=${MAKE:="make"}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Check the preserve-libs CL option
|
cd "$(dirname $0)/../../"
|
||||||
preserve_libs=false
|
git clean -fx build source
|
||||||
|
|
||||||
for i in "$@"; do
|
echo "WARNING: This script has been split with libraries/clean-source-libs.sh"
|
||||||
case "$i" in
|
echo "If you want to fix a problem with bundled libs, it's the other script"
|
||||||
--preserve-libs ) preserve_libs=true ;;
|
echo "you want to invoke."
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# (We don't attempt to clean up every last file here - output in
|
echo "WARNING: This script is deprecated and might be removed in a future"
|
||||||
# binaries/system/ will still be there, etc. This is mostly just
|
echo "release. You can run 'git clean -f build source' from the repository"
|
||||||
# to quickly fix problems in the bundled dependencies.)
|
echo "root to clean up build workspaces."
|
||||||
|
|
||||||
cd "$(dirname $0)"
|
|
||||||
# Now in build/workspaces/ (where we assume this script resides)
|
|
||||||
|
|
||||||
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)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./include-unix-release)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-91.13.1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Still delete the directory of previous SpiderMonkey versions to
|
|
||||||
# avoid wasting disk space if people clean workspaces after updating.
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-78.6.0)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-68.12.1)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-62.9.1)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-52.9.1pre1)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-45.0.2)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-38.0.0)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs31)
|
|
||||||
(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs24)
|
|
||||||
|
|
||||||
# Delete former premake5 gmake.* directories
|
|
||||||
(cd ../premake/premake5/build && rm -rf ./gmake.bsd)
|
|
||||||
(cd ../premake/premake5/build && rm -rf ./gmake.macosx)
|
|
||||||
(cd ../premake/premake5/build && rm -rf ./gmake.unix)
|
|
||||||
|
|
||||||
# Cleanup current premake directories
|
|
||||||
(cd ../premake/premake5/build/gmake2.bsd && ${MAKE} clean)
|
|
||||||
(cd ../premake/premake5/build/gmake2.macosx && ${MAKE} clean)
|
|
||||||
(cd ../premake/premake5/build/gmake2.unix && ${MAKE} clean)
|
|
||||||
(cd ../premake/ && rm -f .already-built)
|
|
||||||
|
|
||||||
echo "Removing generated stub and test files..."
|
|
||||||
|
|
||||||
find ../../source -name "stub_*.cpp" -type f -exec rm {} \;
|
|
||||||
find ../../source -name "test_*.cpp" -type f -not -name "test_setup.cpp" -exec rm {} \;
|
|
||||||
|
|
||||||
echo "Cleaning build output..."
|
|
||||||
|
|
||||||
# Remove workspaces/gcc if present
|
|
||||||
rm -rf ./gcc
|
|
||||||
# Remove workspaces/codeblocks if present
|
|
||||||
rm -rf ./codeblocks
|
|
||||||
# Remove workspaces/xcode3 if present
|
|
||||||
rm -rf ./xcode3
|
|
||||||
# Remove workspaces/xcode4 if present
|
|
||||||
rm -rf ./xcode4
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Done. Try running update-workspaces.sh again now."
|
|
||||||
|
@ -11,46 +11,21 @@ die()
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for whitespace in absolute path; this will cause problems in the
|
cd "$(dirname $0)"
|
||||||
# SpiderMonkey build (https://bugzilla.mozilla.org/show_bug.cgi?id=459089)
|
# Now in build/workspaces/ (where we assume this script resides)
|
||||||
# and maybe elsewhere, so we just forbid it
|
|
||||||
# Use perl as an alternative to readlink -f, which isn't available on BSD or OS X
|
|
||||||
SCRIPTPATH=`perl -MCwd -e 'print Cwd::abs_path shift' "$0"`
|
|
||||||
case "$SCRIPTPATH" in
|
|
||||||
*\ * )
|
|
||||||
die "Absolute path contains whitespace, which will break the build - move the game to a path without spaces" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
JOBS=${JOBS:="-j2"}
|
|
||||||
|
|
||||||
# Some of our makefiles depend on GNU make, so we set some sane defaults if MAKE
|
|
||||||
# is not set.
|
|
||||||
case "`uname -s`" in
|
|
||||||
"FreeBSD" | "OpenBSD" )
|
|
||||||
MAKE=${MAKE:="gmake"}
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
MAKE=${MAKE:="make"}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Parse command-line options:
|
# Parse command-line options:
|
||||||
|
|
||||||
premake_args=""
|
premake_args=""
|
||||||
|
|
||||||
with_system_premake5=false
|
with_system_premake5=false
|
||||||
without_nvtt=false
|
|
||||||
with_system_nvtt=false
|
|
||||||
with_system_mozjs=false
|
|
||||||
enable_atlas=true
|
enable_atlas=true
|
||||||
|
|
||||||
|
JOBS=${JOBS:="-j2"}
|
||||||
|
|
||||||
for i in "$@"
|
for i in "$@"
|
||||||
do
|
do
|
||||||
case $i in
|
case $i in
|
||||||
--with-system-premake5 ) with_system_premake5=true ;;
|
--with-system-premake5 ) with_system_premake5=true ;;
|
||||||
--without-nvtt ) without_nvtt=true; premake_args="${premake_args} --without-nvtt" ;;
|
|
||||||
--with-system-nvtt ) with_system_nvtt=true; premake_args="${premake_args} --with-system-nvtt" ;;
|
|
||||||
--with-system-mozjs ) with_system_mozjs=true; premake_args="${premake_args} --with-system-mozjs" ;;
|
|
||||||
--enable-atlas ) enable_atlas=true ;;
|
--enable-atlas ) enable_atlas=true ;;
|
||||||
--disable-atlas ) enable_atlas=false ;;
|
--disable-atlas ) enable_atlas=false ;;
|
||||||
-j* ) JOBS=$i ;;
|
-j* ) JOBS=$i ;;
|
||||||
@ -75,33 +50,11 @@ if [ "$enable_atlas" = "true" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$(dirname $0)"
|
|
||||||
# Now in build/workspaces/ (where we assume this script resides)
|
|
||||||
|
|
||||||
if [ "`uname -s`" = "Darwin" ]; then
|
if [ "`uname -s`" = "Darwin" ]; then
|
||||||
# Set minimal SDK version
|
# Set minimal SDK version
|
||||||
export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"}
|
export MIN_OSX_VERSION=${MIN_OSX_VERSION:="10.12"}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't want to build bundled libs on OS X
|
|
||||||
# (build-osx-libs.sh is used instead)
|
|
||||||
if [ "`uname -s`" != "Darwin" ]; then
|
|
||||||
echo "Updating bundled third-party dependencies..."
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Build/update bundled external libraries
|
|
||||||
(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"
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
|
|
||||||
(cd ../../libraries/source/nvtt && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "NVTT build failed"
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Now build Premake or use system's.
|
# Now build Premake or use system's.
|
||||||
|
|
||||||
cd ../premake
|
cd ../premake
|
||||||
|
@ -2,8 +2,10 @@ 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.
|
osx/ contains a script for download and building required libraries on OS X.
|
||||||
source/ contains bundled source, when the game requires a specific library
|
|
||||||
version that may not be available in package managers.
|
build-source-libs.sh downloads and builds a checkout of source libraries
|
||||||
|
that we bundle, when the game requires a specific library version
|
||||||
|
that may not be available in package managers.
|
||||||
|
|
||||||
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.
|
||||||
|
116
libraries/build-source-libs.sh
Executable file
116
libraries/build-source-libs.sh
Executable file
@ -0,0 +1,116 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die()
|
||||||
|
{
|
||||||
|
echo ERROR: $*
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# SVN revision to checkout for source-libs
|
||||||
|
# Update this line when you commit an update to source-libs
|
||||||
|
source_svnrev="28083"
|
||||||
|
|
||||||
|
if [ "`uname -s`" = "Darwin" ]; then
|
||||||
|
echo 'This script should not be used on macOS: use build-osx-libs.sh instead.'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$(dirname $0)"
|
||||||
|
# Now in libraries/ (where we assume this script resides)
|
||||||
|
|
||||||
|
# Check for whitespace in absolute path; this will cause problems in the
|
||||||
|
# SpiderMonkey build and maybe elsewhere, so we just forbid it
|
||||||
|
# Use perl as an alternative to readlink -f, which isn't available on BSD
|
||||||
|
SCRIPTPATH=`perl -MCwd -e 'print Cwd::abs_path shift' "$0"`
|
||||||
|
case "$SCRIPTPATH" in
|
||||||
|
*\ * )
|
||||||
|
die "Absolute path contains whitespace, which will break the build - move the game to a path without spaces" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# Parse command-line options (download options and build options):
|
||||||
|
source_libs_dir="source"
|
||||||
|
|
||||||
|
without_nvtt=false
|
||||||
|
with_system_nvtt=false
|
||||||
|
with_system_mozjs=false
|
||||||
|
|
||||||
|
JOBS=${JOBS:="-j2"}
|
||||||
|
|
||||||
|
for i in "$@"
|
||||||
|
do
|
||||||
|
case $i in
|
||||||
|
--source-libs-dir=* ) source_libs_dir=${1#*=} ;;
|
||||||
|
--source-libs-dir ) die "correct syntax is --source-libs-dir=/path/to/dir" ;;
|
||||||
|
--without-nvtt ) without_nvtt=true ;;
|
||||||
|
--with-system-nvtt ) with_system_nvtt=true ;;
|
||||||
|
--with-system-mozjs ) with_system_mozjs=true ;;
|
||||||
|
-j* ) JOBS=$i ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Download source libs
|
||||||
|
echo "Downloading source libs..."
|
||||||
|
echo
|
||||||
|
if [ -e ${source_libs_dir}/.svn ]; then
|
||||||
|
(cd ${source_libs_dir} && svn cleanup && svn up -r $source_svnrev)
|
||||||
|
else
|
||||||
|
svn co -r $source_svnrev https://svn.wildfiregames.com/public/source-libs/trunk ${source_libs_dir}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build/update bundled external libraries
|
||||||
|
echo "Building third-party dependencies..."
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Some of our makefiles depend on GNU make, so we set some sane defaults if MAKE
|
||||||
|
# is not set.
|
||||||
|
case "`uname -s`" in
|
||||||
|
"FreeBSD" | "OpenBSD" )
|
||||||
|
MAKE=${MAKE:="gmake"}
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
MAKE=${MAKE:="make"}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
(cd ${source_libs_dir}/fcollada && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "FCollada build failed"
|
||||||
|
echo
|
||||||
|
if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
|
||||||
|
(cd ${source_libs_dir}/nvtt && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "NVTT build failed"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
if [ "$with_system_mozjs" = "false" ]; then
|
||||||
|
(cd ${source_libs_dir}/spidermonkey && MAKE=${MAKE} JOBS=${JOBS} ./build.sh) || die "SpiderMonkey build failed"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "Copying built files..."
|
||||||
|
# Copy built binaries to binaries/system/
|
||||||
|
cp ${source_libs_dir}/fcollada/bin/* ../binaries/system/
|
||||||
|
if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
|
||||||
|
cp ${source_libs_dir}/nvtt/bin/* ../binaries/system/
|
||||||
|
fi
|
||||||
|
if [ "$with_system_mozjs" = "false" ]; then
|
||||||
|
cp ${source_libs_dir}/spidermonkey/bin/* ../binaries/system/
|
||||||
|
fi
|
||||||
|
# If a custom source-libs dir was used, includes and static libs should be copied to libraries/source/
|
||||||
|
# and all other bundled content should be copied.
|
||||||
|
if [ "$source_libs_dir" != "source" ]; then
|
||||||
|
rsync -avzq \
|
||||||
|
--exclude fcollada \
|
||||||
|
--exclude nvtt \
|
||||||
|
--exclude spidermonkey \
|
||||||
|
${source_libs_dir}/ source
|
||||||
|
|
||||||
|
mkdir -p source/fcollada
|
||||||
|
cp -r ${source_libs_dir}/fcollada/{include,lib} source/fcollada/
|
||||||
|
if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
|
||||||
|
mkdir -p source/nvtt
|
||||||
|
cp -r ${source_libs_dir}/nvtt/{include,lib} source/nvtt/
|
||||||
|
fi
|
||||||
|
if [ "$with_system_mozjs" = "false" ]; then
|
||||||
|
mkdir -p source/spidermonkey
|
||||||
|
cp -r ${source_libs_dir}/spidermonkey/{include-unix-debug,include-unix-release,lib} source/spidermonkey/
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "Done."
|
21
libraries/clean-source-libs.sh
Executable file
21
libraries/clean-source-libs.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This short script allows one to reset source libraries to a clean state without
|
||||||
|
# having to redownload everything.
|
||||||
|
# (We don't attempt to clean up every last file here - output in binaries/system/
|
||||||
|
# will still be there, etc. This is mostly just to quickly fix problems in the
|
||||||
|
# bundled dependencies.)
|
||||||
|
|
||||||
|
cd "$(dirname $0)"
|
||||||
|
# Now in libraries/ (where we assume this script resides)
|
||||||
|
|
||||||
|
echo "Cleaning bundled third-party dependencies..."
|
||||||
|
|
||||||
|
if [ -e source/.svn ]; then
|
||||||
|
(cd source && svn revert -R . && svn st --no-ignore | cut -c 9- | xargs rm -rf)
|
||||||
|
else
|
||||||
|
rm -rf source
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Done. Try running build-source-libs.sh again now."
|
Loading…
Reference in New Issue
Block a user