Debian Codegraph @

buildall.sh

raw symbols SCIP
1 #!/bin/bash
2
3 if [ -z "$CXXFLAGS" ]; then
4 export CXXFLAGS=-O3
5 fi
6
7 PREFIX_DOC=$DESTDIR/usr/share/doc/powder
8 PREFIX_BIN=$DESTDIR/opt/bin
9
10 function usage {
11 echo Usage: `basename $0` [options]
12 echo -e "--install\t - install POWDER"
13 echo -e "--uninstall\t - uninstall POWDER"
14 echo -e "--help (-h)\t - this help"
15 echo -e "--use-home-dir \t - compile with ~/.powder for saving data"
16 echo
17 echo Script uses these environment variables:
18 echo CXXFLAGS, DESTDIR
19 echo Installation will be done to
20 echo DESTDIR/usr/share/doc/powder
21 echo DESTDIR/opt/bin
22 echo If you do not specify anything, POWDER
23 echo will just be compiled.
24 echo Only one option can be present.
25 echo -e "--install implies changing save to ~/.powder"
26 echo -e "--install does *NOT* rebuild if powder exists"
27 }
28
29 function compile {
30 echo Run this from the root of the source tree.
31
32 echo Rebuild all of POWDER
33 echo Build support binaries
34 cd support/bmp2c
35 make clean
36 make
37 cd ../encyclopedia2c
38 make clean
39 make
40 cd ../enummaker
41 make clean
42 make
43 cd ../map2c
44 make clean
45 make
46 cd ../txt2c
47 make clean
48 make
49 cd ../tile2c
50 make clean
51 make
52
53 echo Clean...
54 cd ../../port/linux
55 make clean
56 echo Premake
57 make premake
58 echo Final install
59 make powder-static
60 cp powder ../..
61 cd ../..
62 echo Run powder to play
63 }
64
65 function install {
66 if [ ! -f powder ]; then
67 compile
68 fi
69 cp powder $PREFIX_BIN || exit 1
70 mkdir -p $PREFIX_DOC || exit 1
71 for file in README.TXT LICENSE.TXT CREDITS.TXT; do
72 cp $file $PREFIX_DOC || exit 1
73 done
74 echo "Installation complete"
75 }
76
77 function uninstall {
78 rm $PREFIX_BIN/powder
79 for file in README.TXT LICENSE.TXT CREDITS.TXT; do
80 rm $PREFIX_DOC/$file
81 done
82 rmdir $PREFIX_DOC
83 }
84
85 for arg in "$@"
86 do
87 if [ "$arg" = "-h" ] || [ "$arg" = "--help" ]; then
88 usage
89 exit
90 fi
91 if [ "$arg" = "--install" ]; then
92 CXXFLAGS="$CXXFLAGS -DCHANGE_WORK_DIRECTORY"
93 INSTALL=1
94 fi
95 if [ "$arg" = "--use-home-dir" ]; then
96 CXXFLAGS="$CXXFLAGS -DCHANGE_WORK_DIRECTORY"
97 fi
98 if [ "$arg" = "--uninstall" ]; then
99 uninstall
100 exit
101 fi
102 done
103
104 if [ "$INSTALL" == "1" ]; then
105 install
106 else
107 compile
108 fi