Subversion Repositories eduke32

Rev

Rev 1651 | Rev 1675 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1651 terminx 1
#!/bin/sh
1512 plagman 2
 
3
# some paths
1651 terminx 4
top=/var/www/synthesis/eduke32
5
lockfile=$top/synthesis_building
6
source=eduke32
1518 plagman 7
output=/var/www/dukeworld.duke4.net/eduke32/synthesis
1651 terminx 8
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 )
1512 plagman 9
clean=veryclean
1535 terminx 10
 
1512 plagman 11
# the following file paths are relative to $source
12
targets=( eduke32.exe mapster32.exe )
1651 terminx 13
bin_packaged=( eduke32.exe mapster32.exe SEHELP.HLP STHELP.HLP names.h buildlic.txt GNU.TXT m32help.hlp nedmalloc.dll samples )
14
not_src_packaged=( psd source/jaudiolib/third-party/vorbis.framework/Versions/A/vorbis Apple )
1512 plagman 15
 
1535 terminx 16
# group that owns the resulting packages
17
group=dukeworld
1512 plagman 18
 
19
# some variables
20
dobuild=
21
 
1651 terminx 22
# controls resulting package filenames... will support linux later
23
basename=eduke32
24
platform=win32
25
 
1512 plagman 26
# if the output dir doesn't exist, create it
27
if [ ! -e $output ]
28
then
29
    mkdir -p $output
30
fi
31
 
1651 terminx 32
if [ -f $lockfile ]
33
then
34
        echo "Build already in progress!"
35
        exit
36
else
37
    touch $lockfile
38
fi
39
 
40
cd $top
41
 
1512 plagman 42
# update the code repository and get the last revision number from SVN
43
head=`svn update | tail -n1 | awk '{ print $NF }' | cut -d. -f1`
44
echo "HEAD is revision $head."
45
 
46
lastrevision=`ls -A1 $output | tail -n1 | cut -d- -f2`
47
 
48
# if the output dir is empty, we build no matter what
49
if [ ! $lastrevision ]
50
then
51
    echo "No builds yet."
52
    dobuild=1
53
else
54
    echo "Last built revision is $lastrevision."
1651 terminx 55
 
1512 plagman 56
    # if the last built revision is less than HEAD, we also build
57
    if [ $lastrevision -lt $head ]
58
    then
59
        echo "Need a new build."
60
        dobuild=1
61
    fi
62
fi
63
 
64
if [ $dobuild ]
65
then
66
    echo "Launching a build..."
1651 terminx 67
 
1518 plagman 68
    cd $top/$source
1651 terminx 69
 
70
    # clean the tree and build
71
    echo "${make[@]}" $clean all
72
    "${make[@]}" $clean all
73
 
1512 plagman 74
    # make sure all the targets were produced
75
    for i in "${targets[@]}"; do
76
        if [ ! -e $i ]
77
        then
1651 terminx 78
            echo "Build failed! Bailing out..."
79
                rm -r $lockfile
80
            exit
1512 plagman 81
        fi
82
    done
1651 terminx 83
 
1512 plagman 84
    # get the date in the YYYYMMDD format (ex: 20091001)
85
    date=`date +%Y%m%d`
1651 terminx 86
 
1512 plagman 87
    # create the output directory
88
    mkdir $output/$date-$head
1651 terminx 89
 
1512 plagman 90
    # package the binary snapshot
1654 terminx 91
    echo zip -9 $output/$date-$head/${basename}_${platform}_$date-$head.zip ${bin_packaged[@]}
92
    zip -9 $output/$date-$head/${basename}_${platform}_$date-$head.zip ${bin_packaged[@]}
1651 terminx 93
 
1512 plagman 94
    # hack to restore [e]obj/keep.me
95
    echo svn update -r $head
96
    svn update -r $head
1651 terminx 97
 
1512 plagman 98
    # export the source tree into the output directory
1654 terminx 99
    svn export . $output/$date-$head/${basename}_$date-$head
100
    echo svn export . $output/$date-$head/${basename}_$date-$head
1651 terminx 101
 
1512 plagman 102
    # package the source
103
    cd $output/$date-$head
1651 terminx 104
 
1518 plagman 105
    # first remove the unnecessary files
106
    for i in "${not_src_packaged[@]}"; do
1654 terminx 107
        echo rm -r ${basename}_$date-$head/$i
108
        rm -r ${basename}_$date-$head/$i
1518 plagman 109
    done
1651 terminx 110
 
1654 terminx 111
    echo tar cjf ${basename}_src_$date-$head.tar.bz2 ${basename}_$date-$head
112
    tar cjf ${basename}_src_$date-$head.tar.bz2 ${basename}_$date-$head
113
    rm -r ${basename}_$date-$head
1651 terminx 114
 
1515 plagman 115
    # output the changelog since last snapshot in the output directory
116
    if [  $lastrevision ]
117
    then
1518 plagman 118
        cd $top/$source
1516 plagman 119
        svn log -r $head:$lastrevision > $output/$date-$head/ChangeLog.txt
1515 plagman 120
    fi
1651 terminx 121
 
122
    # hack for our served directory structure... really belongs elsewhere,
123
    # like in whatever script executes this one
1517 plagman 124
    chmod -R g+w $output/$date-$head
1535 terminx 125
    chown -R :$group $output/$date-$head
1651 terminx 126
 
127
    rm -r $lockfile
1512 plagman 128
else
129
    echo "Nothing to do."
1651 terminx 130
    rm -r $lockfile
1535 terminx 131
fi