[3d9cea9] | 1 | Submitted By: Jim Gifford <jim@linuxfromscratch.org>
|
---|
| 2 | Date: 2006-11-15
|
---|
| 3 | Initial Package Version: 1.2.3
|
---|
| 4 | Origin: OpenWRT and Jim Gifford
|
---|
| 5 | Upstream Status: Not submitted
|
---|
| 6 | Description: Adds DESTDIR Support
|
---|
| 7 |
|
---|
| 8 | diff -Naur zlib-1.2.3.orig/Makefile.in zlib-1.2.3/Makefile.in
|
---|
| 9 | --- zlib-1.2.3.orig/Makefile.in 2005-07-17 19:25:21.000000000 -0700
|
---|
| 10 | +++ zlib-1.2.3/Makefile.in 2006-11-15 12:01:08.446325890 -0800
|
---|
| 11 | @@ -25,20 +25,23 @@
|
---|
| 12 | # -Wstrict-prototypes -Wmissing-prototypes
|
---|
| 13 |
|
---|
| 14 | LDFLAGS=libz.a
|
---|
| 15 | -LDSHARED=$(CC)
|
---|
| 16 | +LDSHARED=$(CC) -shared -Wl,-soname,$(SHAREDLIBM)
|
---|
| 17 | CPP=$(CC) -E
|
---|
| 18 |
|
---|
| 19 | -LIBS=libz.a
|
---|
| 20 | +LIBS=
|
---|
| 21 | +STATICLIB=libz.a
|
---|
| 22 | SHAREDLIB=libz.so
|
---|
| 23 | SHAREDLIBV=libz.so.1.2.3
|
---|
| 24 | SHAREDLIBM=libz.so.1
|
---|
| 25 |
|
---|
| 26 | -AR=ar rc
|
---|
| 27 | +AR=ar
|
---|
| 28 | RANLIB=ranlib
|
---|
| 29 | TAR=tar
|
---|
| 30 | SHELL=/bin/sh
|
---|
| 31 | EXE=
|
---|
| 32 |
|
---|
| 33 | +DESTDIR =
|
---|
| 34 | +
|
---|
| 35 | prefix = /usr/local
|
---|
| 36 | exec_prefix = ${prefix}
|
---|
| 37 | libdir = ${exec_prefix}/lib
|
---|
| 38 | @@ -67,8 +70,8 @@
|
---|
| 39 | echo ' *** zlib test FAILED ***'; \
|
---|
| 40 | fi
|
---|
| 41 |
|
---|
| 42 | -libz.a: $(OBJS) $(OBJA)
|
---|
| 43 | - $(AR) $@ $(OBJS) $(OBJA)
|
---|
| 44 | +$(STATICLIB): $(OBJS) $(OBJA)
|
---|
| 45 | + $(AR) rc $@ $(OBJS) $(OBJA)
|
---|
| 46 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
|
---|
| 47 |
|
---|
| 48 | match.o: match.S
|
---|
| 49 | @@ -77,8 +80,10 @@
|
---|
| 50 | mv _match.o match.o
|
---|
| 51 | rm -f _match.s
|
---|
| 52 |
|
---|
| 53 | +$(SHAREDLIB): $(SHAREDLIBV)
|
---|
| 54 | +
|
---|
| 55 | $(SHAREDLIBV): $(OBJS)
|
---|
| 56 | - $(LDSHARED) -o $@ $(OBJS)
|
---|
| 57 | + $(LDSHARED) -lc -o $@ $(OBJS)
|
---|
| 58 | rm -f $(SHAREDLIB) $(SHAREDLIBM)
|
---|
| 59 | ln -s $@ $(SHAREDLIB)
|
---|
| 60 | ln -s $@ $(SHAREDLIBM)
|
---|
| 61 | @@ -90,23 +95,23 @@
|
---|
| 62 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
|
---|
| 63 |
|
---|
| 64 | install: $(LIBS)
|
---|
| 65 | - -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
|
---|
| 66 | - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
|
---|
| 67 | - -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
|
---|
| 68 | - -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
|
---|
| 69 | - cp zlib.h zconf.h $(includedir)
|
---|
| 70 | - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
|
---|
| 71 | - cp $(LIBS) $(libdir)
|
---|
| 72 | - cd $(libdir); chmod 755 $(LIBS)
|
---|
| 73 | - -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
|
---|
| 74 | - cd $(libdir); if test -f $(SHAREDLIBV); then \
|
---|
| 75 | + -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
|
---|
| 76 | + -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
|
---|
| 77 | + -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
|
---|
| 78 | + -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
|
---|
| 79 | + cp zlib.h zconf.h $(DESTDIR)$(includedir)
|
---|
| 80 | + chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
|
---|
| 81 | + if [ -e $(STATICLIB) ]; then install -m755 $(STATICLIB) $(DESTDIR)$(libdir); fi
|
---|
| 82 | + if [ -e $(SHAREDLIBV) ]; then install -m755 $(SHAREDLIBV) $(DESTDIR)$(libdir); fi
|
---|
| 83 | + -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
|
---|
| 84 | + cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \
|
---|
| 85 | rm -f $(SHAREDLIB) $(SHAREDLIBM); \
|
---|
| 86 | ln -s $(SHAREDLIBV) $(SHAREDLIB); \
|
---|
| 87 | ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
|
---|
| 88 | (ldconfig || true) >/dev/null 2>&1; \
|
---|
| 89 | fi
|
---|
| 90 | - cp zlib.3 $(man3dir)
|
---|
| 91 | - chmod 644 $(man3dir)/zlib.3
|
---|
| 92 | + cp zlib.3 $(DESTDIR)$(man3dir)
|
---|
| 93 | + chmod 644 $(DESTDIR)$(man3dir)/zlib.3
|
---|
| 94 | # The ranlib in install is needed on NeXTSTEP which checks file times
|
---|
| 95 | # ldconfig is for Linux
|
---|
| 96 |
|
---|
| 97 | diff -Naur zlib-1.2.3.orig/configure zlib-1.2.3/configure
|
---|
| 98 | --- zlib-1.2.3.orig/configure 2005-07-11 13:11:57.000000000 -0700
|
---|
| 99 | +++ zlib-1.2.3/configure 2006-11-15 11:59:34.345493735 -0800
|
---|
| 100 | @@ -23,7 +23,7 @@
|
---|
| 101 | VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
|
---|
| 102 | VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
|
---|
| 103 | VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
|
---|
| 104 | -AR=${AR-"ar rc"}
|
---|
| 105 | +AR=${AR-"ar"}
|
---|
| 106 | RANLIB=${RANLIB-"ranlib"}
|
---|
| 107 | prefix=${prefix-/usr/local}
|
---|
| 108 | exec_prefix=${exec_prefix-'${prefix}'}
|
---|
| 109 | @@ -73,7 +73,7 @@
|
---|
| 110 |
|
---|
| 111 | if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
|
---|
| 112 | CC="$cc"
|
---|
| 113 | - SFLAGS=${CFLAGS-"-fPIC -O3"}
|
---|
| 114 | + SFLAGS=${CFLAGS-"-D_REENTRANT -fPIC -O3"}
|
---|
| 115 | CFLAGS="$cflags"
|
---|
| 116 | case `(uname -s || echo unknown) 2>/dev/null` in
|
---|
| 117 | Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
|
---|
| 118 | @@ -424,6 +424,29 @@
|
---|
| 119 | echo Checking for mmap support... No.
|
---|
| 120 | fi
|
---|
| 121 |
|
---|
| 122 | +cat > $test.c <<EOF
|
---|
| 123 | +#include <stdio.h>
|
---|
| 124 | +int main() { char buf[10]; snprintf(buf, sizeof(buf), "%s", "F"); return 0; }
|
---|
| 125 | +EOF
|
---|
| 126 | +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
|
---|
| 127 | + echo "Checking for snprintf... Yes."
|
---|
| 128 | + CFLAGS="$CFLAGS -DHAS_snprintf"
|
---|
| 129 | +else
|
---|
| 130 | + echo "Checking for snprintf.. No."
|
---|
| 131 | +fi
|
---|
| 132 | +
|
---|
| 133 | +cat > $test.c <<EOF
|
---|
| 134 | +#include <stdio.h>
|
---|
| 135 | +#include <stdarg.h>
|
---|
| 136 | +int main(void) { va_list a; vsnprintf(0, 0, "", a); return 0; }
|
---|
| 137 | +EOF
|
---|
| 138 | +if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
|
---|
| 139 | + echo "Checking for vsnprintf... Yes."
|
---|
| 140 | + CFLAGS="$CFLAGS -DHAS_vsnprintf"
|
---|
| 141 | +else
|
---|
| 142 | + echo "Checking for vsnprintf.. No."
|
---|
| 143 | +fi
|
---|
| 144 | +
|
---|
| 145 | CPP=${CPP-"$CC -E"}
|
---|
| 146 | case $CFLAGS in
|
---|
| 147 | *ASMV*)
|
---|
| 148 | @@ -440,20 +463,21 @@
|
---|
| 149 | # udpate Makefile
|
---|
| 150 | sed < Makefile.in "
|
---|
| 151 | /^CC *=/s#=.*#=$CC#
|
---|
| 152 | -/^CFLAGS *=/s#=.*#=$CFLAGS#
|
---|
| 153 | -/^CPP *=/s#=.*#=$CPP#
|
---|
| 154 | -/^LDSHARED *=/s#=.*#=$LDSHARED#
|
---|
| 155 | -/^LIBS *=/s#=.*#=$LIBS#
|
---|
| 156 | -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
---|
| 157 | -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
---|
| 158 | -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
|
---|
| 159 | -/^AR *=/s#=.*#=$AR#
|
---|
| 160 | -/^RANLIB *=/s#=.*#=$RANLIB#
|
---|
| 161 | -/^EXE *=/s#=.*#=$EXE#
|
---|
| 162 | -/^prefix *=/s#=.*#=$prefix#
|
---|
| 163 | -/^exec_prefix *=/s#=.*#=$exec_prefix#
|
---|
| 164 | -/^libdir *=/s#=.*#=$libdir#
|
---|
| 165 | -/^includedir *=/s#=.*#=$includedir#
|
---|
| 166 | -/^mandir *=/s#=.*#=$mandir#
|
---|
| 167 | -/^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
---|
| 168 | +/^CC *=/s%=.*%= $CC%
|
---|
| 169 | +/^CFLAGS *=/s%=.*%= $CFLAGS%
|
---|
| 170 | +/^CPP *=/s%=.*%= $CPP%
|
---|
| 171 | +/^LDSHARED *=/s%=.*%= $LDSHARED%
|
---|
| 172 | +/^LIBS *=/s%=.*%= $LIBS%
|
---|
| 173 | +/^SHAREDLIB *=/s%=.*%= $SHAREDLIB%
|
---|
| 174 | +/^SHAREDLIBV *=/s%=.*%= $SHAREDLIBV%
|
---|
| 175 | +/^SHAREDLIBM *=/s%=.*%= $SHAREDLIBM%
|
---|
| 176 | +/^AR *=/s%=.*%= $AR%
|
---|
| 177 | +/^RANLIB *=/s%=.*%= $RANLIB%
|
---|
| 178 | +/^EXE *=/s%=.*%= $EXE%
|
---|
| 179 | +/^prefix *=/s%=.*%= $prefix%
|
---|
| 180 | +/^exec_prefix *=/s%=.*%= $exec_prefix%
|
---|
| 181 | +/^libdir *=/s%=.*%= $libdir%
|
---|
| 182 | +/^includedir *=/s%=.*%= $includedir%
|
---|
| 183 | +/^mandir *=/s%=.*%= $mandir%
|
---|
| 184 | +/^LDFLAGS *=/s%=.*%= $LDFLAGS%
|
---|
| 185 | " > Makefile
|
---|
| 186 | diff -Naur zlib-1.2.3.orig/contrib/minizip/Makefile zlib-1.2.3/contrib/minizip/Makefile
|
---|
| 187 | --- zlib-1.2.3.orig/contrib/minizip/Makefile 2005-07-12 11:08:40.000000000 -0700
|
---|
| 188 | +++ zlib-1.2.3/contrib/minizip/Makefile 2006-11-15 11:59:34.345493735 -0800
|
---|
| 189 | @@ -1,8 +1,8 @@
|
---|
| 190 | CC=cc
|
---|
| 191 | -CFLAGS=-O -I../..
|
---|
| 192 | +CFLAGS=-O2 -g -I../.. -Dunix
|
---|
| 193 |
|
---|
| 194 | -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
|
---|
| 195 | -ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
|
---|
| 196 | +UNZ_OBJS = miniunz.o unzip.o ioapi.o
|
---|
| 197 | +ZIP_OBJS = minizip.o zip.o ioapi.o
|
---|
| 198 |
|
---|
| 199 | .c.o:
|
---|
| 200 | $(CC) -c $(CFLAGS) $*.c
|
---|
| 201 | @@ -10,10 +10,10 @@
|
---|
| 202 | all: miniunz minizip
|
---|
| 203 |
|
---|
| 204 | miniunz: $(UNZ_OBJS)
|
---|
| 205 | - $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
|
---|
| 206 | + $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) -L ../.. -lz
|
---|
| 207 |
|
---|
| 208 | minizip: $(ZIP_OBJS)
|
---|
| 209 | - $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
|
---|
| 210 | + $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) -L ../.. -lz
|
---|
| 211 |
|
---|
| 212 | test: miniunz minizip
|
---|
| 213 | ./minizip test readme.txt
|
---|