]> dev.renevier.net Git - syp.git/blob - build.sh
initial commit
[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 auth.php changes.php index.php items.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 cp -RLp openlayers/img/ $DESTDIR/openlayers/
30 cp -RLp openlayers/theme/ $DESTDIR/openlayers/
31
32 # other javascript
33 cp -RLp js/ $DESTDIR/
34
35 # replace jquery with minified version
36 for file in $DESTDIR/js/jquery-*.min.js; do
37     jversion=${file##$DESTDIR/js/jquery-}
38     jversion=${jversion%%\.min\.js}
39     mv $file $DESTDIR/js/jquery-$jversion.js
40 done
41
42 # copyright and readme files
43 cp -p license.txt README.txt COPYING.txt $DESTDIR/
44
45 # creates upload directory
46 mkdir $DESTDIR/upload
47 chmod a+wx $DESTDIR/upload
48
49 # generate sources
50 cd $BUILDDIR
51 tar -pczf ${PROJNAME}_${PROJVERS}.tar.gz ${PROJNAME}-${PROJVERS}
52 zip -r ${PROJNAME}_${PROJVERS}.zip ${PROJNAME}-${PROJVERS}
53 cd ..