aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdist-win.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/dist-win.sh b/dist-win.sh
new file mode 100755
index 0000000..fa5bdce
--- /dev/null
+++ b/dist-win.sh
@@ -0,0 +1,52 @@
1#!/bin/sh
2set -e
3set -x
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
24VERSION=`cat VERSION`
25DIST=libressl-$VERSION-$ARCH
26
27CC=$HOST-gcc ./configure --prefix=/ --host=$HOST --enable-libtls
28make clean
29make -j 4 install DESTDIR=`pwd`/tmp
30
31rm -fr $DIST
32mkdir $DIST
33
34cp -a tmp/lib $DIST
35cp -a tmp/include $DIST
36# massage the headers to remove things cl.exe cannot understand
37sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \
38 $DIST/include/openssl/*.h $DIST/include/*.h
39sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
40 $DIST/include/openssl/*.h $DIST/include/*.h
41sed -i -e "s/__attr.*;/;/" \
42 -e "s/sys\/time.h/winsock2.h/" \
43 $DIST/include/openssl/*.h $DIST/include/*.h
44cp tmp/bin/* $DIST/lib
45
46for i in libcrypto libssl libtls; do
47 echo EXPORTS > $i.def
48 mv $DIST/lib/$i*.dll $DIST/lib/$i.dll
49 dumpbin.exe /exports $DIST/lib/$i.dll | awk '{print $4}' | awk 'NF' |tail -n +9 >> $i.def
50 lib.exe /MACHINE:$ARCH /def:$i.def /out:$DIST/lib/$i.lib
51done
52zip -r $DIST.zip $DIST