#this script must be run twice. first time as root, which installs system packages
#second time as a regular user (probably not your normal one), which installs 3rd-party stuff
SVNROOT=$(cd"$(dirname "$BASH_SOURCE")"&&pwd)
FTEROOT=$(realpath $SVNROOT/..)
FTEROOT=${FTEROOT:-~}
FTECONFIG=$SVNROOT/build.cfg
BUILDFOLDER=`echo ~`/htdocs
BUILDLOGFOLDER=$BUILDFOLDER/build_logs
#mac defaults
OSXCROSSROOT=$FTEROOT/osxcross
#emscripten defaults
EMSCRIPTENROOT=$FTEROOT/emsdk-portable
#nacl defaults
NACLROOT=$FTEROOT/nacl_sdk
NACLSDKVERSION=pepper_49
#android defaults
ANDROIDROOT=$FTEROOT/android
if[ ! -z "$(uname -o 2>&1| grep Cygwin)"];then
ANDROID_HOSTSYSTEM=windows-x86_64
else
ANDROID_HOSTSYSTEM=linux-$(uname -m)
fi
ANDROIDBUILDTOOLS=25.0.0
ANDROID_ZIPALIGN=$ANDROIDROOT/build-tools/$ANDROIDBUILDTOOLS/zipalign #relative to ndk tools
THREADS="-j 4"
#windows is always cross compiled, so we don't have issues with non-native ffmpeg
PLUGINS_LINUXx86="ode qi ezhud xmpp irc"
PLUGINS_LINUXx64="ode qi ezhud xmpp irc"
PLUGINS_LINUXx32="qi ezhud xmpp irc"
PLUGINS_LINUXarmhf="qi ezhud xmpp irc"
if["$(uname -m)" !="x86_64"];then
PLUGINS_LINUXx86="ffmpeg ode qi ezhud xmpp irc"
fi
if["$(uname -m)"=="x86_64"];then
PLUGINS_LINUX64="ffmpeg ode qi ezhud xmpp irc"
fi
#windows doesn't cross compile, so no system dependancy issues
#skip some dependancies if we're running on cygwin, ode is buggy.
if["$(uname -s)"=="Linux"];then
PLUGINS_WINDOWS="ffmpeg ode qi ezhud xmpp irc"
else
PLUGINS_WINDOWS="qi ezhud xmpp irc"
fi
echo
echo"This is Spike's script to set up various cross compilers and dependancies."
echo"This script will check dependancies. If something isn't installed you can either rerun the script as root (which will ONLY install system packages), or manually apt-get or whatever. You can then re-run the script as a regular user to finish configuring 3rd party dependancies."
echo
echo"You can change your choices later by just re-running this script"
echo"(Your settings will be autosaved in $FTECONFIG)"
echo
echo"If you just want to compile a native build, just use the following command:"
echo"cd $SVNROOT/engine && make gl-rel"
echo"(if you're in cygwin, add FTE_TARGET=win32 to compile for native windows)"
echo"(add plugins-rel qcc-rel qccgui-rel sv-rel vk-rel etc for additional targets)"
echo"(or use -dbg if you want debug builds for whatever reason)"
echo
#always execute it if it exists, so that we preserve custom paths etc that are not prompted for here
if[ -e $FTECONFIG];then
. $FTECONFIG
if[$UID -eq 0];then
REUSE_CONFIG=y #root shouldn't be writing/owning the config file.
#we don't really know what system we're on. assume they have any system dependancies.
#fixme: args are programs findable with which
function otherpackages {
if[ -z "$PRETTY_NAME"];then
return$true
fi
return$false
}
#Note: only the native linux-sdl target can be compiled, as libSDL[2]-dev doesn't support multiarch properly, and we depend upon it instead of building from source (thus ensuring it has whatever distro stuff needed... though frankly that should be inside the .so instead of the headers).
if[$UID -eq 0]&&[ ! -z `which apt-get`];then
#because multiarch requires separate packages for some things, we'll need to set that up now (in case noone did that yet)
dpkg --add-architecture i386
apt-get update
fi
#generic crap. much of this is needed to set up and decompress dependancies and stuff.
debianpackages subversion make automake libtool p7zip-full zip || otherpackages z7 make svn ||exit
#FIXME: there may be race conditions when compiling.
#so make sure we've pre-built certain targets without using -j
#linux distros vary too much with various dependancies and versions and such, so we might as well pre-build our own copies of certain libraries. this really only needs to be done once, but its safe to retry anyway.
cd$SVNROOT/engine
if["$BUILD_LINUXx86"=="y"];then
echo"Making libraries (x86)..."
make FTE_TARGET=linux32 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null
fi
if["$BUILD_LINUXx64"=="y"];then
echo"Making libraries (linux x86_64)..."
make FTE_TARGET=linux64 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null
fi
if["$BUILD_LINUXx32"=="y"];then
echo"Making libraries (linux x32)..."
make FTE_TARGET=linuxx32 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null
fi
if["$BUILD_LINUXarmhf"=="y"];then
echo"Making libraries (linux armhf)..."
make FTE_TARGET=linuxarmhf makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null