aboutsummaryrefslogtreecommitdiffstats
path: root/package/zlib
diff options
context:
space:
mode:
authorMike Baker <mbm@openwrt.org>2005-03-06 03:34:52 +0000
committerMike Baker <mbm@openwrt.org>2005-03-06 03:34:52 +0000
commit3d904bb14a330fb72f60d4b78a40435389398655 (patch)
tree4c6922d42353c39b46dcd7cd09982fbe9c1f9765 /package/zlib
parentb92a98900c8308542da9f758cd656880081f1196 (diff)
downloadupstream-3d904bb14a330fb72f60d4b78a40435389398655.tar.gz
upstream-3d904bb14a330fb72f60d4b78a40435389398655.tar.bz2
upstream-3d904bb14a330fb72f60d4b78a40435389398655.zip
nbd's makefile/menuconfig rewrite
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@307 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/zlib')
-rw-r--r--package/zlib/Config.in8
-rw-r--r--package/zlib/Makefile62
-rw-r--r--package/zlib/zlib.control8
-rw-r--r--package/zlib/zlib.mk75
-rw-r--r--package/zlib/zlib.patch206
5 files changed, 281 insertions, 78 deletions
diff --git a/package/zlib/Config.in b/package/zlib/Config.in
index fef2324360..89cb1eb92a 100644
--- a/package/zlib/Config.in
+++ b/package/zlib/Config.in
@@ -1,5 +1,7 @@
config BR2_PACKAGE_ZLIB
- bool "zlib"
- default n
+ tristate "zlib"
+ default y
help
- zlib library
+ A library implementing the 'deflate' compression method
+
+ http://www.zlib.net/
diff --git a/package/zlib/Makefile b/package/zlib/Makefile
new file mode 100644
index 0000000000..522c1b675c
--- /dev/null
+++ b/package/zlib/Makefile
@@ -0,0 +1,62 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME := zlib
+PKG_VERSION := 1.2.2
+PKG_RELEASE := 1
+
+PKG_SOURCE_SITE := http://www.zlib.net/
+PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_CAT := zcat
+PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION)
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR)
+PKG_IPK := zlib_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+
+
+$(DL_DIR)/$(PKG_SOURCE_FILE):
+ mkdir -p $(DL_DIR)
+ $(WGET) -P $(DL_DIR) $(PKG_SOURCE_SITE)/$(PKG_SOURCE_FILE)
+
+$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
+ mkdir -p $(TOOL_BUILD_DIR)
+ $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ $(PATCH) $(PKG_BUILD_DIR) . $(PKG_NAME).patch
+ touch $(PKG_BUILD_DIR)/.patched
+
+$(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched
+ (cd $(PKG_BUILD_DIR); \
+ $(TARGET_CONFIGURE_OPTS) \
+ ./configure \
+ --prefix=/ \
+ --shared)
+ touch $(PKG_BUILD_DIR)/.configured
+
+$(PKG_BUILD_DIR)/libz.so: $(PKG_BUILD_DIR)/.configured
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_LARGEFILE)" \
+ libz.a libz.so
+
+$(STAGING_DIR)/lib/libz.so: $(PKG_BUILD_DIR)/libz.so
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ DESTDIR="$(STAGING_DIR)" \
+ install
+
+$(PACKAGE_DIR)/$(PKG_IPK): $(STAGING_DIR)/lib/libz.so
+ mkdir -p $(PACKAGE_DIR)
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_BUILD_DIR)/ipkg/zlib zlib.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ mkdir -p $(PKG_BUILD_DIR)/ipkg/zlib/usr/lib
+ cp -a $(PKG_BUILD_DIR)/libz.so* $(PKG_BUILD_DIR)/ipkg/zlib/usr/lib
+ $(STRIP) $(PKG_BUILD_DIR)/ipkg/zlib/usr/lib/*
+ $(IPKG_BUILD) $(PKG_BUILD_DIR)/ipkg/zlib $(PACKAGE_DIR)
+
+
+source: $(DL_DIR)/$(PKG_SOURCE_FILE)
+prepare: $(PKG_BUILD_DIR)/.patched
+compile: $(STAGING_DIR)/lib/libz.so $(PACKAGE_DIR)/$(PKG_IPK)
+install: $(PKG_ZLIB)
+ $(IPKG) install $(PACKAGE_DIR)/$(PKG_IPK)
+clean:
+ rm -rf $(PKG_BUILD_DIR)
+ rm -f $(STAGING_DIR)/lib/libz* $(STAGING_DIR)/include/zlib*
+ rm -f $(PACKAGE_DIR)/zlib\*.ipk
+
diff --git a/package/zlib/zlib.control b/package/zlib/zlib.control
new file mode 100644
index 0000000000..b7ccf269e4
--- /dev/null
+++ b/package/zlib/zlib.control
@@ -0,0 +1,8 @@
+Package: zlib
+Priority: optional
+Section: libs
+Version: 1.2.2-3
+Architecture: mipsel
+Maintainer: Felix Fietkau <nbd@vd-s.ath.cx>
+Source: buildroot internal
+Description: an implementation of the deflate compression method (library)
diff --git a/package/zlib/zlib.mk b/package/zlib/zlib.mk
deleted file mode 100644
index 6561ddd349..0000000000
--- a/package/zlib/zlib.mk
+++ /dev/null
@@ -1,75 +0,0 @@
-#############################################################
-#
-# zlib
-#
-#############################################################
-ZLIB_SOURCE=zlib-1.1.4.tar.bz2
-ZLIB_SITE=http://aleron.dl.sourceforge.net/sourceforge/libpng
-ZLIB_DIR=$(BUILD_DIR)/zlib-1.1.4
-ZLIB_CFLAGS= $(TARGET_CFLAGS) -fPIC
-ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true)
-ZLIB_CFLAGS+= -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-endif
-
-$(DL_DIR)/$(ZLIB_SOURCE):
- $(WGET) -P $(DL_DIR) $(ZLIB_SITE)/$(ZLIB_SOURCE)
-
-$(ZLIB_DIR)/.source: $(DL_DIR)/$(ZLIB_SOURCE)
- bzcat $(DL_DIR)/$(ZLIB_SOURCE) | tar -C $(BUILD_DIR) -xvf -
- touch $(ZLIB_DIR)/.source
-
-$(ZLIB_DIR)/.configured: $(ZLIB_DIR)/.source
- (cd $(ZLIB_DIR); \
- ./configure \
- --shared \
- --prefix=/usr \
- --exec-prefix=$(STAGING_DIR)/usr/bin \
- --libdir=$(STAGING_DIR)/lib \
- --includedir=$(STAGING_DIR)/include \
- );
- touch $(ZLIB_DIR)/.configured;
-
-$(ZLIB_DIR)/libz.so.1.1.4: $(ZLIB_DIR)/.configured
- $(MAKE) LDSHARED="$(TARGET_CROSS)ld -shared -soname,libz.so.1" \
- CFLAGS="$(ZLIB_CFLAGS)" CC=$(TARGET_CC) -C $(ZLIB_DIR) all libz.a;
- touch -c $(ZLIB_DIR)/libz.so.1.1.4
-
-$(STAGING_DIR)/lib/libz.so.1.1.4: $(ZLIB_DIR)/libz.so.1.1.4
- cp -dpf $(ZLIB_DIR)/libz.a $(STAGING_DIR)/lib;
- cp -dpf $(ZLIB_DIR)/zlib.h $(STAGING_DIR)/include;
- cp -dpf $(ZLIB_DIR)/zconf.h $(STAGING_DIR)/include;
- cp -dpf $(ZLIB_DIR)/libz.so* $(STAGING_DIR)/lib;
- (cd $(STAGING_DIR)/lib; ln -fs libz.so.1.1.4 libz.so.1);
- chmod a-x $(STAGING_DIR)/lib/libz.so.1.1.4
- touch -c $(STAGING_DIR)/lib/libz.so.1.1.4
-
-$(TARGET_DIR)/lib/libz.so.1.1.4: $(STAGING_DIR)/lib/libz.so.1.1.4
- cp -dpf $(STAGING_DIR)/lib/libz.so* $(TARGET_DIR)/lib;
- -$(STRIP) $(TARGET_DIR)/lib/libz.so*
- touch -c $(TARGET_DIR)/lib/libz.so.1.1.4
-
-$(TARGET_DIR)/usr/lib/libz.a: $(STAGING_DIR)/lib/libz.so.1.1.4
- mkdir -p $(TARGET_DIR)/usr/include
- cp -dpf $(STAGING_DIR)/include/zlib.h $(TARGET_DIR)/usr/include/
- cp -dpf $(STAGING_DIR)/include/zconf.h $(TARGET_DIR)/usr/include/
- cp -dpf $(STAGING_DIR)/lib/libz.a $(TARGET_DIR)/usr/lib/
- rm -f $(TARGET_DIR)/lib/libz.so
- (cd $(TARGET_DIR)/usr/lib; ln -fs /lib/libz.so.1.1.4 libz.so)
- touch -c $(TARGET_DIR)/usr/lib/libz.a
-
-zlib-headers: $(TARGET_DIR)/usr/lib/libz.a
-
-zlib: uclibc $(TARGET_DIR)/lib/libz.so.1.1.4
-
-zlib-source: $(DL_DIR)/$(ZLIB_SOURCE)
-
-zlib-clean:
- rm -f $(TARGET_DIR)/lib/libz.so*
- -$(MAKE) -C $(ZLIB_DIR) clean
-
-zlib-dirclean:
- rm -rf $(ZLIB_DIR)
-
-ifeq ($(strip $(BR2_PACKAGE_ZLIB)),y)
-TARGETS+=zlib
-endif
diff --git a/package/zlib/zlib.patch b/package/zlib/zlib.patch
new file mode 100644
index 0000000000..8f5a9b5358
--- /dev/null
+++ b/package/zlib/zlib.patch
@@ -0,0 +1,206 @@
+diff -ruN zlib-1.2.2-orig/Makefile.in zlib-1.2.2-2/Makefile.in
+--- zlib-1.2.2-orig/Makefile.in 2004-09-15 16:27:20.000000000 +0200
++++ zlib-1.2.2-2/Makefile.in 2004-11-13 13:38:12.000000000 +0100
+@@ -25,20 +25,23 @@
+ # -Wstrict-prototypes -Wmissing-prototypes
+
+ LDFLAGS=libz.a
+-LDSHARED=$(CC)
++LDSHARED=$(CC) -shared -Wl,-soname,$(SHAREDLIBM)
+ CPP=$(CC) -E
+
+-LIBS=libz.a
++LIBS=
++STATICLIB=libz.a
+ SHAREDLIB=libz.so
+ SHAREDLIBV=libz.so.1.2.2
+ SHAREDLIBM=libz.so.1
+
+-AR=ar rc
++AR=ar
+ RANLIB=ranlib
+ TAR=tar
+ SHELL=/bin/sh
+ EXE=
+
++DESTDIR =
++
+ prefix = /usr/local
+ exec_prefix = ${prefix}
+ libdir = ${exec_prefix}/lib
+@@ -67,8 +70,8 @@
+ echo ' *** zlib test FAILED ***'; \
+ fi
+
+-libz.a: $(OBJS) $(OBJA)
+- $(AR) $@ $(OBJS) $(OBJA)
++$(STATICLIB): $(OBJS) $(OBJA)
++ $(AR) rc $@ $(OBJS) $(OBJA)
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+ match.o: match.S
+@@ -77,8 +80,10 @@
+ mv _match.o match.o
+ rm -f _match.s
+
++$(SHAREDLIB): $(SHAREDLIBV)
++
+ $(SHAREDLIBV): $(OBJS)
+- $(LDSHARED) -o $@ $(OBJS)
++ $(LDSHARED) -lc -o $@ $(OBJS)
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIBM)
+@@ -90,23 +95,23 @@
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+
+ install: $(LIBS)
+- -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
+- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
+- -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
+- -@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 \
++ -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
++ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
++ -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
++ -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
++ cp zlib.h zconf.h $(DESTDIR)$(includedir)
++ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
++ cp $(STATICLIB) $(SHAREDLIBV) $(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
+ # The ranlib in install is needed on NeXTSTEP which checks file times
+ # ldconfig is for Linux
+
+diff -ruN zlib-1.2.2-orig/configure zlib-1.2.2-2/configure
+--- zlib-1.2.2-orig/configure 2004-09-07 07:50:06.000000000 +0200
++++ zlib-1.2.2-2/configure 2004-11-13 12:37:43.000000000 +0100
+@@ -23,7 +23,7 @@
+ 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"}
+ RANLIB=${RANLIB-"ranlib"}
+ prefix=${prefix-/usr/local}
+ exec_prefix=${exec_prefix-'${prefix}'}
+@@ -73,7 +73,7 @@
+
+ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
+ CC="$cc"
+- SFLAGS=${CFLAGS-"-fPIC -O3"}
++ SFLAGS=${CFLAGS-"-D_REENTRANT -fPIC -O3"}
+ CFLAGS="$cflags"
+ case `(uname -s || echo unknown) 2>/dev/null` in
+ Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
+@@ -408,6 +408,29 @@
+ echo Checking for mmap support... No.
+ fi
+
++cat > $test.c <<EOF
++#include <stdio.h>
++int main() { char buf[10]; snprintf(buf, sizeof(buf), "%s", "F"); return 0; }
++EOF
++if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ echo "Checking for snprintf... Yes."
++ CFLAGS="$CFLAGS -DHAS_snprintf"
++else
++ echo "Checking for snprintf.. No."
++fi
++
++cat > $test.c <<EOF
++#include <stdio.h>
++#include <stdarg.h>
++int main(void) { va_list a; vsnprintf(0, 0, "", a); return 0; }
++EOF
++if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ echo "Checking for vsnprintf... Yes."
++ CFLAGS="$CFLAGS -DHAS_vsnprintf"
++else
++ echo "Checking for vsnprintf.. No."
++fi
++
+ CPP=${CPP-"$CC -E"}
+ case $CFLAGS in
+ *ASMV*)
+@@ -424,20 +447,21 @@
+ # udpate Makefile
+ sed < Makefile.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#
+-/^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#
++/^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%
++/^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%
+ " > Makefile
+diff -ruN zlib-1.2.2-orig/contrib/minizip/Makefile zlib-1.2.2-2/contrib/minizip/Makefile
+--- zlib-1.2.2-orig/contrib/minizip/Makefile 2003-09-10 20:00:16.000000000 +0200
++++ zlib-1.2.2-2/contrib/minizip/Makefile 2004-11-13 12:37:43.000000000 +0100
+@@ -1,8 +1,8 @@
+ CC=cc
+-CFLAGS=-O -I../..
++CFLAGS=-O2 -g -I../.. -Dunix
+
+-UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
+-ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
++UNZ_OBJS = miniunz.o unzip.o ioapi.o
++ZIP_OBJS = minizip.o zip.o ioapi.o
+
+ .c.o:
+ $(CC) -c $(CFLAGS) $*.c
+@@ -10,10 +10,10 @@
+ all: miniunz minizip
+
+ miniunz: $(UNZ_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
++ $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) -L ../.. -lz
+
+ minizip: $(ZIP_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
++ $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) -L ../.. -lz
+
+ test: miniunz minizip
+ ./minizip test readme.txt