|
| 1 | +#!/bin/sh |
| 2 | +#Script to set up a debian chroot suitable for compiling fte's public builds. |
| 3 | +#deterministic builds are attempted but also requires: |
| 4 | +# gcc/etc versions must match exactly (we use debian oldstable, which should reduce issues...) |
| 5 | +# sourcecode must be unmodified, particuarly if 'svnversion' reports modified even in an irrelevant file then embedded revision numbers will be wrong. |
| 6 | +# third party dependancies need to work and not get messed up (either me failing to re-run makelibs, random wget failures, or outdated revisions being removed from public access) |
| 7 | +# obtained sourcecode revision must match the binary you're trying to duplicate (pre-5601 will insist on updating to latest svn (which may not even have a public build), so expect problems trying to duplicate older builds when the scripts instead try to grab the most recent build). |
| 8 | +#for regular use you should probably set up schroot so you don't need to remember so many args |
| 9 | +#requires about 2.3gb for the chroot+win64 build. |
| 10 | +#android and emscripten targets require proper mounting of /proc and /dev and are NOT supported by this script. don't try enabling them |
| 11 | + |
| 12 | +FTEBUILD=/tmp/ftebuild #change freely |
| 13 | +CHUID=1000 #should generally be your non-root user id, giving you the same access in or out of the chroot... |
| 14 | +CHUSER=spike #sadly this matters. youll just need to pretend to be me inside your chroot for now. |
| 15 | +DEBIANMIRROR=http://ftp.uk.debian.org/debian/ |
| 16 | +DEBIANVERSION=stretch #oldstable now... should update to stable, but paranoid to update due to portability of glibc symbols. |
| 17 | +LANG= #no language packs installed, so would be spammy if the following rules inherit the host lang |
| 18 | +#FTEREVISON="-r 5601" #earlier than 5601 will fail (scripts will try to update to latest) |
| 19 | +#THREADS="-j 8" #override number of threads to compile with, if you have a decent cpu. |
| 20 | + |
| 21 | +#package lists |
| 22 | +#general packages required to get the build system working (python+unzip+etc is for third-party dependancies) |
| 23 | +GENERALPACKAGES= subversion build-essential automake ca-certificates unzip p7zip-full zip libtool python pkg-config |
| 24 | +#package list needed to crosscompile for windows |
| 25 | +WINTARGETPACKAGES= mingw-w64 |
| 26 | +#dev packages required to compile the linux build properly. Comment out for less downloads/diskusage |
| 27 | +LINUXTARGETPACKAGES= gcc-multilib g++-multilib mesa-common-dev libasound2-dev libxcursor-dev libgnutls28-dev |
| 28 | + |
| 29 | +#NOTE: chroot does NOT wipe all environment settings. some get carried over. This is a problem if your distro has a default PATH that excludes the system programs on debian, so this is included to be sure. |
| 30 | +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games |
| 31 | + |
| 32 | +#Set up our chroot (you can skip this part entirely if you're preconfigured a VM) |
| 33 | +#make sure debootstrap is installed, without erroring out if you're not on debian-derivative (NOTE: such users will needs to manually install it first from somewhere!) |
| 34 | +(which apt-get>/dev/null) && apt-get install --no-install-recommends debootstrap |
| 35 | +#create the new debian chroot. it should receive the most recent versions of packages. |
| 36 | +debootstrap $DEBIANVERSION $FTEBUILD $DEBIANMIRROR |
| 37 | +echo "FTEBuild">$FTEBUILD/etc/debian_chroot #optional, so it shows if you decide to run a bash prompt inside the chroot. |
| 38 | +chroot $FTEBUILD adduser --uid $CHUID $CHUSER #create a user (with a homedir), so we dont depend upon root inside the guest, where possible |
| 39 | + |
| 40 | +#Install the extra packages needed to build |
| 41 | +chroot $FTEBUILD apt-get install --no-install-recommends $GENERALPACKAGES $WINTARGETPACKAGES $LINUXTARGETPACKAGES |
| 42 | +#NOW we finally start with non-debian downloads by grabbing the FTE sourcecode |
| 43 | +chroot $FTEBUILD su $CHUSER -c "svn checkout https://svn.code.sf.net/p/fteqw/code/trunk ~/quake/fteqw-code $FTEREVISON" #grab all the source code. |
| 44 | +#FTE has some setup bollocks, which does some toolchain checks and such. You can choose which targets to build here. |
| 45 | +#NOTE: the following line will download third-party packages. |
| 46 | +chroot $FTEBUILD su $CHUSER -c "cd ~/quake/fteqw-code && ./build_setup.sh --noupdate" |
| 47 | +#And finally the main rebuild thing. drop the --noupdate part if you want to build the latest-available revision. |
| 48 | +chroot $FTEBUILD su $CHUSER -c "cd ~/quake/fteqw-code && ./build_wip.sh --noupdate $THREADS" |
| 49 | + |
| 50 | + |
| 51 | +#to remove your chroot afterwards: |
| 52 | +#rm --one-file-system -rf $FTEBUILD |
0 commit comments