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