Subversion Repositories eduke32

Rev

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