diff options
author | Sylvain Beucler <beuc@beuc.net> | 2012-12-16 20:18:29 (GMT) |
---|---|---|
committer | Sylvain Beucler <beuc@beuc.net> | 2012-12-18 01:21:16 (GMT) |
commit | 5e33afc27765c638700f9ca061468bcf65192339 (patch) | |
tree | 205331bb02cfafcb594142a23b5007fec3a52da9 | |
parent | 6124d1a06e4113b1fcd0bdfb7ce5f042aae9c779 (diff) | |
download | mxe-5e33afc27765c638700f9ca061468bcf65192339.zip mxe-5e33afc27765c638700f9ca061468bcf65192339.tar.gz mxe-5e33afc27765c638700f9ca061468bcf65192339.tar.bz2 |
Add build file for libzip
- Build against latest stable release
- Cross-compilation broke somewhere between 0.9 and 0.10, we could
recommend
http://www.sourceware.org/autobook/autobook/autobook_255.html
to upstream so they fix 'zip.h'.
Provided quick patch meanwhile.
- Added 'Requires: zlib' in the pkg-config file, we could suggest the
improvement to upstream
- _UPDATE rule implemented
- Test case included
Coded while hacking GNU FreeDink :)
-rw-r--r-- | index.html | 5 | ||||
-rw-r--r-- | src/libzip-1-static_build.patch | 21 | ||||
-rw-r--r-- | src/libzip-test.c | 42 | ||||
-rw-r--r-- | src/libzip.mk | 32 |
4 files changed, 100 insertions, 0 deletions
@@ -1597,6 +1597,11 @@ USE_OSGPLUGIN(<plugin2>) <td id="libxslt-website"><a href="http://xmlsoft.org/XSLT/">libxslt</a></td> </tr> <tr> + <td id="libzip-package">libzip</td> + <td id="libzip-version">0.10.1</td> + <td id="libzip-website"><a href="http://www.nih.at/libzip/">libzip</a></td> + </tr> + <tr> <td id="llvm-package">llvm</td> <td id="llvm-version">3.1</td> <td id="llvm-website"><a href="http://llvm.org/">llvm</a></td> diff --git a/src/libzip-1-static_build.patch b/src/libzip-1-static_build.patch new file mode 100644 index 0000000..e314263 --- /dev/null +++ b/src/libzip-1-static_build.patch @@ -0,0 +1,21 @@ +This file is part of MXE. +See index.html for further information. + +This is a quick&dirty fix. + +The bug is being discussed at +http://www.nih.at/listarchive/libzip-discuss/msg00304.html + +--- a/lib/zip.h 2012-03-15 10:28:05.000000000 +0100 ++++ b/lib/zip.h 2012-12-18 02:05:31.416621709 +0100 +@@ -37,8 +37,8 @@ + + + #ifndef ZIP_EXTERN +-#ifdef _WIN32 +-#define ZIP_EXTERN __declspec(dllimport) ++#ifdef _MSC_VER ++#define ZIP_EXTERN __declspec(dllexport) + #else + #define ZIP_EXTERN + #endif diff --git a/src/libzip-test.c b/src/libzip-test.c new file mode 100644 index 0000000..e23b325 --- /dev/null +++ b/src/libzip-test.c @@ -0,0 +1,42 @@ +/* + * This file is part of MXE. + * See index.html for further information. + */ + +#include <zip.h> +#include <stdlib.h> + +/* Adapted from freedink/src/SDL_rwops_libzip.c */ +int main(int argc, char* argv[]) +{ + struct zip* zarchive; + int errorp = 0; + + (void)argc; + (void)argv; + + zarchive = zip_open("idontexist.zip", ZIP_CHECKCONS, &errorp); + if (errorp != 0) + { + char *errorbuf = NULL; + int len = 1; + errorbuf = malloc(len); + len = zip_error_to_str(errorbuf, len, errorp, errno); + errorbuf = realloc(errorbuf, len + 1); + len = zip_error_to_str(errorbuf, len, errorp, errno); + fprintf(stderr, "zip_open: %s\n", errorbuf); + free(errorbuf); + } + else + { + struct zip_file* zfile; + zfile = zip_fopen(zarchive, "fichier.txt", 0); + if (zfile == NULL) + { + fprintf(stderr, "zip_open: %s\n", zip_strerror(zarchive)); + zip_close(zarchive); + } + } + + return 0; +} diff --git a/src/libzip.mk b/src/libzip.mk new file mode 100644 index 0000000..cf46022 --- /dev/null +++ b/src/libzip.mk @@ -0,0 +1,32 @@ +# This file is part of MXE. +# See index.html for further information. + +PKG := libzip +$(PKG)_IGNORE := +$(PKG)_CHECKSUM := 04be811a1919e1063a1f5210671181b7b5416d45 +$(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) +$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.bz2 +$(PKG)_URL := http://www.nih.at/libzip/$($(PKG)_FILE) +$(PKG)_DEPS := gcc zlib + +define $(PKG)_UPDATE + wget -q -O- 'http://www.nih.at/libzip/' | \ + $(SED) -n 's,.*libzip-\([0-9][^>]*\)\.tar.*,\1,p' | \ + head -1 +endef + +define $(PKG)_BUILD +# TODO: send a patch upstream + echo 'Requires: zlib' >> '$(1)/libzip.pc.in' + + cd '$(1)' && ./configure \ + --host='$(TARGET)' \ + --prefix='$(PREFIX)/$(TARGET)' \ + --disable-shared + $(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + + '$(TARGET)-gcc' \ + -W -Wall -Werror -ansi -pedantic \ + '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-libzip.exe' \ + `'$(TARGET)-pkg-config' libzip --cflags --libs` +endef |