[Zlib-devel] Cross compiling zlib
Enrico Weigelt
weigelt at metux.de
Fri May 11 14:05:13 EDT 2007
* Alberto Ruiz <aruiz at gnome.org> schrieb:
Hi folks,
> I've found that the ARFLAGS are set in the AR variable of
> the Makefile, this flags are incompatible with the mingw32's
> ar, so I've patched it to perform a succesful build. Basically
> the patch adds an ARFLAG variable to split the command and
> the flag arguments.
hmmpf. seems, my crosscompile-fix patch is still not applied :(
I've attached all my current zlib patches (from oss-qm).
cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service - http://www.metux.de/
---------------------------------------------------------------------
Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
---------------------------------------------------------------------
-------------- next part --------------
#
# Submitted-By: Enrico Weigelt <weigelt at metux.de> 2007-03-14
# Committed-By: Enrico Weigelt <weigelt at metux.de> 2007-03-14
#
# Error:
#
# Calls to ar are broken for crosscompile situations:
# If you pass your toolchain's ar command via the $AR variable,
# the options are missing. (our you have to add " rc", too ;-o)
#
# Description:
#
# We introduce an new variable $AR_CMD, which is set upon $AR
# by adding the "rc" option and use it instead of $AR
#
# State:
#
# Upstream should have been notified quite some time ago
# (have to look at the maillist archive)
#
diff -ruN zlib-1.2.3.orig/configure zlib-1.2.3/configure
--- zlib-1.2.3.orig/configure 2007-03-14 15:09:19.000000000 +0100
+++ zlib-1.2.3/configure 2007-03-14 15:27:59.000000000 +0100
@@ -23,7 +23,8 @@
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
-AR=${AR-"ar rc"}
+AR=${AR-"ar"}
+AR_CMD="$AR rc"
RANLIB=${RANLIB-"ranlib"}
prefix=${prefix-/usr/local}
exec_prefix=${exec_prefix-'${prefix}'}
@@ -128,7 +129,7 @@
CFLAGS=${CFLAGS-"-4 -O"}
LDSHARED=${LDSHARED-"cc"}
RANLIB=${RANLIB-"true"}
- AR="cc -A";;
+ AR_CMD="cc -A";;
SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
CFLAGS=${CFLAGS-"-O3"}
LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
@@ -447,7 +448,7 @@
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
-/^AR *=/s#=.*#=$AR#
+/^AR *=/s#=.*#=$AR_CMD#
/^RANLIB *=/s#=.*#=$RANLIB#
/^EXE *=/s#=.*#=$EXE#
/^prefix *=/s#=.*#=$prefix#
-------------- next part --------------
#
# Submitted-By: Enrico Weigelt <weigelt at metux.de>, 2007-03-12
# Committed-By: Enrico Weigelt <weigelt at metux.de>, 2007-03-12
#
# Error:
#
# Parameters to ./configure for setting install locations are
# very non-standard.
#
# Description:
#
# This patch adds several gnu-standard configure options
# as aliases to the existing ones.
#
# State:
#
# Have to check the maillist.
#
diff -ruN zlib-1.2.3.orig/configure zlib-1.2.3/configure
--- zlib-1.2.3.orig/configure 2007-03-14 15:09:19.000000000 +0100
+++ zlib-1.2.3/configure 2007-03-14 15:42:43.000000000 +0100
@@ -44,15 +44,13 @@
echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]'
echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
exit 0;;
- -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
- -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
- -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
- -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
- -p* | --p*) prefix="$2"; shift; shift;;
- -e* | --e*) exec_prefix="$2"; shift; shift;;
- -l* | --l*) libdir="$2"; shift; shift;;
- -i* | --i*) includedir="$2"; shift; shift;;
- -s* | --s*) shared=1; shift;;
+ --prefix=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+ --eprefix=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+ --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+ --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
+ --sysconfdir=*) echo "--sysconfdir parameter ignore" ; shift ;;
+ --localstatedir=*) echo "--localstatedir parameter ignore" ; shift ;;
+ --shared | --enable-shared) shared=1; shift;;
*) echo "unknown option: $1"; echo "$0 --help for help"; exit 1;;
esac
done
-------------- next part --------------
#
# Submitted-By: Enrico Weigelt <weigelt at metux.de>, 2007-03-12
# Committed-By: Enrico Weigelt <weigelt at metux.de>, 2007-03-12
#
# Error:
#
# Passing an install prefix via environment not yet possible
# and we don't have an .pc file (for pkg-config)
#
# Description:
#
# a) We're simply adding $(DESTDIR) as prefix to all install locations.
# b) We add creation and install of zlib.pc
#
# Yeah, we shouldn't do two separate fixes in one patch, but
# these two interfered when tried separate patches.
#
# State:
#
# Upstream should have been notified for quite a long time.
# Should check the maillist for what happened meanwhile.
#
diff -ruN zlib-1.2.3.orig/Makefile.in zlib-1.2.3/Makefile.in
--- zlib-1.2.3.orig/Makefile.in 2007-03-14 15:09:20.000000000 +0100
+++ zlib-1.2.3/Makefile.in 2007-03-14 16:02:14.000000000 +0100
@@ -45,6 +45,7 @@
includedir = ${prefix}/include
mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
+pkgconfigdir = ${libdir}/pkgconfig
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infback.o inftrees.o inffast.o
@@ -90,33 +91,35 @@
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
install: $(LIBS)
- - at if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
- - at if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
- - at if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
- - at if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
- cp zlib.h zconf.h $(includedir)
- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
- cp $(LIBS) $(libdir)
- cd $(libdir); chmod 755 $(LIBS)
- -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
- cd $(libdir); if test -f $(SHAREDLIBV); then \
+ mkdir -p $(DESTDIR)$(exec_prefix)
+ mkdir -p $(DESTDIR)$(includedir)
+ mkdir -p $(DESTDIR)$(libdir)
+ mkdir -p $(DESTDIR)$(man3dir)
+ cp zlib.h zconf.h $(DESTDIR)$(includedir)
+ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
+ cp $(LIBS) $(DESTDIR)$(libdir)
+ cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
+ -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+ cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
(ldconfig || true) >/dev/null 2>&1; \
fi
- cp zlib.3 $(man3dir)
- chmod 644 $(man3dir)/zlib.3
+ cp zlib.3 $(DESTDIR)$(man3dir)
+ chmod 644 $(DESTDIR)$(man3dir)/zlib.3
+ mkdir -p $(DESTDIR)$(pkgconfigdir)
+ cp zlib.pc $(DESTDIR)$(pkgconfigdir)
# The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux
uninstall:
- cd $(includedir); \
- cd $(libdir); rm -f libz.a; \
+ cd $(DESTDIR)$(includedir); \
+ cd $(DESTDIR)$(libdir); rm -f libz.a; \
if test -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
fi
- cd $(man3dir); rm -f zlib.3
+ cd $(DESTDIR)$(man3dir) && rm -f zlib.3
mostlyclean: clean
clean:
diff -ruN zlib-1.2.3.orig/configure zlib-1.2.3/configure
--- zlib-1.2.3.orig/configure 2007-03-14 15:09:19.000000000 +0100
+++ zlib-1.2.3/configure 2007-03-14 16:02:14.000000000 +0100
@@ -457,3 +457,25 @@
/^mandir *=/s#=.*#=$mandir#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
" > Makefile
+
+sed < zlib.pc.in "
+/^CC *=/s#=.*#=$CC#
+/^CFLAGS *=/s#=.*#=$CFLAGS#
+/^CPP *=/s#=.*#=$CPP#
+/^LDSHARED *=/s#=.*#=$LDSHARED#
+/^LIBS *=/s#=.*#=$LIBS#
+/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
+/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
+/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
+/^AR *=/s#=.*#=$AR_CMD#
+/^RANLIB *=/s#=.*#=$RANLIB#
+/^EXE *=/s#=.*#=$EXE#
+/^prefix *=/s#=.*#=$prefix#
+/^exec_prefix *=/s#=.*#=$exec_prefix#
+/^libdir *=/s#=.*#=$libdir#
+/^includedir *=/s#=.*#=$includedir#
+/^mandir *=/s#=.*#=$mandir#
+/^LDFLAGS *=/s#=.*#=$LDFLAGS#
+" | sed -e "
+s/\@VERSION\@/$VER/g;
+" > zlib.pc
diff -ruN zlib-1.2.3.orig/zlib.pc.in zlib-1.2.3/zlib.pc.in
--- zlib-1.2.3.orig/zlib.pc.in 1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.3/zlib.pc.in 2007-03-14 16:02:14.000000000 +0100
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: zlib
+Description: zlib compression library
+Version: @VERSION@
+
+Requires:
+Libs: -L${libdir} -lz
+Cflags: -I${includedir}
-------------- next part --------------
#
# Submitted-By: Enrico Weigelt <weigelt at metux.de> 2007-03-16
# Committed-By: Enrico Weigelt <weigelt at metux.de> 2007-03-16
#
# Error:
#
# Current buildsystem can only build either static or
# dynamic library.
#
# Description:
#
# At the point where shared libs enabled, we add the sharedlib
# to the to-build list, instead of overwriting that.
#
# State:
#
# Not notified yet
#
diff -ruN zlib-1.2.3.orig/configure zlib-1.2.3/configure
--- zlib-1.2.3.orig/configure 2007-03-14 16:56:44.000000000 +0100
+++ zlib-1.2.3/configure 2007-03-14 16:54:07.000000000 +0100
@@ -173,7 +173,7 @@
if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
CFLAGS="$SFLAGS"
- LIBS="$SHAREDLIBV"
+ LIBS="$LIBS $SHAREDLIBV"
echo Building shared library $SHAREDLIBV with $CC.
elif test -z "$old_cc" -a -z "$old_cflags"; then
echo No shared library support.
More information about the Zlib-devel
mailing list