- ZIP Access
- SDLrwops Example
- ext/io Customization
zip/no Encryption (2)
- Library API
- 64on32 extras
- Next To Come
fseeko mmapped memdisk
- Config Helpers
- Making a zip/exe
=Hints And Links
- Functions List..
- unix man pages
faq notes zip-php
formatted by mksite.sh
- 64on32 extras
- Next To Come
If using the zziplib with other project then you can use a number of possibility to configure and link. The zziplib had been usually included within the projects that made use of it - some did even pick up the advantage to be allowed to staticlink in a limited set of conditions. Recently however, the zziplib is shipped as a standard library of various linux/freebsd distros - mostly for the usage by the php-zip module. This allows third party software makers to link to the preinstalled library in the system and consequently reduce the memory consumption - even more than now with the zziplib being a lightweight anyway (the i386 .so is usually less than 20k)
Within modern software development, one should be advised to use pkg-config as soon as it is available. The pkg-config helper can handle a lot of problems that can usually come up with linking to third party libraries in case that those link again dynamically with other libraries themselves. It does correctly order the list of "libs", it can throw away duplicate "-L" hints, and same for cflags "-I" hints, plus it will throw away some sys-includes that gcc3.2 will warn about with a false positive.
There is a number of pkg-config targets installed in the system but the one you want to use is pkg-config zziplib. Therefore, a simple Makefile could read like
PROGRAM = my_prog CFLAGS = -Dhappy `pkg-config zziplib --cflags` LIBS = -Wl,-E `pkg-config zziplib --libs` my_prog.o : my_prog.c $(CC) $(CFLAGS) $< -o $@ my_prog : my_prog.o $(LINK) $< $(LIBS)
The `pkg-config zziplibs --libs` will usually expand to
$ pkg-config --list-all | sort | grep zzip zziplib zziplib - ZZipLib - libZ-based ZIP-access Library zzip-sdl-config zzip-sdl-config - SDL Config (for ZZipLib) zzip-sdl-rwops zzip-sdl-rwops - SDL_rwops for ZZipLib zzipwrap zzipwrap - Callback Wrappers for ZZipLib zzip-zlib-config zzip-zlib-config - ZLib Config (for ZZipLib)
The two entries like "zzip-sdl-config" and "zzip-zlib-config" happen to be ".pc" files for the libz.so and libSDL.so that were seen at configure-time of zziplib - you may want to reuse these in your projects as well whenever you need to link to either of zlib or libsdl even in places where there is no direct need for zziplib. It basically looks like:
$ pkg-config zzip-zlib-config --modversion 1.1.4 $ pkg-config zzip-zlib-config --libs -lz
The pkg-config ".pc" files are relativly young in the history of zziplib. A long time before that there was the `zzip-config` script installed in the system. These `*-config` were common before the pkg-config came about, and in fact the pkg-config infrastructure was invented to flatten away the problems of using multiple `*-config` scripts for a project. As long as you do not combine multiple `*-config`s then it should be well okay to use the `zzip-config` directly - it does also kill another dependency on the `pkg-config` tool to build your project, the zziplib is all that's needed.
In its call-structure the `zzip-config` script uses the same options as `pkg-config`, (well they are historic cousins anyway). and that simply means you can replace each call above like `pkg-config zziplib...` with `zzip-config...`.
PROGRAM = my_prog CFLAGS = -Dhappy `zzip-config --cflags` LIBS = -Wl,-E `zzip-config --libs` my_prog.o : my_prog.c $(CC) $(CFLAGS) $< -o $@ my_prog : my_prog.o $(LINK) $< $(LIBS)
Be informed that the zzip-config script is low-maintained and starting with 2004 it will be replaced with a one-line script that simply reads `pkg-config zziplib $*`. By that time the rpm/deb packages will also list "pkgconfig" as a dependency on the zziplib-devel/zziplib-dev part.
There is currently an autoconf macro installed along into the usual /usr/share/aclocal space for making it easier for you to pick up the configure-time cflags/libs needed to build/link with zziplib. In any way it does look like this:
dnl PKG_CHECK_ZZIPLIB(ZSTUFF, min-version, action-if, action-not) AC_DEFUN([PKG_CHECK_ZZIPLIB],[dnl PKG_CHECK_MODULES([$1], [zziplib $2], [$3], [$4])])
You are strongly advised to take advantage of the pkgconfig's
macro directly - you can find the macro in
PKG_CHECK_MODULES([ZZIP],[zziplib >= 0.10.75])
which will provide you with two autoconf/automake variables
Up to 2004, the macro in zziplib.m4 will be however carry
a copy of the pkg.m4 so that you do not need another
dependency for your software project. The macro is called
like shown above PKG_CHECK_ZZIPLIB and you would call it