finish_write(): Fix comment
[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*,wim*.bat,wim*.cmd}
29
30 cp .libs/imagex.exe $DESTDIR/wimlib-imagex.exe
31 cp .libs/libwim-*.dll $DESTDIR
32 cp README* NEWS $DESTDIR
33
34 for fil in ./doc/wimlib-imagex-*.1; do
35         base=`basename $fil`
36         base=${base%%.1}
37         cmd=$(echo $base | sed s/wimlib-imagex-//)
38         if [ $cmd == mount -o $cmd == mountrw -o $cmd == unmount ]; then
39                 continue
40         fi
41
42         echo $fil
43         #MANWIDTH=80 man $fil | col -b > $DESTDIR/doc/$base
44         man -t $fil | ps2pdf - $DESTDIR/doc/${base}.pdf
45         sed 's/$/\r/g' > $DESTDIR/wim${cmd}.cmd <<- EOF
46                 @echo off
47                 %~dp0\\wimlib-imagex $cmd %*
48         EOF
49 done
50
51 #for fil in $DESTDIR/{README*,NEWS} $DESTDIR/doc/*; do
52 for fil in $DESTDIR/{README*,NEWS}; do
53         sed < $fil > ${fil}.txt -e 's/$/\r/g'
54         rm $fil
55 done
56
57 ${WIMLIB_ARCH}-w64-mingw32-strip $DESTDIR/*.{dll,exe}
58
59 rm -f $ZIPFILE
60 (
61         dir=$PWD
62         cd $DESTDIR
63         zip -r $dir/$ZIPFILE .
64 )