bundle.sh (1921B)
1 #!/bin/sh 2 3 # This script will cross-compile spek.exe, make a ZIP archive and prepare files 4 # for building an MSI installer under Windows. 5 # Check README.md in this directory for instructions. 6 7 # Adjust these variables if necessary. 8 MXE=$(realpath $(dirname $0)/../../../mxe/usr) 9 MAKE=gmake 10 ZIP=zip 11 12 HOST=i686-w64-mingw32.static 13 LANGUAGES="ca cs da de el eo es fi fr gl it ja lv nb nl pl pt_BR ru sk sr@latin sv tr uk vi zh_CN zh_TW" 14 PATH="$MXE"/bin:$PATH 15 WINDRES="$HOST"-windres 16 WX_CONFIG="$MXE"/"$HOST"/bin/wx-config 17 18 cd $(dirname $0)/../.. 19 rm -fr dist/win/build && mkdir dist/win/build 20 21 # Compile the resource file 22 rm -f dist/win/spek.res 23 "$WINDRES" dist/win/spek.rc -O coff -o dist/win/spek.res 24 mkdir -p src/dist/win && cp dist/win/spek.res src/dist/win/ 25 mkdir -p tests/dist/win && cp dist/win/spek.res tests/dist/win/ 26 27 # Compile spek.exe 28 LDFLAGS="-mwindows dist/win/spek.res" ./autogen.sh \ 29 --host="$HOST" \ 30 --disable-valgrind \ 31 --with-wx-config="$WX_CONFIG" \ 32 --prefix=${PWD}/dist/win/build && \ 33 "$MAKE" -j8 && \ 34 "$MAKE" install || exit 1 35 36 # Compile test.exe 37 LDFLAGS="-mconsole" ./autogen.sh \ 38 --host="$HOST" \ 39 --disable-valgrind \ 40 --with-wx-config="$WX_CONFIG" \ 41 --prefix=${PWD}/dist/win/build && \ 42 "$MAKE" check -j8 TESTS= 43 44 # Copy files to the bundle 45 cd dist/win 46 rm -fr Spek && mkdir Spek 47 cp build/bin/spek.exe Spek/ 48 cp ../../LICENCE.md Spek/ 49 cp ../../README.md Spek/ 50 mkdir Spek/lic 51 cp ../../lic/* Spek/lic/ 52 for lang in $LANGUAGES; do 53 mkdir -p Spek/"$lang" 54 cp build/share/locale/"$lang"/LC_MESSAGES/spek.mo Spek/"$lang"/ 55 cp "$MXE"/"$HOST"/share/locale/"$lang"/LC_MESSAGES/wxstd.mo Spek/"$lang"/ 56 done 57 rm -fr build 58 59 # Copy tests 60 rm -fr tests && mkdir tests 61 cp ../../tests/.libs/test.exe tests/ 62 cp -a ../../tests/samples tests/ 63 64 # Create a zip archive 65 rm -f spek.zip 66 "$ZIP" -r spek.zip Spek 67 68 cd ../.. 69 70 # Clean up 71 rm -fr src/dist tests/dist 72 rm dist/win/spek.res