annotate trunk/release.sh @ 793:b091e8b0ef5c

Fixed and improved release.sh. Modified DDoc comments of modules in util/.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Wed, 27 Feb 2008 18:37:13 +0100
parents 4adfca0c71df
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
1 #!/bin/bash
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
2
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
3 if [[ $1 != [0-9].[0-9][0-9][0-9] ]]; then
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
4 echo Wrong version format. Expected: d.ddd
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
5 exit;
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
6 fi
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
7
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
8 BUILD="./build"
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
9 DIR="dil.$1"
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
10 DEST="$BUILD/$DIR"
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
11 FRESH_REPOS="$BUILD/fresh_repos"
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
12
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
13 # Create build directory if it doesn't exist.
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
14 [ ! -e $BUILD ] && mkdir $BUILD
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
15
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
16 # Convert Unix newlines to Windows newlines
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
17 # function unix2win
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
18 # {
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
19 # sed {s/$/\\r/} $*
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
20 # }
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
21
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
22 # We need dil to get a list of all modules to be compiled.
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
23 if [ ! -s ./dil ]; then
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
24 dsss build -full &> /dev/null
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
25 fi
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
26
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
27 if [ ! -s ./dil ]; then
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
28 echo "Couldn't build DIL. Can't get list of modules to be built."
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
29 exit;
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
30 fi
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
31
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
32 # Used by doc generation and winbuild function.
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
33 SRC_FILES=`./dil igraph src/main.d --paths`
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
34
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
35 # Recreate destination directory.
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
36 rm -rf $DEST
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
37 mkdir -p $DEST/{bin,doc/htmlsrc,src}
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
38
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
39 # Create documentation.
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
40 ./dil ddoc $DEST/doc/ -v src/macros_dil.ddoc -version=DDoc src/config.d $SRC_FILES
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
41 # Generate syntax highlighted HTML files.
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
42 HTMLSRC="$DEST/doc/htmlsrc"
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
43 for filepath in $SRC_FILES;
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
44 do
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
45 htmlfile=`echo $filepath | sed -e 's@^src/@@' -e 's@/@.@g' -e 's@.d$@@'`.html
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
46 echo "FILE: $filepath > $HTMLSRC/$htmlfile";
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
47 ./dil gen --lines --syntax --html $filepath > "$HTMLSRC/$htmlfile";
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
48 done
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
49
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
50 # Linux Debug
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
51 echo "***** Building Linux binaries *****"
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
52 dsss build -clean -full -version=D2
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
53 cp dil $DEST/bin/dil2_d
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
54 dsss build -clean -full
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
55 cp dil $DEST/bin/dil_d
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
56 # Linux Release
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
57 dsss build -clean -full -release -O -inline -version=D2
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
58 cp dil $DEST/bin/dil2
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
59 dsss build -clean -full -release -O -inline
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
60 cp dil $DEST/bin/dil
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
61
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
62 if [ -s ~/bin/dmd.exe ]; then
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
63 echo "***** Building Windows binaries *****"
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
64 function winbuild
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
65 { # obj dir is winobj. -op = don't strip paths from obj files.
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
66 wine ~/bin/dmd.exe -odwinobj -op -ofdil $* $SRC_FILES
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
67 }
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
68 # Windows Debug
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
69 winbuild -version=D2
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
70 cp dil.exe $DEST/bin/dil2_d.exe
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
71 winbuild
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
72 cp dil.exe $DEST/bin/dil_d.exe
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
73 # Windows Release
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
74 winbuild -release -O -inline -version=D2
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
75 cp dil.exe $DEST/bin/dil2.exe
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
76 winbuild -release -O -inline
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
77 cp dil.exe $DEST/bin/dil.exe
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
78 fi
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
79
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
80 # Copy source and other files.
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
81 rm -rf $FRESH_REPOS
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
82 hg archive -r tip -t files $FRESH_REPOS
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
83 cp -r $FRESH_REPOS/trunk/* $DEST
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
84
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
85 cp $FRESH_REPOS/trunk/src/config.d $DEST/bin/
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
86 cp $FRESH_REPOS/trunk/src/lang_*.d $DEST/bin/
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
87 cp $FRESH_REPOS/trunk/src/*_map.d $DEST/bin/
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
88 cp $FRESH_REPOS/trunk/src/*.css $DEST/bin/
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
89 cp $FRESH_REPOS/trunk/src/predefined.ddoc $DEST/bin/
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
90 cp $FRESH_REPOS/trunk/src/html.css $HTMLSRC
450
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
91
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
92 # Build archives
4adfca0c71df Added release script.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
93 # tar.gz doesn't compress well
793
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
94 tar --owner root --group root -czf $DEST.tar.gz $DEST
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
95 tar --owner root --group root --bzip2 -cf $DEST.tar.bz2 $DEST
b091e8b0ef5c Fixed and improved release.sh.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 450
diff changeset
96 zip -q -9 -r $DEST.zip $DEST