This commit is contained in:
parent
a7a6bf2e84
commit
da24b04b7f
133
Makefile
133
Makefile
@ -1,133 +0,0 @@
|
|||||||
#
|
|
||||||
# Makefile for compiling libzio
|
|
||||||
#
|
|
||||||
# Author: Werner Fink, <werner@suse.de>
|
|
||||||
#
|
|
||||||
|
|
||||||
LARGE = $(shell getconf LFS_CFLAGS)
|
|
||||||
CFLAGS = $(RPM_OPT_FLAGS) -pipe -Wall -D_GNU_SOURCE -D_REENTRANT $(LARGE)
|
|
||||||
CC = gcc
|
|
||||||
MAJOR = 0
|
|
||||||
MINOR = 93
|
|
||||||
VERSION = $(MAJOR).$(MINOR)
|
|
||||||
SONAME = libzio.so.$(MAJOR)
|
|
||||||
LDMAP = -Wl,--version-script=zio.map
|
|
||||||
|
|
||||||
prefix = /usr
|
|
||||||
libdir = $(prefix)/lib
|
|
||||||
datadir = $(prefix)/share
|
|
||||||
mandir = $(datadir)/man
|
|
||||||
incdir = $(prefix)/include
|
|
||||||
|
|
||||||
FILES = README \
|
|
||||||
COPYING \
|
|
||||||
Makefile \
|
|
||||||
zio.c \
|
|
||||||
zioP.h \
|
|
||||||
zio.h.in \
|
|
||||||
testt.c \
|
|
||||||
tests.c \
|
|
||||||
lzw.h \
|
|
||||||
unlzw.c \
|
|
||||||
zio.map \
|
|
||||||
fzopen.3.in
|
|
||||||
|
|
||||||
### Includes and Defines (add further entries here):
|
|
||||||
|
|
||||||
cc-include = $(shell $(CC) $(INCLUDES) -include $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 && echo "-D$(2)")
|
|
||||||
cc-library = $(shell echo 'int main () { return 0; }' |$(CC) -l$(1:lib%=%) -o /dev/null -xc - > /dev/null 2>&1 && echo yes)
|
|
||||||
cc-function = $(shell echo 'extern void $(1)(void); int main () { $(1)(); return 0; }' |$(CC) -o /dev/null -xc - > /dev/null 2>&1 && echo "-D$(2)")
|
|
||||||
|
|
||||||
CFLAGS += $(call cc-include,libio.h,HAVE_LIBIO_H)
|
|
||||||
CFLAGS += $(call cc-function,fopencookie,HAVE_FOPENCOOKIE)
|
|
||||||
CFLAGS += $(call cc-function,funopen,HAVE_FUNOPEN)
|
|
||||||
|
|
||||||
CFLAGS += $(call cc-include,zlib.h,HAS_ZLIB_H)
|
|
||||||
CFLAGS += $(call cc-include,bzlib.h,HAS_BZLIB_H)
|
|
||||||
CFLAGS += $(call cc-include,lzmadec.h,HAS_LZMADEC_H)
|
|
||||||
CFLAGS += $(call cc-include,lzma.h,HAS_LZMA_H)
|
|
||||||
|
|
||||||
LIBS = -lz
|
|
||||||
ifeq ($(call cc-library,libbz2),yes)
|
|
||||||
LIBS += -lbz2
|
|
||||||
endif
|
|
||||||
ifeq ($(call cc-library,liblzma),yes)
|
|
||||||
LIBS += -llzma
|
|
||||||
else
|
|
||||||
ifeq ($(call cc-library,lzmadec),yes)
|
|
||||||
LIBS += -llzmadec
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: shared static
|
|
||||||
noweak: CFLAGS += -DNO_WEAK
|
|
||||||
noweak: LINK += $(LIBS)
|
|
||||||
noweak: all
|
|
||||||
shared: libzio.so.$(VERSION) zio.map
|
|
||||||
static: libzio.a
|
|
||||||
|
|
||||||
obj/zio.o: zio.c zioP.h zio.h
|
|
||||||
test -d obj/ || mkdir obj/
|
|
||||||
$(CC) $(CFLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
obs/zio.o: zio.c zioP.h zio.h
|
|
||||||
test -d obs/ || mkdir obs/
|
|
||||||
$(CC) $(CFLAGS) -fPIC -o $@ -c $<
|
|
||||||
|
|
||||||
obj/unlzw.o: unlzw.c lzw.h
|
|
||||||
test -d obj/ || mkdir obj/
|
|
||||||
$(CC) $(CFLAGS) -funroll-loops -o $@ -c $<
|
|
||||||
|
|
||||||
obs/unlzw.o: unlzw.c lzw.h
|
|
||||||
test -d obs/ || mkdir obs/
|
|
||||||
$(CC) $(CFLAGS) -fPIC -o $@ -c $<
|
|
||||||
|
|
||||||
libzio.a: obj/zio.o obj/unlzw.o
|
|
||||||
ar -rv $@ $^
|
|
||||||
ranlib $@
|
|
||||||
|
|
||||||
libzio.so.$(VERSION): obs/zio.o obs/unlzw.o
|
|
||||||
gcc -shared -Wl,-soname,$(SONAME),-stats $(LDMAP) -o $@ $^ $(LINK)
|
|
||||||
|
|
||||||
zioP.h: /usr/include/bzlib.h /usr/include/zlib.h
|
|
||||||
zio.h: zio.h.in /usr/include/stdio.h
|
|
||||||
sed 's/@@VERSION@@/$(VERSION)/' < $< > $@
|
|
||||||
fzopen.3: fzopen.3.in
|
|
||||||
sed 's/@@VERSION@@/$(VERSION)/' < $< > $@
|
|
||||||
|
|
||||||
unlzw.c: lzw.h
|
|
||||||
|
|
||||||
install: install-shared install-static install-data
|
|
||||||
|
|
||||||
install-shared: libzio.so.$(VERSION)
|
|
||||||
mkdir -p $(DESTDIR)$(libdir)
|
|
||||||
install -m 0755 libzio.so.$(VERSION) $(DESTDIR)$(libdir)/
|
|
||||||
ln -sf libzio.so.$(VERSION) $(DESTDIR)$(libdir)/libzio.so.$(MAJOR)
|
|
||||||
ln -sf libzio.so.$(MAJOR) $(DESTDIR)$(libdir)/libzio.so
|
|
||||||
|
|
||||||
install-static: libzio.a
|
|
||||||
mkdir -p $(DESTDIR)$(libdir)
|
|
||||||
install -m 0644 libzio.a $(DESTDIR)$(libdir)/
|
|
||||||
|
|
||||||
install-data: zio.h fzopen.3
|
|
||||||
mkdir -p $(DESTDIR)$(incdir)
|
|
||||||
mkdir -p $(DESTDIR)$(mandir)/man3
|
|
||||||
install -m 0644 zio.h $(DESTDIR)$(incdir)/
|
|
||||||
install -m 0644 fzopen.3 $(DESTDIR)$(mandir)/man3/
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.a *.so* testt tests zio.h
|
|
||||||
rm -rf obj/ obs/
|
|
||||||
rm -f libzio-$(VERSION).tar.gz
|
|
||||||
|
|
||||||
dest: clean
|
|
||||||
mkdir libzio-$(VERSION)
|
|
||||||
cp -p $(FILES) libzio-$(VERSION)/
|
|
||||||
tar czf libzio-$(VERSION).tar.gz libzio-$(VERSION)/
|
|
||||||
rm -rf libzio-$(VERSION)/
|
|
||||||
|
|
||||||
testt: testt.c libzio.a
|
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
|
||||||
|
|
||||||
tests: tests.c libzio.a
|
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
|
55
libzio-0.93.diff
Normal file
55
libzio-0.93.diff
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
--- zio.c
|
||||||
|
+++ zio.c
|
||||||
|
@@ -62,7 +62,7 @@ static ssize_t bzwrite(void *cookie, c
|
||||||
|
return (ssize_t)BZ2_bzwrite((BZFILE*)cookie, (void*)buf, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static zio_int_t bzseek(void *cookie __unused, zio_off_t *poffset __unused, int whence __unused)
|
||||||
|
+static zio_int_t bzseek(void *cookie unused, zio_off_t *poffset unused, int whence unused)
|
||||||
|
{
|
||||||
|
errno = ESPIPE;
|
||||||
|
return -1;
|
||||||
|
@@ -327,7 +327,7 @@ static ssize_t lzwwrite(void *cookie,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static zio_int_t lzwseek(void *cookie __unused, zio_off_t *poffset __unused, int whence __unused)
|
||||||
|
+static zio_int_t lzwseek(void *cookie unused, zio_off_t *poffset unused, int whence unused)
|
||||||
|
{
|
||||||
|
errno = ESPIPE;
|
||||||
|
return -1;
|
||||||
|
--- zioP.h
|
||||||
|
+++ zioP.h
|
||||||
|
@@ -33,14 +33,14 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
-#ifndef __unused
|
||||||
|
-# define __unused __attribute__((__unused__))
|
||||||
|
+#ifndef unused
|
||||||
|
+# define unused __attribute__((__unused__))
|
||||||
|
#endif
|
||||||
|
-#ifndef __nonnull
|
||||||
|
-# define __nonnull(parm) __attribute__((__nonnull__ parm))
|
||||||
|
+#ifndef nonnull
|
||||||
|
+# define nonnull(parm) __attribute__((__nonnull__ parm))
|
||||||
|
#endif
|
||||||
|
-#ifndef __wur
|
||||||
|
-# define __wur __attribute__((__warn_unused_result__))
|
||||||
|
+#ifndef wur
|
||||||
|
+# define wur __attribute__((__warn_unused_result__))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(HAVE_FOPENCOOKIE) && !defined(HAVE_FUNOPEN)
|
||||||
|
@@ -161,9 +161,9 @@ __extension__ typedef struct
|
||||||
|
} cookie_io_functions_t;
|
||||||
|
static __inline__ FILE *fopencookie(void *__restrict,
|
||||||
|
const char *__restrict,
|
||||||
|
- cookie_io_functions_t) __nonnull((1,2)) __wur;
|
||||||
|
+ cookie_io_functions_t) nonnull((1,2)) wur;
|
||||||
|
static __inline__ FILE *fopencookie(void *__restrict cookie,
|
||||||
|
- const char *__restrict mode __unused,
|
||||||
|
+ const char *__restrict mode unused,
|
||||||
|
cookie_io_functions_t io_funcs)
|
||||||
|
{
|
||||||
|
return funopen(cookie, io_funcs.read, io_funcs.write, io_funcs.seek, io_funcs.close);
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Feb 23 11:05:37 CET 2009 - schwab@suse.de
|
||||||
|
|
||||||
|
- Fix namespace violations.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 13 14:05:11 CET 2009 - werner@suse.de
|
Fri Feb 13 14:05:11 CET 2009 - werner@suse.de
|
||||||
|
|
||||||
|
@ -34,10 +34,11 @@ Obsoletes: libzio-64bit
|
|||||||
%endif
|
%endif
|
||||||
#
|
#
|
||||||
Version: 0.93
|
Version: 0.93
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: A Library for Accessing Compressed Text Files
|
Summary: A Library for Accessing Compressed Text Files
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Source: libzio-%{version}.tar.bz2
|
Source: libzio-%{version}.tar.bz2
|
||||||
|
Patch: libzio-%{version}.diff
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Libzio provides a wrapper function for reading or writing gzip or bzip2
|
Libzio provides a wrapper function for reading or writing gzip or bzip2
|
||||||
@ -73,6 +74,7 @@ Authors:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make
|
make
|
||||||
@ -112,6 +114,8 @@ make DESTDIR=$RPM_BUILD_ROOT install libdir=%{_libdir} mandir=%{_mandir}
|
|||||||
/usr/include/zio.h
|
/usr/include/zio.h
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 23 2009 schwab@suse.de
|
||||||
|
- Fix namespace violations.
|
||||||
* Fri Feb 13 2009 werner@suse.de
|
* Fri Feb 13 2009 werner@suse.de
|
||||||
- Use liblzma from xz package if available
|
- Use liblzma from xz package if available
|
||||||
- Detect if funopen(3) can be used if no fopencookie(3) found
|
- Detect if funopen(3) can be used if no fopencookie(3) found
|
||||||
|
Loading…
x
Reference in New Issue
Block a user