diff options
| author | Brent Cook <bcook@openbsd.org> | 2015-02-19 21:23:31 -0600 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2015-02-19 21:23:31 -0600 |
| commit | 7ba784891d6dad8335fa916450bb4c5a6eb83937 (patch) | |
| tree | 019245e48272f7108b0ae37c681b0602e8a32103 | |
| parent | 49d80f0e8924cfa1df89bfddad0385c20843af1d (diff) | |
| download | portable-7ba784891d6dad8335fa916450bb4c5a6eb83937.tar.gz portable-7ba784891d6dad8335fa916450bb4c5a6eb83937.tar.bz2 portable-7ba784891d6dad8335fa916450bb4c5a6eb83937.zip | |
add script for building windows binary distribution packages
| -rwxr-xr-x | dist-win.sh | 52 |
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 | ||
| 2 | set -e | ||
| 3 | set -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 | |||
| 11 | ARCH=$1 | ||
| 12 | if [ x$ARCH = x ]; then | ||
| 13 | ARCH=X86 | ||
| 14 | fi | ||
| 15 | echo Building for $ARCH | ||
| 16 | |||
| 17 | if [ $ARCH=X86 ]; then | ||
| 18 | HOST=i686-w64-mingw32 | ||
| 19 | else | ||
| 20 | HOST=x86_64-w64-mingw32 | ||
| 21 | fi | ||
| 22 | |||
| 23 | export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH | ||
| 24 | VERSION=`cat VERSION` | ||
| 25 | DIST=libressl-$VERSION-$ARCH | ||
| 26 | |||
| 27 | CC=$HOST-gcc ./configure --prefix=/ --host=$HOST --enable-libtls | ||
| 28 | make clean | ||
| 29 | make -j 4 install DESTDIR=`pwd`/tmp | ||
| 30 | |||
| 31 | rm -fr $DIST | ||
| 32 | mkdir $DIST | ||
| 33 | |||
| 34 | cp -a tmp/lib $DIST | ||
| 35 | cp -a tmp/include $DIST | ||
| 36 | # massage the headers to remove things cl.exe cannot understand | ||
| 37 | sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \ | ||
| 38 | $DIST/include/openssl/*.h $DIST/include/*.h | ||
| 39 | sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \ | ||
| 40 | $DIST/include/openssl/*.h $DIST/include/*.h | ||
| 41 | sed -i -e "s/__attr.*;/;/" \ | ||
| 42 | -e "s/sys\/time.h/winsock2.h/" \ | ||
| 43 | $DIST/include/openssl/*.h $DIST/include/*.h | ||
| 44 | cp tmp/bin/* $DIST/lib | ||
| 45 | |||
| 46 | for 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 | ||
| 51 | done | ||
| 52 | zip -r $DIST.zip $DIST | ||
