update windows binary build script

This puts the 32 and 64-bit binaries in the same zip file, adds debug
files that are compatible with Visual Studio/windbg, and updates for the
new configure options.
This commit is contained in:
Brent Cook 2015-02-24 19:42:26 -06:00
parent ab0d3e54a2
commit f94d3d671c

View File

@ -1,17 +1,15 @@
#!/bin/sh #!/bin/bash
set -e set -e
set -x set -x
# This script generates Windows binary distribution packages with Visual export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH
# Studio-compatible header and library files. VERSION=`cat VERSION`
DIST=libressl-$VERSION
# Visual Studio 2013 Community Edition and the mingw64 32-bit and 64-bit cross rm -fr $DIST
# compilers packaged with Cygwin are assumed to be installed. mkdir -p $DIST
ARCH=$1 for ARCH in X86 X64; do
if [ x$ARCH = x ]; then
ARCH=X86
fi
echo Building for $ARCH echo Building for $ARCH
if [ $ARCH=X86 ]; then if [ $ARCH=X86 ]; then
@ -20,24 +18,17 @@ else
HOST=x86_64-w64-mingw32 HOST=x86_64-w64-mingw32
fi fi
export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH CC=$HOST-gcc ./configure --host=$HOST \
VERSION=`cat VERSION` --enable-libtls --disable-shared
DIST=libressl-$VERSION-$ARCH
CC=$HOST-gcc \
CFLAGS="-Wl,--nxcompat -fstack-protector" \
LDFLAGS="-lssp -Wl,--dynamicbase,--export-all-symbols" \
./configure --prefix=/ --host=$HOST --enable-libtls
make clean make clean
make -j 4 install DESTDIR=`pwd`/tmp PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
make -j 4 check
make -j 4 install DESTDIR=`pwd`/stage-$ARCH
rm -fr $DIST mkdir -p $DIST/$ARCH
mkdir $DIST #cp -a stage-$ARCH/usr/local/lib/* $DIST/$ARCH
if [ ! -e $DIST/include ]; then
cp -a tmp/lib $DIST cp -a stage-$ARCH/usr/local/include $DIST
cp -a tmp/include $DIST
# massage the headers to remove things cl.exe cannot understand
sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \ sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \
$DIST/include/openssl/*.h $DIST/include/*.h $DIST/include/openssl/*.h $DIST/include/*.h
sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \ sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
@ -45,12 +36,19 @@ sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
sed -i -e "s/__attr.*;/;/" \ sed -i -e "s/__attr.*;/;/" \
-e "s/sys\/time.h/winsock2.h/" \ -e "s/sys\/time.h/winsock2.h/" \
$DIST/include/openssl/*.h $DIST/include/*.h $DIST/include/openssl/*.h $DIST/include/*.h
cp tmp/bin/* $DIST/lib fi
cp stage-$ARCH/usr/local/bin/* $DIST/$ARCH
#cp /usr/$HOST/sys-root/mingw/bin/libssp* $DIST/$ARCH
for i in libcrypto libssl libtls; do for i in libcrypto libssl libtls; do
echo EXPORTS > $i.def DLL=$(basename `ls -1 $DIST/$ARCH/$i*.dll`|cut -d. -f1)
mv $DIST/lib/$i*.dll $DIST/lib/$i.dll echo EXPORTS > $DLL.def
dumpbin.exe /exports $DIST/lib/$i.dll | awk '{print $4}' | awk 'NF' |tail -n +9 >> $i.def dumpbin /exports $DIST/$ARCH/$DLL.dll | \
lib.exe /MACHINE:$ARCH /def:$i.def /out:$DIST/lib/$i.lib awk '{print $4}' | awk 'NF' |tail -n +9 >> $DLL.def
lib /MACHINE:$ARCH /def:$DLL.def /out:$DIST/$ARCH/$DLL.lib
cv2pdb $DIST/$ARCH/$DLL.dll
done done
done
zip -r $DIST.zip $DIST zip -r $DIST.zip $DIST