removes unused openlayers files in build result
[syp.git] / build.sh
1 #!/bin/sh
2
3 set -e
4
5 PROJVERS=0.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 api.php items.php logout.php wizard.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             marker-gold.png \
34             north-mini.png \
35             west-mini.png \
36             zoom-plus-mini.png \
37             marker-blue.png \
38             marker-green.png \
39             south-mini.png \
40             zoom-minus-mini.png \
41             zoom-world-mini.png; do
42     cp -p openlayers/img/$file $DESTDIR/openlayers/img
43 done
44 # openlayers theme
45 mkdir -p $DESTDIR/openlayers/theme/default/img
46 cp -Lp openlayers/theme/default/style.css $DESTDIR/openlayers/theme/default/style.css
47 cp -RLp openlayers/theme/default/img/close.gif $DESTDIR/openlayers/theme/default/img
48
49 # other javascript
50 cp -RLp js/ $DESTDIR/
51
52 # replace jquery with minified version
53 for file in $DESTDIR/js/jquery-*.min.js; do
54     jversion=${file##$DESTDIR/js/jquery-}
55     jversion=${jversion%%\.min\.js}
56     mv $file $DESTDIR/js/jquery-$jversion.js
57 done
58
59 # copyright and readme files
60 cp -p license.txt README.txt COPYING.txt $DESTDIR/
61
62 # creates upload directory
63 mkdir $DESTDIR/upload
64 chmod a+wx $DESTDIR/upload
65
66 # generate sources
67 cd $BUILDDIR
68 tar -pczf ${PROJNAME}_${PROJVERS}.tar.gz ${PROJNAME}-${PROJVERS}
69 zip -r ${PROJNAME}_${PROJVERS}.zip ${PROJNAME}-${PROJVERS}
70 cd ..