Subversion Repositories eduke32

Rev

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

Rev Author Line No. Line
1512 plagman 1
#!/bin/bash
2
 
3
# some paths
1518 plagman 4
top=/home/plagman/src/eduke32
5
source=polymer/eduke32
6
output=/var/www/dukeworld.duke4.net/eduke32/synthesis
1512 plagman 7
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 )
8
clean=veryclean
1535 terminx 9
 
1512 plagman 10
# the following file paths are relative to $source
11
targets=( eduke32.exe mapster32.exe )
1518 plagman 12
bin_packaged=( eduke32.exe mapster32.exe names.h tiles.cfg buildlic.txt GNU.TXT m32help.hlp ror.map a.m32 )
13
not_src_packaged=( rsrc/game2.psd rsrc/game3.psd source/jaudiolib/third-party/vorbis.framework/Versions/A/vorbis Apple )
1512 plagman 14
 
1535 terminx 15
# group that owns the resulting packages
16
group=dukeworld
1512 plagman 17
 
18
# some variables
19
dobuild=
20
buildfailed=
21
 
22
# if the output dir doesn't exist, create it
23
if [ ! -e $output ]
24
then
25
    mkdir -p $output
26
fi
27
 
28
# update the code repository and get the last revision number from SVN
29
cd $top
30
head=`svn update | tail -n1 | awk '{ print $NF }' | cut -d. -f1`
31
echo "HEAD is revision $head."
32
 
33
lastrevision=`ls -A1 $output | tail -n1 | cut -d- -f2`
34
 
35
# if the output dir is empty, we build no matter what
36
if [ ! $lastrevision ]
37
then
38
    echo "No builds yet."
39
    dobuild=1
40
else
41
    echo "Last built revision is $lastrevision."
42
    # if the last built revision is less than HEAD, we also build
43
    if [ $lastrevision -lt $head ]
44
    then
45
        echo "Need a new build."
46
        dobuild=1
47
    fi
48
fi
49
 
50
if [ $dobuild ]
51
then
52
    echo "Launching a build..."
1518 plagman 53
    cd $top/$source
1513 plagman 54
    # clean the tree
55
    echo "${make[@]}" $clean
56
    "${make[@]}" $clean
1512 plagman 57
    # build
58
    echo "${make[@]}"
59
    "${make[@]}"
60
    # make sure all the targets were produced
61
    for i in "${targets[@]}"; do
62
        if [ ! -e $i ]
63
        then
64
            buildfailed=1
65
        fi
66
    done
67
    # bail out if the build is failed
68
    if [ $buildfailed ]
69
    then
70
        echo "Build failed! Bailing out..."
71
        exit
72
    fi
73
    # get the date in the YYYYMMDD format (ex: 20091001)
74
    date=`date +%Y%m%d`
75
    # create the output directory
76
    mkdir $output/$date-$head
77
    # package the binary snapshot
1535 terminx 78
    echo zip -9 $output/$date-$head/eduke32_win32_$date-$head.zip ${bin_packaged[@]}
79
    zip -9 $output/$date-$head/eduke32_win32_$date-$head.zip ${bin_packaged[@]}
1512 plagman 80
    # hack to restore [e]obj/keep.me
81
    echo svn update -r $head
82
    svn update -r $head
83
    # export the source tree into the output directory
84
    svn export . $output/$date-$head/eduke32_$date-$head
85
    echo svn export . $output/$date-$head/eduke32_$date-$head
86
    # package the source
87
    cd $output/$date-$head
1518 plagman 88
    # first remove the unnecessary files
89
    for i in "${not_src_packaged[@]}"; do
90
        echo rm -r eduke32_$date-$head/$i
91
        rm -r eduke32_$date-$head/$i
92
    done
1512 plagman 93
    echo tar cvzf eduke32_src_$date-$head.tar.gz eduke32_$date-$head
94
    tar cvzf eduke32_src_$date-$head.tar.gz eduke32_$date-$head
95
    rm -r eduke32_$date-$head
1515 plagman 96
    # output the changelog since last snapshot in the output directory
97
    if [  $lastrevision ]
98
    then
1518 plagman 99
        cd $top/$source
1516 plagman 100
        svn log -r $head:$lastrevision > $output/$date-$head/ChangeLog.txt
1515 plagman 101
    fi
1517 plagman 102
    # hack for our served directory structure
103
    chmod -R g+w $output/$date-$head
1535 terminx 104
    chown -R :$group $output/$date-$head
1512 plagman 105
else
106
    echo "Nothing to do."
1535 terminx 107
fi