| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # Abort script at first error, so that the script doesn't exit with |
| 4 | # status 0 for missing files |
| 5 | set -o errexit |
| 6 | |
| 7 | if [scip-shell system . . `[`. $# -ne 1 ] && [scip-shell system . . `[`. $# -ne 2 ]; then |
| 8 | echoscip-shell system . . echo. "Simple packaging file for the Windows port. Only really useful when" |
| 9 | echoscip-shell system . . echo. "cross-compiling, or using Cygwin. Originally by Robert Ruehlmann." |
| 10 | echoscip-shell system . . echo. "" |
| 11 | echoscip-shell system . . echo. "Use in the root directory of the game, like so:" |
| 12 | echoscip-shell system . . echo. " scripts/pkg_win <name of of release, e.g. angband-4.0.1> [<output filename>]" |
| 13 | echoscip-shell system . . echo. "" |
| 14 | |
| 15 | exit 1 |
| 16 | fi |
| 17 | |
| 18 | DIR=$1 |
| 19 | if [scip-shell system . . `[`. $# -eq 1 ]; then |
| 20 | OUT=$1.zip |
| 21 | else |
| 22 | OUT=$2 |
| 23 | fi |
| 24 | |
| 25 | |
| 26 | function cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). { |
| 27 | # Just in case they're already DOS_format, we strip them to UNIX first. :) |
| 28 | awkscip-shell system . . awk. '{ sub("\r$", ""); sub("$", "\r"); print }' $1 > $2 |
| 29 | } |
| 30 | |
| 31 | |
| 32 | mkdirscip-shell system . . mkdir. -p $DIR |
| 33 | cd $DIR |
| 34 | |
| 35 | mkdirscip-shell system . . mkdir. docs |
| 36 | mkdirscip-shell system . . mkdir. docs/_sources |
| 37 | mkdirscip-shell system . . mkdir. docs/_sources/hacking |
| 38 | mkdirscip-shell system . . mkdir. docs/_static |
| 39 | mkdirscip-shell system . . mkdir. docs/hacking |
| 40 | mkdirscip-shell system . . mkdir. lib |
| 41 | mkdirscip-shell system . . mkdir. lib/gamedata |
| 42 | mkdirscip-shell system . . mkdir. lib/customize |
| 43 | mkdirscip-shell system . . mkdir. lib/help |
| 44 | mkdirscip-shell system . . mkdir. lib/screens |
| 45 | mkdirscip-shell system . . mkdir. lib/fonts |
| 46 | mkdirscip-shell system . . mkdir. lib/tiles |
| 47 | mkdirscip-shell system . . mkdir. lib/tiles/adam-bolt |
| 48 | mkdirscip-shell system . . mkdir. lib/tiles/gervais |
| 49 | mkdirscip-shell system . . mkdir. lib/tiles/nomad |
| 50 | mkdirscip-shell system . . mkdir. lib/tiles/old |
| 51 | mkdirscip-shell system . . mkdir. lib/tiles/shockbolt |
| 52 | mkdirscip-shell system . . mkdir. lib/sounds |
| 53 | mkdirscip-shell system . . mkdir. lib/icons |
| 54 | mkdirscip-shell system . . mkdir. lib/user |
| 55 | mkdirscip-shell system . . mkdir. lib/user/save |
| 56 | mkdirscip-shell system . . mkdir. lib/user/scores |
| 57 | mkdirscip-shell system . . mkdir. lib/user/info |
| 58 | mkdirscip-shell system . . mkdir. lib/user/archive |
| 59 | mkdirscip-shell system . . mkdir. lib/user/panic |
| 60 | |
| 61 | touchscip-shell system . . touch. lib/user/delete.me lib/user/save/delete.me lib/user/scores/delete.me \ |
| 62 | lib/user/info/delete.me lib/user/archive/delete.me \ |
| 63 | lib/user/panic/delete.me |
| 64 | |
| 65 | cpscip-shell system . . cp. ../*.exe . |
| 66 | cpscip-shell system . . cp. ../*.dll . |
| 67 | |
| 68 | # Copy the readmes and suchlike, converting to DOS line endings on the way |
| 69 | |
| 70 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). ../changes.txt changes.txt |
| 71 | |
| 72 | # Assumes that all the converted files in docs have names that don't contain |
| 73 | # spaces or other characters that the shell uses as field separators. |
| 74 | # First copy the ones that will benefit from newline conversion; then |
| 75 | # do the rest. |
| 76 | for f in `findscip-shell system . . find. ../docs/_build/html \( -name '*.css' -o -name '*.html' \ |
| 77 | -o -name '*.js' -o -name '*.svg' -o -name '*.txt' \) \ |
| 78 | \! -type d -print` ; do |
| 79 | cp_uscip-shell system . . echo.nixscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos().2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$scip-shell system . . sed.f" \ |
| 80 | `echo "$f" | sed -E -e 's%^\.\./docs/_build/html%docs%'` |
| 81 | done |
| 82 | for f in `findscip-shell system . . find. ../docs/_build/html \! -name '*.css' \! -name '*.html' \ |
| 83 | \! -name '*.js' \! -name '*.svg' \! -name '*.txt' \ |
| 84 | \! -type d -print` ; do |
| 85 | cpscip-shell system . . cp. "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./docs/_build/html%docs%'` |
| 86 | done |
| 87 | |
| 88 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). ../lib/readme.txt lib/readme.txt |
| 89 | |
| 90 | # Ditto the comment above for the way find is used here. |
| 91 | for f in `findscip-shell system . . find. ../lib/gamedata -name '*.txt' -print` ; do |
| 92 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./%%'` |
| 93 | done |
| 94 | for f in `findscip-shell system . . find. ../lib/screens -name '*.txt' -print` ; do |
| 95 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./%%'` |
| 96 | done |
| 97 | for f in `findscip-shell system . . find. ../lib/help -name '*.txt' -print` ; do |
| 98 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./%%'` |
| 99 | done |
| 100 | |
| 101 | for f in `findscip-shell system . . find. ../lib/customize -name '*.prf' -print` ; do |
| 102 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./%%'` |
| 103 | done |
| 104 | |
| 105 | cpscip-shell system . . cp. ../lib/fonts/*.fon ../lib/fonts/*.woff lib/fonts |
| 106 | |
| 107 | for f in `findscip-shell system . . find. ../lib/icons \( -name '*.desktop' -o -name '*.svg' \) \ |
| 108 | -print` ; do |
| 109 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./%%'` |
| 110 | done |
| 111 | cpscip-shell system . . cp. ../lib/icons/*.png lib/icons |
| 112 | |
| 113 | for f in `findscip-shell system . . find. ../lib/tiles \( -name '*.txt' -o -name '*.prf' \) -print` ; do |
| 114 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./%%'` |
| 115 | done |
| 116 | cpscip-shell system . . cp. ../lib/tiles/adam-bolt/*.png lib/tiles/adam-bolt |
| 117 | cpscip-shell system . . cp. ../lib/tiles/gervais/*.png lib/tiles/gervais |
| 118 | cpscip-shell system . . cp. ../lib/tiles/nomad/*.png lib/tiles/nomad |
| 119 | cpscip-shell system . . cp. ../lib/tiles/old/*.png lib/tiles/old |
| 120 | cpscip-shell system . . cp. ../lib/tiles/shockbolt/*.png lib/tiles/shockbolt |
| 121 | |
| 122 | cpscip-shell system . . cp. ../lib/sounds/*.mp3 lib/sounds |
| 123 | |
| 124 | for f in `findscip-shell system . . find. ../lib/user/info \( -name '*.txt' -o -name '*.hlp' \) \ |
| 125 | -print` ; do |
| 126 | cp_unix2dosscip-shell shell angband 1:4.2.5+dfsg1-5 cp_unix2dos(). "$f" `echoscip-shell system . . echo. "$f" | sedscip-shell system . . sed. -E -e 's%^\.\./%%'` |
| 127 | done |
| 128 | |
| 129 | cd .. |
| 130 | zip -9 -r $OUT $DIR |
| 131 | rmscip-shell system . . rm. -rf $DIR |