]> wimlib.net Git - wimlib/blobdiff - tools/make-windows-release
configure.ac: generate version number from git commit and tags
[wimlib] / tools / make-windows-release
index ee9790db510b767acd534e553b88c8edf413e2e9..5f5da584d9e9ad536fce974e5dcc97e0e33ff4c8 100755 (executable)
@@ -10,8 +10,8 @@ if [ ! -e src/wim.c ]; then
        exit 1
 fi
 
-if [ $# -ne 1 ]; then
-       echo "Usage: $0 i686|x86_64" 1>&2
+if [ $# -lt 1 ]; then
+       echo "Usage: $0 i686|x86_64 [EXTRA_CONFIGURE_ARG]..." 1>&2
        exit 1
 fi
 
@@ -27,8 +27,7 @@ i686|x86_64)
        ;;
 esac
 
-VERSION=$(grep 'This is wimlib version' README | \
-         grep -o '\<[0-9]\+\.[0-9]\+\.[0-9]\+\(-BETA\)\?\>')
+VERSION=$(tools/get-version-number)
 DESTDIR=wimlib-${VERSION}-windows-${ARCH}-bin
 ZIPFILE=wimlib-${VERSION}-windows-${ARCH}-bin.zip
 MAKE="make -j $(grep -c processor /proc/cpuinfo)"
@@ -43,17 +42,29 @@ fi
 
 # Compile wimlib
 
-if ! grep -q "./configure --host=${ARCH}-w64-mingw32" config.log || \
-       ! grep -q "configure: exit 0" config.log
+if ! [ -e config.log ] ||
+       ! grep -q "./configure --host=${ARCH}-w64-mingw32" config.log || \
+       ! grep -q "configure: exit 0" config.log || \
+       [ $# -gt 0 ]
 then
+       extra_args=
+       if [ $ARCH = x86_64 ]; then
+               extra_args="--enable-ssse3-sha1"
+       fi
        # Note: putting -static-libgcc in CC is a workaround for libtool
        # stripping it:
        # http://www.gnu.org/software/libtool/manual/libtool.html#Stripped-link-flags
+       #
+       # We also need to override the MinGW pkg-config with the "native" one in
+       # order for it to correctly restrict the include path to our $SYSROOT.
        ./configure --host=${ARCH}-w64-mingw32 --disable-static         \
                CC="${ARCH}-w64-mingw32-gcc -static-libgcc"             \
-               CFLAGS="-O2 -Wall"                                      \
-               CPPFLAGS="-I$SYSROOT/include -I$SYSROOT/include/libxml2"\
-               LDFLAGS="-L$SYSROOT/lib"
+               CPPFLAGS="-I$SYSROOT/include"                           \
+               LDFLAGS="-L$SYSROOT/lib"                                \
+               PKG_CONFIG=pkg-config                                   \
+               PKG_CONFIG_LIBDIR="$SYSROOT/lib/pkgconfig"              \
+               --without-libcrypto                                     \
+               $extra_args "$@"
        $MAKE clean
 fi
 $MAKE
@@ -72,6 +83,12 @@ ${ARCH}-w64-mingw32-strip $DESTDIR/*.{dll,exe}
 
 cp NEWS README* COPYING* $DESTDIR
 cp $WINDEPDIR/COPYING* $DESTDIR
+
+sed -n '/^#/q; s/^[\/\* ]*//; p' src/divsufsort.c > $DESTDIR/COPYING.libdivsufsort-lite
+if ! grep -q 'Copyright' $DESTDIR/COPYING.libdivsufsort-lite; then
+       echo "ERROR: failed to extract libdivsufsort-lite license text" 1>&2
+       exit 1
+fi
 (
        cd $DESTDIR
        for fil in NEWS README* COPYING*; do
@@ -94,25 +111,32 @@ function gen_pdf_from_man_page() {
        MANPATH="./doc" man -t $manbase | ps2pdf - $pdf
 }
 
-for fil in ./doc/man1/wimlib-imagex-*.1; do
+for fil in ./doc/man1/wim*.1; do
        manbase=`basename $fil`
-       manbase=${manbase%%.1}
-       cmd=$(echo $manbase | sed s/wimlib-imagex-//)
-       if [ $cmd == mount -o $cmd == mountrw -o $cmd == unmount ]; then
+       cmd=${manbase%.1}
+       case $cmd in
+       wimlib-imagex|wimmount|wimmountrw|wimunmount)
                continue
-       fi
+               ;;
+       esac
 
-       gen_pdf_from_man_page $manbase
+       gen_pdf_from_man_page $cmd
 
-       sed 's/$/\r/g' > ${DESTDIR}/wim${cmd}.cmd <<- EOF
+       sed 's/$/\r/g' > ${DESTDIR}/${cmd}.cmd <<- EOF
                @echo off
-               %~dp0\\wimlib-imagex $cmd %*
+               "%~dp0\\wimlib-imagex" ${cmd#wim} %*
        EOF
-       chmod +x ${DESTDIR}/wim${cmd}.cmd
+       chmod +x ${DESTDIR}/${cmd}.cmd
 done
 
 gen_pdf_from_man_page wimlib-imagex
 
+# Install development files
+
+mkdir $DESTDIR/devel
+cp .libs/libwim.dll.a $DESTDIR/devel/libwim.lib
+cp include/wimlib.h $DESTDIR/devel/
+
 # Generate ZIP file
 
 rm -f $ZIPFILE