]> dev.renevier.net Git - syp.git/blob - build.sh
reset openlayers directory to its original state at the end of build.sh
[syp.git] / build.sh
1 #!/bin/sh
2
3 set -e
4
5 PROJVERS=0.1
6 PROJNAME=syp
7
8 BUILDDIR=${1:-build}
9 DESTDIR=${BUILDDIR}/${PROJNAME}-${PROJVERS}
10
11 rm -rf $BUILDDIR
12 mkdir -p $DESTDIR
13
14 # php includes
15 cp -RLp inc/ $DESTDIR/
16
17 # other php files
18 cp -p admin.*php index.*php upgrade.*php wizard.*php news.php api.php items.php logout.php $DESTDIR/
19
20 # media
21 cp -RLp media/ $DESTDIR/
22
23 # openlayers
24 mkdir -p $DESTDIR/openlayers
25 cd openlayers/build/
26 python build.py ../../syp.cfg
27 cd ../../
28 cp -RLp openlayers/build/OpenLayers.js $DESTDIR/openlayers/
29
30 # openlayers images
31 mkdir $DESTDIR/openlayers/img
32 for file in east-mini.png \
33             north-mini.png \
34             blank.gif \
35             west-mini.png \
36             zoom-plus-mini.png \
37             south-mini.png \
38             zoom-minus-mini.png \
39             zoom-world-mini.png; do
40     cp -p openlayers/img/$file $DESTDIR/openlayers/img
41 done
42 # openlayers theme
43 mkdir -p $DESTDIR/openlayers/theme/default/img
44 cp -Lp openlayers/theme/default/style.css $DESTDIR/openlayers/theme/default/style.css
45 cp -RLp openlayers/theme/default/img/close.gif $DESTDIR/openlayers/theme/default/img
46
47 # other javascript
48 cp -RLp js/ $DESTDIR/
49
50 # replace jquery with minified version
51 for file in $DESTDIR/js/jquery-*.min.js; do
52     jversion=${file##$DESTDIR/js/jquery-}
53     jversion=${jversion%%\.min\.js}
54     mv $file $DESTDIR/js/jquery-$jversion.js
55 done
56
57 # copyright and readme files
58 cp -p license.txt README.txt COPYING.txt $DESTDIR/
59
60 # creates upload directory
61 mkdir -p $DESTDIR/upload/_thumbs
62 chmod -R a+wx $DESTDIR/upload
63
64 # generate sources
65 cd $BUILDDIR
66 tar -pczf ${PROJNAME}_${PROJVERS}.tar.gz ${PROJNAME}-${PROJVERS}
67 zip -r ${PROJNAME}_${PROJVERS}.zip ${PROJNAME}-${PROJVERS}
68 cd ..
69
70 if [ -d .git/ ] && which git > /dev/null; then
71     git checkout openlayers
72 fi