diff options
author | yaworsky <yaworsky> | 2005-09-16 08:33:41 +0000 |
---|---|---|
committer | yaworsky <yaworsky> | 2005-09-16 08:33:41 +0000 |
commit | a2c534419863b2c09fd122d8d1ef6769398f7cf0 (patch) | |
tree | c58907db78a04c9d4fae9999651e1a7293cf38f1 /extras | |
parent | 7875bee3ddfd14f2128540609519306742a78dec (diff) | |
download | syslog-win32-a2c534419863b2c09fd122d8d1ef6769398f7cf0.tar.gz syslog-win32-a2c534419863b2c09fd122d8d1ef6769398f7cf0.tar.xz syslog-win32-a2c534419863b2c09fd122d8d1ef6769398f7cf0.zip |
Added to repository.
Diffstat (limited to 'extras')
-rwxr-xr-x | extras/cross-compile-libs | 214 | ||||
-rw-r--r-- | extras/glib-static-win32.patch | 21 |
2 files changed, 235 insertions, 0 deletions
diff --git a/extras/cross-compile-libs b/extras/cross-compile-libs new file mode 100755 index 0000000..984c597 --- /dev/null +++ b/extras/cross-compile-libs @@ -0,0 +1,214 @@ +#!/bin/bash +# +# cross-compile win32 libraries for syslog-win32 +# on exit libraries are in cross-libs directory +# +# required environment variables: DISTFILES +# honoured environment variables: CFLAGS, HOST +# + +# +# define distfiles +# +libiconv=libiconv-1.9.2.tar.gz +gettext=gettext-0.14.1.tar.gz +zlib=zlib-1.2.2.tar.bz2 +regex=regex-0.12.tar.gz +glib=glib-2.6.3.tar.bz2 + +function distfiles() +{ + echo $libiconv + echo $gettext + echo $zlib + echo $regex + echo $glib +} + +# +# check DISTFILES and distfiles +# +if [ -z "$DISTFILES" ] ; then + echo "You should specify location of source tarballs with the help of DISTFILES environment variable" + exit 1 +fi + +for file in `distfiles` ; do + if [ -f "$DISTFILES"/$file ] ; then continue ; fi + echo $file not found + exit 1 +done + +# +# set environment variables if not set yet +# +if [ -z "$CFLAGS" ] ; then + export CFLAGS="-Os -g" +fi + +if [ -z "$HOST" ] ; then + export HOST=i686-pc-mingw32 +fi + +# +# a wrapper for subsequent commands +# +function run() +{ + echo "$@" + "$@" || exit 1 +} + +# +# unpack routine +# +function unpack_tarball() +{ + if [[ zip == ${1:(-3)} ]] ; then + run unzip "$1" + else + if [[ bz2 == ${1:(-3)} ]] ; then arch=j + elif [[ gz == ${1:(-2)} ]] ; then arch=z + elif [[ tar == ${1:(-3)} ]] ; then arch= + else + echo "Unknown distfile type" + exit 1 + fi + run tar -x${arch}f "$1" + fi +} + +# +# create build directories +# +export PREFIX=`pwd`/cross-libs +run mkdir -p cross-libs +run mkdir -p cross-build +run pushd cross-build + +# +# build libiconv +# +unpack_tarball "$DISTFILES"/$libiconv +run pushd libiconv* +run ./configure --prefix="$PREFIX" --host=$HOST --disable-nls +run make +run make install +run popd +run rm -Rf libiconv* + +# +# build gettext +# +unpack_tarball "$DISTFILES"/$gettext +run pushd gettext*/gettext-runtime +CPPFLAGS=-I"$PREFIX"/include LDFLAGS=-L"$PREFIX"/lib \ +run ./configure --prefix="$PREFIX" --host=$HOST --enable-relocatable --with-libiconv-prefix="$PREFIX" +run make +run make install +run popd +run rm -Rf gettext* + +# +# build zlib +# TO DO: use original makefile; dllname must be like in official windoze distro +# +unpack_tarball "$DISTFILES"/$zlib +run pushd zlib* +cat >configure.ac <<EOF +AC_INIT(zlib,1.2.2) +AM_INIT_AUTOMAKE +AC_CANONICAL_HOST +AC_PROG_CC +AC_PROG_LIBTOOL +AC_OUTPUT(Makefile) +EOF +cat >Makefile.am <<EOF +lib_LTLIBRARIES = libz.la +libz_la_SOURCES = adler32.c compress.c crc32.c deflate.c gzio.c \ + infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c +include_HEADERS = zlib.h +libz_la_LDFLAGS = -no-undefined -release 1 +EOF +run aclocal +run libtoolize +run autoconf +run automake --foreign --add-missing +run ./configure --prefix="$PREFIX" --host=$HOST +run make +run make install +run popd +run rm -Rf zlib* + +# +# build regex +# NOT NEEDED +# +unpack_tarball "$DISTFILES"/$regex +run pushd regex* +cat >configure.ac <<EOF +AC_INIT(regex,0.12) +AM_INIT_AUTOMAKE +AC_CANONICAL_HOST +AC_PROG_CC +AC_PROG_LIBTOOL +AC_OUTPUT(Makefile) +EOF +cat >Makefile.am <<EOF +lib_LTLIBRARIES = libregex.la +libregex_la_SOURCES = regex.c +include_HEADERS = regex.h +libregex_la_LDFLAGS = -no-undefined +EOF +run rm -f configure.in +run aclocal +run libtoolize +run autoconf +run automake --foreign --add-missing +run ./configure --prefix="$PREFIX" --host=$HOST +run make +run make install +run popd +run rm -Rf regex* + +# +# build glib +# +unpack_tarball "$DISTFILES"/$glib +run pushd glib* +# +# according to glib documentation, win32.cache is needed to skip tests that cannot be run in cross-compile environment +# +cat >win32.cache <<EOF +glib_cv_long_long_format=I64 +glib_cv_stack_grows=no +EOF +run chmod a-w win32.cache +# +# remove policy that does not allow us to build static library for win32 +# +run patch -Np1 -i ../../glib-static-win32.patch +run aclocal --force +run libtoolize --force +run autoconf --force +run automake --foreign --add-missing --force +OBJDUMP=$HOST-objdump CFLAGS='-Os -g' \ +CPPFLAGS=-I"$PREFIX"/include \ +LDFLAGS=-L"$PREFIX"/lib \ +run ./configure --prefix="$PREFIX" --host=$HOST --with-libintl --disable-gtk-doc --cache-file=win32.cache --enable-static +WINDRES=$HOST-windres run make +run make install +run popd +run rm -Rf glib* +# +# explanations: +# - setting OBJDUMP is required for libtool's file format checking +# - WINDRES is required for resource compiling +# + +# +# strip libraries and cleanup +# +run popd +$HOST-strip -s cross-libs/bin/* +run rmdir cross-build diff --git a/extras/glib-static-win32.patch b/extras/glib-static-win32.patch new file mode 100644 index 0000000..46f0aba --- /dev/null +++ b/extras/glib-static-win32.patch @@ -0,0 +1,21 @@ +diff -urN glib-2.6.3-orig/configure.in glib-2.6.3/configure.in +--- glib-2.6.3-orig/configure.in 2005-02-24 10:23:02.000000000 +0600 ++++ glib-2.6.3/configure.in 2005-07-08 19:37:53.000000000 +0700 +@@ -245,17 +245,6 @@ + AC_MSG_RESULT([yes]) + fi + +-if test "$glib_native_win32" = "yes"; then +- if test x$enable_static = xyes -o x$enable_static = x; then +- AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.]) +- enable_static=no +- fi +- if test x$enable_shared = xno; then +- AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.]) +- fi +- enable_shared=yes +-fi +- + dnl Checks for programs. + AC_PROG_CC + |