aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2015-02-24 19:42:26 -0600
committerBrent Cook <bcook@openbsd.org>2015-02-24 19:42:26 -0600
commitf94d3d671ca01ef22d0f61f368f901fa96a9c5db (patch)
treee895ab22b373d3423217bc1ac3d2bd652b4a1b89
parentab0d3e54a221b8959582459bbd1ff6fd2f08f9f0 (diff)
downloadportable-f94d3d671ca01ef22d0f61f368f901fa96a9c5db.tar.gz
portable-f94d3d671ca01ef22d0f61f368f901fa96a9c5db.tar.bz2
portable-f94d3d671ca01ef22d0f61f368f901fa96a9c5db.zip
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.
-rwxr-xr-xdist-win.sh92
1 files changed, 45 insertions, 47 deletions
diff --git a/dist-win.sh b/dist-win.sh
index a3f008a..e45101a 100755
--- a/dist-win.sh
+++ b/dist-win.sh
@@ -1,56 +1,54 @@
1#!/bin/sh 1#!/bin/bash
2set -e 2set -e
3set -x 3set -x
4 4
5# This script generates Windows binary distribution packages with Visual
6# Studio-compatible header and library files.
7
8# Visual Studio 2013 Community Edition and the mingw64 32-bit and 64-bit cross
9# compilers packaged with Cygwin are assumed to be installed.
10
11ARCH=$1
12if [ x$ARCH = x ]; then
13 ARCH=X86
14fi
15echo Building for $ARCH
16
17if [ $ARCH=X86 ]; then
18 HOST=i686-w64-mingw32
19else
20 HOST=x86_64-w64-mingw32
21fi
22
23export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH 5export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH
24VERSION=`cat VERSION` 6VERSION=`cat VERSION`
25DIST=libressl-$VERSION-$ARCH 7DIST=libressl-$VERSION
26
27CC=$HOST-gcc \
28CFLAGS="-Wl,--nxcompat -fstack-protector" \
29LDFLAGS="-lssp -Wl,--dynamicbase,--export-all-symbols" \
30./configure --prefix=/ --host=$HOST --enable-libtls
31
32make clean
33make -j 4 install DESTDIR=`pwd`/tmp
34 8
35rm -fr $DIST 9rm -fr $DIST
36mkdir $DIST 10mkdir -p $DIST
37 11
38cp -a tmp/lib $DIST 12for ARCH in X86 X64; do
39cp -a tmp/include $DIST 13 echo Building for $ARCH
40# massage the headers to remove things cl.exe cannot understand 14
41sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \ 15 if [ $ARCH=X86 ]; then
42 $DIST/include/openssl/*.h $DIST/include/*.h 16 HOST=i686-w64-mingw32
43sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \ 17 else
44 $DIST/include/openssl/*.h $DIST/include/*.h 18 HOST=x86_64-w64-mingw32
45sed -i -e "s/__attr.*;/;/" \ 19 fi
46 -e "s/sys\/time.h/winsock2.h/" \ 20
47 $DIST/include/openssl/*.h $DIST/include/*.h 21 CC=$HOST-gcc ./configure --host=$HOST \
48cp tmp/bin/* $DIST/lib 22 --enable-libtls --disable-shared
49 23 make clean
50for i in libcrypto libssl libtls; do 24 PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
51 echo EXPORTS > $i.def 25 make -j 4 check
52 mv $DIST/lib/$i*.dll $DIST/lib/$i.dll 26 make -j 4 install DESTDIR=`pwd`/stage-$ARCH
53 dumpbin.exe /exports $DIST/lib/$i.dll | awk '{print $4}' | awk 'NF' |tail -n +9 >> $i.def 27
54 lib.exe /MACHINE:$ARCH /def:$i.def /out:$DIST/lib/$i.lib 28 mkdir -p $DIST/$ARCH
29 #cp -a stage-$ARCH/usr/local/lib/* $DIST/$ARCH
30 if [ ! -e $DIST/include ]; then
31 cp -a stage-$ARCH/usr/local/include $DIST
32 sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \
33 $DIST/include/openssl/*.h $DIST/include/*.h
34 sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
35 $DIST/include/openssl/*.h $DIST/include/*.h
36 sed -i -e "s/__attr.*;/;/" \
37 -e "s/sys\/time.h/winsock2.h/" \
38 $DIST/include/openssl/*.h $DIST/include/*.h
39 fi
40
41 cp stage-$ARCH/usr/local/bin/* $DIST/$ARCH
42 #cp /usr/$HOST/sys-root/mingw/bin/libssp* $DIST/$ARCH
43
44 for i in libcrypto libssl libtls; do
45 DLL=$(basename `ls -1 $DIST/$ARCH/$i*.dll`|cut -d. -f1)
46 echo EXPORTS > $DLL.def
47 dumpbin /exports $DIST/$ARCH/$DLL.dll | \
48 awk '{print $4}' | awk 'NF' |tail -n +9 >> $DLL.def
49 lib /MACHINE:$ARCH /def:$DLL.def /out:$DIST/$ARCH/$DLL.lib
50 cv2pdb $DIST/$ARCH/$DLL.dll
51 done
55done 52done
53
56zip -r $DIST.zip $DIST 54zip -r $DIST.zip $DIST