Update Windows release script
[wimlib] / make-windoze-release
1 #!/bin/bash
2
3 set -e -u
4
5 WIMLIB_ARCH=i686
6 if [ $# -ge 1 ]; then
7         WIMLIB_ARCH=$1
8 fi
9
10 if [[ $WIMLIB_ARCH = i686 ]] ; then
11         DESTDIR=/mnt/tmp/wimlib
12 elif [[ $WIMLIB_ARCH = x86_64 ]]; then
13         DESTDIR=/mnt/tmp/x64/wimlib
14 else
15         echo "Unknown architecture $1" 1>&2
16         exit 2
17 fi
18
19 VERSION=$(grep 'This is wimlib version' README | grep -o '[0-9]\+\.[0-9]\+\.[0-9]')
20 ZIPFILE=wimlib-${VERSION}-windows-${WIMLIB_ARCH}-bin.zip
21
22 if ! grep -q "./configure --host=${WIMLIB_ARCH}-w64-mingw32" config.log; then
23         ./configure --host=${WIMLIB_ARCH}-w64-mingw32
24 fi
25
26 make -j2
27
28 rm -f $DESTDIR/{libwim-*.dll,doc/*,README*,NEWS*}
29
30 cp .libs/imagex.exe $DESTDIR/wimlib-imagex.exe
31 cp .libs/libwim-*.dll $DESTDIR
32 cp README* NEWS $DESTDIR
33
34
35
36 for fil in ./doc/wimlib-imagex-*.1; do
37         echo $fil
38         base=`basename $fil`
39         base=${base%%.1}
40         #MANWIDTH=80 man $fil | col -b > $DESTDIR/doc/$base
41         man -t $fil | ps2pdf - $DESTDIR/doc/${base}.pdf
42 done
43
44 #for fil in $DESTDIR/{README*,NEWS} $DESTDIR/doc/*; do
45 for fil in $DESTDIR/{README*,NEWS}; do
46         sed < $fil > ${fil}.txt -e 's/$/\r/g'
47         rm $fil
48 done
49
50
51 rm -f $ZIPFILE
52 (
53         dir=$PWD
54         cd $(dirname $DESTDIR) &> /dev/null
55         zip -r $dir/$ZIPFILE $(basename $DESTDIR)
56 )