Build minizip as separate package
This commit is contained in:
14
mingw-w64-minizip/001-library-name-compatibility.patch
Normal file
14
mingw-w64-minizip/001-library-name-compatibility.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- minizip-2.3.8/CMakeLists.txt.orig 2018-07-19 13:13:04.604557000 +0300
|
||||
+++ minizip-2.3.8/CMakeLists.txt 2018-07-19 13:16:08.627480400 +0300
|
||||
@@ -338,7 +338,10 @@
|
||||
${LZMA_SRC} ${LZMA_PUBLIC_HEADERS})
|
||||
|
||||
if (MINGW AND BUILD_SHARED_LIBS)
|
||||
- set_target_properties(${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_NAME "minizip")
|
||||
+ set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
+ ARCHIVE_OUTPUT_NAME "minizip"
|
||||
+ OUTPUT_NAME "minizip"
|
||||
+ RUNTIME_OUTPUT_NAME "libminizip-1")
|
||||
endif ()
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE C PREFIX ""
|
||||
20
mingw-w64-minizip/002-fix-pkg-config-file.patch
Normal file
20
mingw-w64-minizip/002-fix-pkg-config-file.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
--- minizip-2.3.8/minizip.pc.cmakein.orig 2018-07-19 13:28:03.146937300 +0300
|
||||
+++ minizip-2.3.8/minizip.pc.cmakein 2018-07-19 13:28:58.960235600 +0300
|
||||
@@ -1,13 +1,12 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
-exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
-libdir=@INSTALL_LIB_DIR@
|
||||
-sharedlibdir=@INSTALL_LIB_DIR@
|
||||
-includedir=@INSTALL_INC_DIR@
|
||||
+exec_prefix=${prefix}
|
||||
+libdir=${exec_prefix}/lib
|
||||
+includedir=${prefix}/include
|
||||
|
||||
Name: minizip
|
||||
Description: Minizip zip file manipulation library
|
||||
Version: @VERSION@
|
||||
|
||||
Requires: zlib
|
||||
-Libs: -L${libdir} -L${sharedlibdir} -lminizip
|
||||
+Libs: -L${libdir} -lminizip
|
||||
Cflags: -I${includedir}
|
||||
81
mingw-w64-minizip/PKGBUILD
Normal file
81
mingw-w64-minizip/PKGBUILD
Normal file
@@ -0,0 +1,81 @@
|
||||
# Maintainer: Andrew Sun <adsun701@gmail.com>
|
||||
|
||||
_realname=minizip
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
|
||||
pkgver=2.5.2
|
||||
pkgrel=1
|
||||
pkgdesc="Minizip zlib contribution fork with latest bug fixes that supports PKWARE disk splitting, AES encryption, and IO buffering (mingw-w64)"
|
||||
arch=('any')
|
||||
url='https://github.com/nmoinvaz/minizip/'
|
||||
license=('ZLIB')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
|
||||
"${MINGW_PACKAGE_PREFIX}-gcc")
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-bzip2"
|
||||
"${MINGW_PACKAGE_PREFIX}-gcc-libs"
|
||||
"${MINGW_PACKAGE_PREFIX}-zlib")
|
||||
source=("${_realname}-${pkgver}.tar.gz"::https://github.com/nmoinvaz/minizip/archive/${pkgver}.tar.gz
|
||||
001-library-name-compatibility.patch
|
||||
002-fix-pkg-config-file.patch)
|
||||
sha256sums=('1be872f44fb17688eb88ecc622d27d1e12608baa0cb59b2e6987a7e31d06afec'
|
||||
'9de7a5455582ba2d2b774933984b0ff6d223ad55f6aed866b21957fd423c0fcf'
|
||||
'000a68eca4f426ada798d34aab82c8bb8546a79bbbc51d3aa45c7c9de66e49bf')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}"/${_realname}-${pkgver}
|
||||
patch -p1 -i ${srcdir}/001-library-name-compatibility.patch
|
||||
patch -p1 -i ${srcdir}/002-fix-pkg-config-file.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
declare -a extra_config
|
||||
if check_option "debug" "n"; then
|
||||
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
|
||||
else
|
||||
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
|
||||
fi
|
||||
|
||||
[[ -d "${srcdir}"/shared-${CARCH} ]] && rm -rf "${srcdir}"/shared-${CARCH}
|
||||
mkdir -p "${srcdir}"/shared-${CARCH} && cd "${srcdir}"/shared-${CARCH}
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
${MINGW_PREFIX}/bin/cmake \
|
||||
-G'MSYS Makefiles' \
|
||||
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
|
||||
-DUSE_ZLIB=ON \
|
||||
-DUSE_BZIP2=ON \
|
||||
-DUSE_LZMA=ON \
|
||||
-DUSE_PKCRYPT=ON \
|
||||
-DUSE_AES=ON \
|
||||
"${extra_config[@]}" \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
../${_realname}-${pkgver}
|
||||
make
|
||||
|
||||
[[ -d "${srcdir}"/static-${CARCH} ]] && rm -rf "${srcdir}"/static-${CARCH}
|
||||
mkdir -p "${srcdir}"/static-${CARCH} && cd "${srcdir}"/static-${CARCH}
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
${MINGW_PREFIX}/bin/cmake \
|
||||
-G'MSYS Makefiles' \
|
||||
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
|
||||
-DUSE_ZLIB=ON \
|
||||
-DUSE_BZIP2=ON \
|
||||
-DUSE_LZMA=ON \
|
||||
-DUSE_PKCRYPT=ON \
|
||||
-DUSE_AES=ON \
|
||||
"${extra_config[@]}" \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
../${_realname}-${pkgver}
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}"/static-${CARCH}
|
||||
make install DESTDIR="${pkgdir}"
|
||||
|
||||
cd "${srcdir}"/shared-${CARCH}
|
||||
make install DESTDIR="${pkgdir}"
|
||||
|
||||
install -Dm0644 ${srcdir}/${_realname}-${pkgver}/LICENSE ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
From c162a3620a3d0d317f59af8ddc2d1605bf5ee4b3 Mon Sep 17 00:00:00 2001
|
||||
From: martell <martellmalone@gmail.com>
|
||||
Date: Sat, 11 Oct 2014 03:32:38 +0100
|
||||
Subject: [PATCH 1/3] unzip: add function unzOpenBuffer
|
||||
|
||||
---
|
||||
Makefile.am | 1 +
|
||||
unzip.c | 11 +++++++++++
|
||||
unzip.h | 2 ++
|
||||
3 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index d83fee7..e2958e6 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -19,6 +19,7 @@ libminizip_la_SOURCES = \
|
||||
ioapi.c \
|
||||
unzip.c \
|
||||
zip.c \
|
||||
+ ioapi_mem.c \
|
||||
${iowin32_src}
|
||||
|
||||
libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
|
||||
diff --git a/unzip.c b/unzip.c
|
||||
index 11030cb..1f4bdda 100644
|
||||
--- a/unzip.c
|
||||
+++ b/unzip.c
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "zlib.h"
|
||||
#include "unzip.h"
|
||||
+#include "ioapi_mem.h"
|
||||
|
||||
#ifdef HAVE_AES
|
||||
# define AES_METHOD (99)
|
||||
@@ -553,6 +554,16 @@ extern unzFile ZEXPORT unzOpen64(const void *path)
|
||||
return unzOpenInternal(path, NULL);
|
||||
}
|
||||
|
||||
+extern unzFile ZEXPORT unzOpenBuffer(const void* buffer, uLong size)
|
||||
+{
|
||||
+ char path[48] = {0};
|
||||
+ ourmemory_t FileMemory;
|
||||
+ zlib_filefunc64_32_def memory_file;
|
||||
+ sprintf(path, "%llx %lx", (unsigned long long)buffer, (unsigned long)size);
|
||||
+ fill_memory_filefunc(&memory_file, &FileMemory);
|
||||
+ return unzOpenInternal(path, &memory_file);
|
||||
+}
|
||||
+
|
||||
extern int ZEXPORT unzClose(unzFile file)
|
||||
{
|
||||
unz64_s *s;
|
||||
diff --git a/unzip.h b/unzip.h
|
||||
index 1aa197f..8503471 100644
|
||||
--- a/unzip.h
|
||||
+++ b/unzip.h
|
||||
@@ -131,6 +131,8 @@ extern unzFile ZEXPORT unzOpen64(const void *path);
|
||||
open64_file_func callback. Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path
|
||||
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char *does not describe the reality */
|
||||
|
||||
+extern unzFile ZEXPORT unzOpenBuffer OF((const void* buffer, uLong size));
|
||||
+/* Open a Zip file, like unzOpen, but from a buffer */
|
||||
extern unzFile ZEXPORT unzOpen2(const char *path, zlib_filefunc_def *pzlib_filefunc_def);
|
||||
/* Open a Zip file, like unzOpen, but provide a set of file low level API for read/write operations */
|
||||
extern unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def);
|
||||
--
|
||||
2.1.2
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From 6fcaf7683d06488f451107fe0466ec8f91572096 Mon Sep 17 00:00:00 2001
|
||||
From: Alexpux <alexey.pawlow@gmail.com>
|
||||
Date: Mon, 13 Oct 2014 07:23:44 +0400
|
||||
Subject: [PATCH 2/3] Add -no-undefined to link to enable build shared version
|
||||
with mingw.
|
||||
|
||||
---
|
||||
Makefile.am | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index e2958e6..9a6ab44 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -22,7 +22,7 @@ libminizip_la_SOURCES = \
|
||||
ioapi_mem.c \
|
||||
${iowin32_src}
|
||||
|
||||
-libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
|
||||
+libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -no-undefined -lz
|
||||
|
||||
minizip_includedir = $(includedir)/minizip
|
||||
minizip_include_HEADERS = \
|
||||
--
|
||||
2.1.2
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
From d6c5f14af2f9368032efbcfd0928b73d98379c92 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Pavlov <alexey.pawlow@gmail.com>
|
||||
Date: Tue, 28 Oct 2014 14:15:56 +0300
|
||||
Subject: [PATCH 3/3] Add bzip2 library to pkg-config file.
|
||||
|
||||
---
|
||||
minizip.pc.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/minizip.pc.in b/minizip.pc.in
|
||||
index 69b5b7f..2cc4787 100644
|
||||
--- a/minizip.pc.in
|
||||
+++ b/minizip.pc.in
|
||||
@@ -8,5 +8,5 @@ Description: Minizip zip file manipulation library
|
||||
Requires:
|
||||
Version: @PACKAGE_VERSION@
|
||||
Libs: -L${libdir} -lminizip
|
||||
-Libs.private: -lz
|
||||
+Libs.private: -lz -lbz2
|
||||
Cflags: -I${includedir}
|
||||
--
|
||||
2.1.2
|
||||
|
||||
@@ -7,36 +7,23 @@ _realname=zlib
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
|
||||
pkgver=1.2.11
|
||||
pkgrel=3
|
||||
pkgrel=4
|
||||
pkgdesc="Compression library implementing the deflate compression method found in gzip and PKZIP (mingw-w64)"
|
||||
arch=('any')
|
||||
license=(ZLIB)
|
||||
url="https://www.zlib.net/"
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-bzip2")
|
||||
makedepends=('git')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
|
||||
options=('staticlibs')
|
||||
source=("https://zlib.net/current/${_realname}-${pkgver}.tar.gz"
|
||||
"git+https://github.com/nmoinvaz/minizip.git#commit=7914ff3c"
|
||||
01-zlib-1.2.11-1-buildsys.mingw.patch
|
||||
03-dont-put-sodir-into-L.mingw.patch
|
||||
04-fix-largefile-support.patch
|
||||
010-unzip-add-function-unzOpenBuffer.patch
|
||||
011-Add-no-undefined-to-link-to-enable-build-shared-vers.patch
|
||||
012-Add-bzip2-library-to-pkg-config-file.patch)
|
||||
04-fix-largefile-support.patch)
|
||||
sha256sums=('c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1'
|
||||
'SKIP'
|
||||
'ac91f905b695d71f6c9c471ac98c14a3ed989a1e2b2a3b1171b3f6dc6bfc31b4'
|
||||
'3d039f42194aade91dadf4174f55fd6db349fd8044db93875bed1042dcfe1f31'
|
||||
'3b36fe536a7458af2a9a494d70d24048da10c43423fd620ed93fa0a6ddd14f78'
|
||||
'e3e85ac0df92d4b0a777631c064ae92c9a73d9f8baea93d35e01620838c4010d'
|
||||
'ebf118d3754c1cb9a07f391bfdb24d2941bc4e11a7b3956b17fa095f97e6eae8'
|
||||
'08269402dc15bb6d1600e011633ca3ace43e2d74613fdabdd516a05f5939cc78')
|
||||
'3b36fe536a7458af2a9a494d70d24048da10c43423fd620ed93fa0a6ddd14f78')
|
||||
|
||||
prepare() {
|
||||
# Replace minizip with external
|
||||
rm -rf ${srcdir}/${_realname}-${pkgver}/contrib/minizip
|
||||
cp -r ${srcdir}/minizip/ ${srcdir}/${_realname}-${pkgver}/contrib
|
||||
|
||||
cd ${srcdir}/${_realname}-${pkgver}
|
||||
grep -A 24 '^ Copyright' zlib.h > LICENSE
|
||||
|
||||
@@ -44,31 +31,12 @@ prepare() {
|
||||
patch -p2 -i ${srcdir}/03-dont-put-sodir-into-L.mingw.patch
|
||||
patch -p1 -i ${srcdir}/04-fix-largefile-support.patch
|
||||
|
||||
cd ${srcdir}/${_realname}-${pkgver}/contrib/minizip
|
||||
git am ${srcdir}/010-unzip-add-function-unzOpenBuffer.patch
|
||||
git am ${srcdir}/011-Add-no-undefined-to-link-to-enable-build-shared-vers.patch
|
||||
git am ${srcdir}/012-Add-bzip2-library-to-pkg-config-file.patch
|
||||
|
||||
}
|
||||
|
||||
build() {
|
||||
cd ${srcdir}/${_realname}-${pkgver}
|
||||
CHOST=${MINGW_CHOST} ./configure --prefix=${MINGW_PREFIX} --shared
|
||||
make -j1 all
|
||||
|
||||
# build minizip
|
||||
pushd contrib/minizip > /dev/null
|
||||
autoreconf -fi
|
||||
CFLAGS+=" -DHAVE_BZIP2"
|
||||
./configure \
|
||||
--prefix=${MINGW_PREFIX} \
|
||||
--build=${MINGW_CHOST} \
|
||||
--host=${MINGW_CHOST} \
|
||||
--target=${MINGW_CHOST} \
|
||||
--enable-demos \
|
||||
LIBS="-lbz2"
|
||||
make
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
check() {
|
||||
@@ -79,8 +47,5 @@ check() {
|
||||
package() {
|
||||
cd ${srcdir}/${_realname}-${pkgver}
|
||||
make install DESTDIR="${pkgdir}"
|
||||
pushd contrib/minizip > /dev/null
|
||||
make install DESTDIR="${pkgdir}"
|
||||
popd > /dev/null
|
||||
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user