diff options
| author | Brent Cook <bcook@openbsd.org> | 2015-02-24 19:42:26 -0600 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2015-02-24 19:42:26 -0600 |
| commit | f94d3d671ca01ef22d0f61f368f901fa96a9c5db (patch) | |
| tree | e895ab22b373d3423217bc1ac3d2bd652b4a1b89 | |
| parent | ab0d3e54a221b8959582459bbd1ff6fd2f08f9f0 (diff) | |
| download | portable-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-x | dist-win.sh | 92 |
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 |
| 2 | set -e | 2 | set -e |
| 3 | set -x | 3 | set -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 | |||
| 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 | 5 | export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH |
| 24 | VERSION=`cat VERSION` | 6 | VERSION=`cat VERSION` |
| 25 | DIST=libressl-$VERSION-$ARCH | 7 | DIST=libressl-$VERSION |
| 26 | |||
| 27 | CC=$HOST-gcc \ | ||
| 28 | CFLAGS="-Wl,--nxcompat -fstack-protector" \ | ||
| 29 | LDFLAGS="-lssp -Wl,--dynamicbase,--export-all-symbols" \ | ||
| 30 | ./configure --prefix=/ --host=$HOST --enable-libtls | ||
| 31 | |||
| 32 | make clean | ||
| 33 | make -j 4 install DESTDIR=`pwd`/tmp | ||
| 34 | 8 | ||
| 35 | rm -fr $DIST | 9 | rm -fr $DIST |
| 36 | mkdir $DIST | 10 | mkdir -p $DIST |
| 37 | 11 | ||
| 38 | cp -a tmp/lib $DIST | 12 | for ARCH in X86 X64; do |
| 39 | cp -a tmp/include $DIST | 13 | echo Building for $ARCH |
| 40 | # massage the headers to remove things cl.exe cannot understand | 14 | |
| 41 | sed -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 |
| 43 | sed -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 |
| 45 | sed -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 \ |
| 48 | cp tmp/bin/* $DIST/lib | 22 | --enable-libtls --disable-shared |
| 49 | 23 | make clean | |
| 50 | for 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 | ||
| 55 | done | 52 | done |
| 53 | |||
| 56 | zip -r $DIST.zip $DIST | 54 | zip -r $DIST.zip $DIST |
