3 if [ "$(id -u)" = "0" ]; then
4 echo "Running as root will mess up file permissions. Aborting ..." 1>&2
14 # Check for whitespace in absolute path; this will cause problems in the
15 # SpiderMonkey build (https://bugzilla.mozilla.org/show_bug.cgi?id=459089)
16 # and maybe elsewhere, so we just forbid it
17 # Use perl as an alternative to readlink -f, which isn't available on BSD or OS X
18 SCRIPTPATH
=`perl -MCwd -e 'print Cwd::abs_path shift' "$0"`
21 die
"Absolute path contains whitespace, which will break the build - move the game to a path without spaces" ;;
26 # Some of our makefiles depend on GNU make, so we set some sane defaults if MAKE
29 "FreeBSD" |
"OpenBSD" )
37 # Parse command-line options:
42 with_system_nvtt
=false
43 with_system_mozjs38
=false
49 --without-nvtt ) without_nvtt
=true
; premake_args
="${premake_args} --without-nvtt" ;;
50 --with-system-nvtt ) with_system_nvtt
=true
; premake_args
="${premake_args} --with-system-nvtt" ;;
51 --with-system-mozjs38 ) with_system_mozjs38
=true
; premake_args
="${premake_args} --with-system-mozjs38" ;;
52 --enable-atlas ) enable_atlas
=true
;;
53 --disable-atlas ) enable_atlas
=false
;;
55 # Assume any other --options are for Premake
56 --* ) premake_args
="${premake_args} $i" ;;
60 premake_args
="${premake_args} --collada"
61 if [ "$enable_atlas" = "true" ]; then
62 premake_args
="${premake_args} --atlas"
66 # Now in build/workspaces/ (where we assume this script resides)
68 if [ "`uname -s`" = "Darwin" ]; then
69 # Set *_CONFIG variables on OS X, to override the path to e.g. sdl2-config
70 export GLOOX_CONFIG
=${GLOOX_CONFIG:="$(pwd)/../../libraries/osx/gloox/bin/gloox-config"}
71 export ICU_CONFIG
=${ICU_CONFIG:="$(pwd)/../../libraries/osx/icu/bin/icu-config"}
72 export SDL2_CONFIG
=${SDL2_CONFIG:="$(pwd)/../../libraries/osx/sdl2/bin/sdl2-config"}
73 export WX_CONFIG
=${WX_CONFIG:="$(pwd)/../../libraries/osx/wxwidgets/bin/wx-config"}
74 export XML2_CONFIG
=${XML2_CONFIG:="$(pwd)/../../libraries/osx/libxml2/bin/xml2-config"}
77 # Don't want to build bundled libs on OS X
78 # (build-osx-libs.sh is used instead)
79 if [ "`uname -s`" != "Darwin" ]; then
80 echo "Updating bundled third-party dependencies..."
83 # Build/update bundled external libraries
84 (cd ..
/..
/libraries
/source
/fcollada
/src
&& ${MAKE} ${JOBS}) || die
"FCollada build failed"
86 if [ "$with_system_mozjs38" = "false" ]; then
87 (cd ..
/..
/libraries
/source
/spidermonkey
&& MAKE
=${MAKE} JOBS
=${JOBS} .
/build.sh
) || die
"SpiderMonkey build failed"
90 if [ "$with_system_nvtt" = "false" ] && [ "$without_nvtt" = "false" ]; then
91 (cd ..
/..
/libraries
/source
/nvtt
&& MAKE
=${MAKE} JOBS
=${JOBS} .
/build.sh
) || die
"NVTT build failed"
96 # Now build premake and run it to create the makefiles
97 cd ..
/premake
/premake4
98 PREMAKE_BUILD_DIR
=build
/gmake.unix
99 # BSD and OS X need different Makefiles
102 # use default gmake.unix (needs -ldl as we have a GNU userland and libc)
105 PREMAKE_BUILD_DIR
=build
/gmake.bsd
108 PREMAKE_BUILD_DIR
=build
/gmake.macosx
111 ${MAKE} -C $PREMAKE_BUILD_DIR ${JOBS} || die
"Premake build failed"
117 # If we're in bash then make HOSTTYPE available to Premake, for primitive arch-detection
118 export HOSTTYPE
="$HOSTTYPE"
120 echo "Premake args: ${premake_args}"
122 premake
4/bin
/release
/premake4
--file="premake4.lua" --outpath="../workspaces/gcc/" ${premake_args} gmake || die
"Premake failed"
123 premake
4/bin
/release
/premake4
--file="premake4.lua" --outpath="../workspaces/codeblocks/" ${premake_args} codeblocks || die
"Premake failed"
125 # Also generate xcode workspaces if on OS X
126 if [ "`uname -s`" = "Darwin" ]; then
127 premake
4/bin
/release
/premake4
--file="premake4.lua" --outpath="../workspaces/xcode3" ${premake_args} xcode3 || die
"Premake failed"
128 premake
4/bin
/release
/premake4
--file="premake4.lua" --outpath="../workspaces/xcode4" ${premake_args} xcode4 || die
"Premake failed"
131 # test_root.cpp gets generated by cxxtestgen and passing different arguments to premake could require a regeneration of this file.
132 # It doesn't depend on anything in the makefiles, so make won't notice that the prebuild command for creating test_root.cpp needs to be triggered.
133 # We force this by deleting the file.
134 rm -f ..
/..
/source
/test_root.cpp