450
|
1 #!/bin/bash
|
|
2
|
|
3 if [[ $1 != [0-9].[0-9][0-9][0-9] ]]; then
|
|
4 echo Wrong version format. Expected: d.ddd
|
|
5 exit;
|
|
6 fi
|
|
7
|
|
8 NAME="dil"
|
|
9 BUILD="./build"
|
|
10 DIR="$NAME.$1"
|
|
11 DEST="${BUILD}/$DIR"
|
|
12 FRESH_REPOS="fresh_repos"
|
|
13
|
|
14 # Create build directory.
|
|
15 [ ! -e $BUILD ] && mkdir $BUILD
|
|
16
|
|
17 # Convert Unix newlines to Windows newlines
|
|
18 # function unix2win
|
|
19 # {
|
|
20 # sed {s/$/\\r/} $*
|
|
21 # }
|
|
22
|
|
23 # We need dil to get a list of all modules to be compiled.
|
|
24 if [ ! -s ./dil ]; then
|
|
25 dsss build -full -w &> /dev/null
|
|
26 fi
|
|
27 SRC_FILES=`./dil igraph src/main.d --paths`
|
|
28 function winbuild
|
|
29 {
|
|
30 wine ~/bin/dmd.exe $SRC_FILES -odwinobj -ofdil $*
|
|
31 }
|
|
32
|
|
33 # Recreate destination director.
|
|
34 rm -rf $DEST
|
|
35 mkdir $DEST $DEST/bin $DEST/src
|
|
36
|
|
37 # Linux Debug
|
|
38 dsss build -clean -full -version=D2
|
|
39 cp dil $DEST/bin/dil2_d
|
|
40 dsss build -clean -full
|
|
41 cp dil $DEST/bin/dil_d
|
|
42 # Linux Release
|
|
43 dsss build -clean -full -release -O -inline -version=D2
|
|
44 cp dil $DEST/bin/dil2
|
|
45 dsss build -clean -full -release -O -inline
|
|
46 cp dil $DEST/bin/dil
|
|
47
|
|
48 if [ -s ~/bin/dmd.exe ]; then
|
|
49 echo "*** Building Windows Binaries ***\n"
|
|
50 # Windows Debug
|
|
51 winbuild -version=D2
|
|
52 cp dil.exe $DEST/bin/dil2_d.exe
|
|
53 winbuild
|
|
54 cp dil.exe $DEST/bin/dil_d.exe
|
|
55 # Windows Release
|
|
56 winbuild -release -O -inline -version=D2
|
|
57 cp dil.exe $DEST/bin/dil2.exe
|
|
58 winbuild -release -O -inline
|
|
59 cp dil.exe $DEST/bin/dil.exe
|
|
60 fi
|
|
61
|
|
62 # Copy source and other files.
|
|
63 rm -rf $BUILD/$FRESH_REPOS
|
|
64 hg archive -r tip -t files $BUILD/$FRESH_REPOS
|
|
65 cp -r $BUILD/$FRESH_REPOS/trunk/* $DEST
|
|
66
|
|
67 cp $BUILD/$FRESH_REPOS/trunk/src/config.d $DEST/bin/
|
|
68 cp $BUILD/$FRESH_REPOS/trunk/src/lang_*.d $DEST/bin/
|
|
69
|
|
70 # Build archives
|
|
71 cd $BUILD
|
|
72 # tar.gz doesn't compress well
|
|
73 tar --owner root --group root -czf $DIR.tar.gz $DIR
|
|
74 tar --owner root --group root --bzip2 -cf $DIR.tar.bz2 $DIR
|
|
75 zip -q -9 -r $DIR.zip $DIR
|