add automated build script for windows

This script automatically downloads and
cross compiles all needed components for a W32 build
This commit is contained in:
Christian Hohnstaedt 2010-06-13 11:55:46 +02:00
parent da21e60242
commit 2fc2bf0182

105
misc/build-w32.sh Executable file
View File

@ -0,0 +1,105 @@
#!/bin/sh -e
ENGINE_DIR="engine_pkcs11-0.1.8"
ENGINE_GZ="${ENGINE_DIR}".tar.gz
ENGINE_DL="http://www.opensc-project.org/files/engine_pkcs11/${ENGINE_GZ}"
LIBP11_DIR="libp11-0.2.7"
LIBP11_GZ="${LIBP11_DIR}".tar.gz
LIBP11_DL="http://www.opensc-project.org/files/libp11/${LIBP11_GZ}"
OPENSC_DIR="opensc-0.11.13"
OPENSC_GZ="${OPENSC_DIR}".tar.gz
OPENSC_DL="http://www.opensc-project.org/files/opensc/${OPENSC_GZ}"
LIBTOOL_DIR="libtool-2.2.6b"
LIBTOOL_GZ="${LIBTOOL_DIR}".tar.gz
LIBTOOL_DL="http://ftp.gnu.org/gnu/libtool/${LIBTOOL_GZ}"
OPENSSL_DIR="openssl-1.0.0a"
OPENSSL_GZ="${OPENSSL_DIR}".tar.gz
OPENSSL_DL="http://openssl.org/source/${OPENSSL_GZ}"
XCA=xca
unpack() {
eval "dir=\${$1_DIR} gz=\${$1_GZ} dl=\${$1_DL}"
test -f "$gz" || curl "$dl" -o "$gz"
rm -rf "$dir"
echo "Building '$dir'"
tar -zxf "$gz"
cd "$dir"
}
if ! test -f db_dump.exe; then
if !curl "curl http://git.hohnstaedt.de/db_dump.exe" -o "db_dump.exe"; then
echo d_dump.exe missing
exit 1
fi
fi
if ! test -f mingwm10.dll; then
if ! zcat /usr/share/doc/mingw32-runtime/mingwm10.dll.gz >mingwm10.dll; then
echo missing mingwm10.dll
exit 1
fi
fi
export INSTALL_DIR=`pwd`/install
## OpenSSL
(
unpack OPENSSL
patch -p1 < ../"$XCA"/misc/openssl-1.0.0-mingw32-cross.patch
sh ms/mingw32-cross.sh
)
### Libtool
(
unpack LIBTOOL
./configure --host i586-mingw32msvc --prefix ${INSTALL_DIR}
make && make install
)
### Libp11
(
unpack LIBP11
CFLAGS=-I${INSTALL_DIR}/include LDFLAGS="-L${INSTALL_DIR}/lib" LTLIB_LIBS="-lltdl" OPENSSL_LIBS="-leay32" ./configure --host i586-mingw32msvc --prefix ${INSTALL_DIR}
make && make install
)
### Engine PKCS#11
(
unpack ENGINE
CFLAGS=-I${INSTALL_DIR}/include LDFLAGS=-L${INSTALL_DIR}/lib LIBP11_CFLAGS=${CFLAGS} OPENSSL_CFLAGS=${CFLAGS} LIBP11_LIBS="-lp11" OPENSSL_LIBS="-leay32" ./configure --host i586-mingw32msvc --prefix ${INSTALL_DIR}
make && make install
)
### OpenSC
(
unpack OPENSC
CFLAGS=-I${INSTALL_DIR}/include LDFLAGS=-L${INSTALL_DIR}/lib LIBP11_CFLAGS=${CFLAGS} OPENSSL_CFLAGS=${CFLAGS} LIBP11_LIBS="-lp11" OPENSSL_LIBS="-leay32" ./configure --host i586-mingw32msvc --prefix ${INSTALL_DIR} --enable-openssl \
--disable-zlib \
--disable-readline \
--disable-iconv \
--enable-openssl \
--disable-openct \
--enable-pcsc \
--disable-nsplugin \
--disable-man \
--disable-doc \
--with-cygwin-native \
--without-xsl-stylesheetsdir \
--without-plugindir \
--without-pinentry
make && make install
)
# XCA
(
cd $XCA
./configure.w32
USE_HOSTTOOLS=yes make -j5
make setup.exe
)