Subversion Repositories eduke32

Rev

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