git-svn-id: https://svn.eduke32.com/eduke32@1651 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2010-05-25 10:47:52 +00:00
parent 011a3ba327
commit 8ae2a7c1ac

View file

@ -1,23 +1,27 @@
#!/bin/bash #!/bin/sh
# some paths # some paths
top=/home/plagman/src/eduke32 top=/var/www/synthesis/eduke32
source=polymer/eduke32 lockfile=$top/synthesis_building
source=eduke32
output=/var/www/dukeworld.duke4.net/eduke32/synthesis output=/var/www/dukeworld.duke4.net/eduke32/synthesis
make=( make PLATFORM=WINDOWS CC='wine gcc' CXX='wine g++' AS='wine nasm' RC='wine windres' STRIP='wine strip' AR='wine ar' RANLIB='wine ranlib' PRETTY_OUTPUT=0 ) make=( make PLATFORM=WINDOWS CC='wine gcc' CXX='wine g++' AS='wine nasm' RC='wine windres' STRIP='wine strip' AR='wine ar' RANLIB='wine ranlib' PRETTY_OUTPUT=0 NEDMALLOC=0 )
clean=veryclean clean=veryclean
# the following file paths are relative to $source # the following file paths are relative to $source
targets=( eduke32.exe mapster32.exe ) targets=( eduke32.exe mapster32.exe )
bin_packaged=( eduke32.exe mapster32.exe duke3d.def.sample enhance.con.sample SEHELP.HLP STHELP.HLP m32script_ex.map names.h tiles.cfg buildlic.txt GNU.TXT m32help.hlp ror.map a.m32 ) bin_packaged=( eduke32.exe mapster32.exe SEHELP.HLP STHELP.HLP names.h buildlic.txt GNU.TXT m32help.hlp nedmalloc.dll samples )
not_src_packaged=( rsrc/game2.psd rsrc/game3.psd source/jaudiolib/third-party/vorbis.framework/Versions/A/vorbis Apple ) not_src_packaged=( psd source/jaudiolib/third-party/vorbis.framework/Versions/A/vorbis Apple )
# group that owns the resulting packages # group that owns the resulting packages
group=dukeworld group=dukeworld
# some variables # some variables
dobuild= dobuild=
buildfailed=
# controls resulting package filenames... will support linux later
basename=eduke32
platform=win32
# if the output dir doesn't exist, create it # if the output dir doesn't exist, create it
if [ ! -e $output ] if [ ! -e $output ]
@ -25,8 +29,17 @@ then
mkdir -p $output mkdir -p $output
fi fi
# update the code repository and get the last revision number from SVN if [ -f $lockfile ]
then
echo "Build already in progress!"
exit
else
touch $lockfile
fi
cd $top cd $top
# update the code repository and get the last revision number from SVN
head=`svn update | tail -n1 | awk '{ print $NF }' | cut -d. -f1` head=`svn update | tail -n1 | awk '{ print $NF }' | cut -d. -f1`
echo "HEAD is revision $head." echo "HEAD is revision $head."
@ -39,6 +52,7 @@ then
dobuild=1 dobuild=1
else else
echo "Last built revision is $lastrevision." echo "Last built revision is $lastrevision."
# if the last built revision is less than HEAD, we also build # if the last built revision is less than HEAD, we also build
if [ $lastrevision -lt $head ] if [ $lastrevision -lt $head ]
then then
@ -50,58 +64,68 @@ fi
if [ $dobuild ] if [ $dobuild ]
then then
echo "Launching a build..." echo "Launching a build..."
cd $top/$source cd $top/$source
# clean the tree
echo "${make[@]}" $clean # clean the tree and build
"${make[@]}" $clean echo "${make[@]}" $clean all
# build "${make[@]}" $clean all
echo "${make[@]}"
"${make[@]}"
# make sure all the targets were produced # make sure all the targets were produced
for i in "${targets[@]}"; do for i in "${targets[@]}"; do
if [ ! -e $i ] if [ ! -e $i ]
then
buildfailed=1
fi
done
# bail out if the build is failed
if [ $buildfailed ]
then then
echo "Build failed! Bailing out..." echo "Build failed! Bailing out..."
rm -r $lockfile
exit exit
fi fi
done
# get the date in the YYYYMMDD format (ex: 20091001) # get the date in the YYYYMMDD format (ex: 20091001)
date=`date +%Y%m%d` date=`date +%Y%m%d`
# create the output directory # create the output directory
mkdir $output/$date-$head mkdir $output/$date-$head
# package the binary snapshot # package the binary snapshot
echo zip -9 $output/$date-$head/eduke32_win32_$date-$head.zip ${bin_packaged[@]} echo zip -9 $output/$date-$head/$basename_$platform_$date-$head.zip ${bin_packaged[@]}
zip -9 $output/$date-$head/eduke32_win32_$date-$head.zip ${bin_packaged[@]} zip -9 $output/$date-$head/$basename_$platform_$date-$head.zip ${bin_packaged[@]}
# hack to restore [e]obj/keep.me # hack to restore [e]obj/keep.me
echo svn update -r $head echo svn update -r $head
svn update -r $head svn update -r $head
# export the source tree into the output directory # export the source tree into the output directory
svn export . $output/$date-$head/eduke32_$date-$head svn export . $output/$date-$head/$basename_$date-$head
echo svn export . $output/$date-$head/eduke32_$date-$head echo svn export . $output/$date-$head/$basename_$date-$head
# package the source # package the source
cd $output/$date-$head cd $output/$date-$head
# first remove the unnecessary files # first remove the unnecessary files
for i in "${not_src_packaged[@]}"; do for i in "${not_src_packaged[@]}"; do
echo rm -r eduke32_$date-$head/$i echo rm -r $basename_$date-$head/$i
rm -r eduke32_$date-$head/$i rm -r $basename_$date-$head/$i
done done
echo tar cvzf eduke32_src_$date-$head.tar.gz eduke32_$date-$head
tar cvzf eduke32_src_$date-$head.tar.gz eduke32_$date-$head echo tar cjf $basename_src_$date-$head.tar.bz2 $basename_$date-$head
rm -r eduke32_$date-$head tar cjf $basename_src_$date-$head.tar.bz2 $basename_$date-$head
rm -r $basename_$date-$head
# output the changelog since last snapshot in the output directory # output the changelog since last snapshot in the output directory
if [ $lastrevision ] if [ $lastrevision ]
then then
cd $top/$source cd $top/$source
svn log -r $head:$lastrevision > $output/$date-$head/ChangeLog.txt svn log -r $head:$lastrevision > $output/$date-$head/ChangeLog.txt
fi fi
# hack for our served directory structure
# hack for our served directory structure... really belongs elsewhere,
# like in whatever script executes this one
chmod -R g+w $output/$date-$head chmod -R g+w $output/$date-$head
chown -R :$group $output/$date-$head chown -R :$group $output/$date-$head
rm -r $lockfile
else else
echo "Nothing to do." echo "Nothing to do."
rm -r $lockfile
fi fi