2015-02-25 02:42:26 +01:00
|
|
|
#!/bin/bash
|
2015-02-20 04:23:31 +01:00
|
|
|
set -e
|
2015-03-01 12:34:43 +01:00
|
|
|
#set -x
|
2015-02-20 04:23:31 +01:00
|
|
|
|
|
|
|
export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH
|
|
|
|
VERSION=`cat VERSION`
|
2015-03-03 06:17:48 +01:00
|
|
|
DIST=libressl-$VERSION-windows
|
2015-02-20 04:23:31 +01:00
|
|
|
|
|
|
|
rm -fr $DIST
|
2015-02-25 02:42:26 +01:00
|
|
|
mkdir -p $DIST
|
2015-03-07 19:04:29 +01:00
|
|
|
autoreconf -i
|
2015-02-25 02:42:26 +01:00
|
|
|
|
|
|
|
for ARCH in X86 X64; do
|
|
|
|
|
2015-03-01 12:34:43 +01:00
|
|
|
if [ $ARCH = X86 ]; then
|
2015-02-25 02:42:26 +01:00
|
|
|
HOST=i686-w64-mingw32
|
2015-03-01 12:34:43 +01:00
|
|
|
ARCHDIR=x86
|
2015-02-25 02:42:26 +01:00
|
|
|
else
|
|
|
|
HOST=x86_64-w64-mingw32
|
2015-03-01 12:34:43 +01:00
|
|
|
ARCHDIR=x64
|
2015-02-25 02:42:26 +01:00
|
|
|
fi
|
|
|
|
|
2015-03-01 12:34:43 +01:00
|
|
|
echo Building for $HOST
|
|
|
|
|
|
|
|
CC=$HOST-gcc ./configure --host=$HOST --enable-libtls
|
2015-02-25 02:42:26 +01:00
|
|
|
make clean
|
|
|
|
PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
|
|
|
|
make -j 4 check
|
2015-03-01 12:34:43 +01:00
|
|
|
make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR
|
2015-02-25 02:42:26 +01:00
|
|
|
|
2015-03-01 12:34:43 +01:00
|
|
|
mkdir -p $DIST/$ARCHDIR
|
|
|
|
#cp -a stage-$ARCHDIR/usr/local/lib/* $DIST/$ARCHDIR
|
2015-02-25 02:42:26 +01:00
|
|
|
if [ ! -e $DIST/include ]; then
|
2015-03-01 12:34:43 +01:00
|
|
|
cp -a stage-$ARCHDIR/usr/local/include $DIST
|
2015-02-25 02:42:26 +01:00
|
|
|
sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \
|
|
|
|
$DIST/include/openssl/*.h $DIST/include/*.h
|
|
|
|
sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
|
|
|
|
$DIST/include/openssl/*.h $DIST/include/*.h
|
|
|
|
sed -i -e "s/__attr.*;/;/" \
|
|
|
|
-e "s/sys\/time.h/winsock2.h/" \
|
|
|
|
$DIST/include/openssl/*.h $DIST/include/*.h
|
|
|
|
fi
|
|
|
|
|
2015-03-01 12:34:43 +01:00
|
|
|
cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR
|
|
|
|
#cp /usr/$HOST/sys-root/mingw/bin/libssp* $DIST/$ARCHDIR
|
2015-02-25 02:42:26 +01:00
|
|
|
|
|
|
|
for i in libcrypto libssl libtls; do
|
2015-03-01 12:34:43 +01:00
|
|
|
DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1)
|
2015-02-25 02:42:26 +01:00
|
|
|
echo EXPORTS > $DLL.def
|
2015-03-01 12:34:43 +01:00
|
|
|
dumpbin /exports $DIST/$ARCHDIR/$DLL.dll | \
|
2015-02-25 02:42:26 +01:00
|
|
|
awk '{print $4}' | awk 'NF' |tail -n +9 >> $DLL.def
|
2015-03-01 12:34:43 +01:00
|
|
|
lib /MACHINE:$ARCH /def:$DLL.def /out:$DIST/$ARCHDIR/$DLL.lib
|
|
|
|
cv2pdb $DIST/$ARCHDIR/$DLL.dll
|
2015-02-25 02:42:26 +01:00
|
|
|
done
|
2015-02-20 04:23:31 +01:00
|
|
|
done
|
2015-02-25 02:42:26 +01:00
|
|
|
|
2015-02-20 04:23:31 +01:00
|
|
|
zip -r $DIST.zip $DIST
|