ABI incompatibility: struct mz_zip_archive_file_stat changed a layout.
epel9
Petr Písař 6 years ago
parent 608db4ebad
commit 905d8d0b18

1
.gitignore vendored

@ -1 +1,2 @@
/miniz_v115_r4.7z /miniz_v115_r4.7z
/miniz-2.1.0.zip

@ -0,0 +1,101 @@
From 2eeb23af281f056cd0a628a019ee70ccf8c61c25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 22 May 2019 12:34:13 +0200
Subject: [PATCH] Examples to include system miniz.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We build miniz as a dynamic library. Adjust examples to use miniz
header file from system a location.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
examples/example1.c | 2 +-
examples/example2.c | 2 +-
examples/example3.c | 2 +-
examples/example4.c | 2 +-
examples/example5.c | 2 +-
examples/example6.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/examples/example1.c b/examples/example1.c
index d6e33fa..7cb2556 100644
--- a/examples/example1.c
+++ b/examples/example1.c
@@ -1,7 +1,7 @@
// example1.c - Demonstrates miniz.c's compress() and uncompress() functions (same as zlib's).
// Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c.
#include <stdio.h>
-#include "miniz.h"
+#include <miniz.h>
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint;
diff --git a/examples/example2.c b/examples/example2.c
index c3a84ba..bc9fba5 100644
--- a/examples/example2.c
+++ b/examples/example2.c
@@ -13,7 +13,7 @@
#endif
#include <stdio.h>
-#include "miniz_zip.h"
+#include <miniz.h>
typedef unsigned char uint8;
typedef unsigned short uint16;
diff --git a/examples/example3.c b/examples/example3.c
index a97ba84..7aaac31 100644
--- a/examples/example3.c
+++ b/examples/example3.c
@@ -3,7 +3,7 @@
// For simplicity, this example is limited to files smaller than 4GB, but this is not a limitation of miniz.c.
#include <stdio.h>
#include <limits.h>
-#include "miniz.h"
+#include <miniz.h>
typedef unsigned char uint8;
typedef unsigned short uint16;
diff --git a/examples/example4.c b/examples/example4.c
index eb591d4..2e6d3f6 100644
--- a/examples/example4.c
+++ b/examples/example4.c
@@ -1,6 +1,6 @@
// example4.c - Uses tinfl.c to decompress a zlib stream in memory to an output file
// Public domain, May 15 2011, Rich Geldreich, richgel99@gmail.com. See "unlicense" statement at the end of tinfl.c.
-#include "miniz_tinfl.h"
+#include <miniz.h>
#include <stdio.h>
#include <limits.h>
diff --git a/examples/example5.c b/examples/example5.c
index a190357..0d93a9a 100644
--- a/examples/example5.c
+++ b/examples/example5.c
@@ -9,7 +9,7 @@
#define MINIZ_NO_TIME
#define MINIZ_NO_ZLIB_APIS
#define MINIZ_NO_MALLOC
-#include "miniz.h"
+#include <miniz.h>
// Now include stdio.h because this test uses fopen(), etc. (but we still don't want miniz.c's stdio stuff, for testing).
#include <stdio.h>
diff --git a/examples/example6.c b/examples/example6.c
index abbb64f..7878848 100644
--- a/examples/example6.c
+++ b/examples/example6.c
@@ -7,7 +7,7 @@
#define MINIZ_NO_STDIO
#define MINIZ_NO_TIME
#define MINIZ_NO_ZLIB_APIS
-#include "miniz.h"
+#include <miniz.h>
// Now include stdio.h because this test uses fopen(), etc. (but we still don't want miniz.c's stdio stuff, for testing).
#include <stdio.h>
--
2.20.1

@ -1,18 +1,23 @@
%global miniz_revision r4
Name: miniz Name: miniz
Version: 1.15 Version: 2.1.0
Release: 12.%{miniz_revision}%{?dist} Release: 1%{?dist}
Summary: Compression library implementing the zlib and Deflate Summary: Compression library implementing the zlib and Deflate
License: Unlicense # LICENSE: MIT text
URL: https://code.google.com/p/%{name}/ # miniz.c: MIT
Source0: https://%{name}.googlecode.com/files/%{name}_v%(echo '%{version}' | tr -d .)_%{miniz_revision}.7z # examples/example1.c: Unlicense (refers to "unlicense" statement at the end
# of tinfl.c from miniz-1.15)
# miniz.h: Unlicense (See "unlicense" statement at the end of this file.)
License: MIT and Unlicense
URL: https://github.com/richgel999/%{name}
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.zip
# Adjust examples for building against a system miniz library,
# not suitable for upstream that prefers a copy-lib approach.
Patch0: miniz-2.1.0-Examples-to-include-system-miniz.h.patch
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: findutils # diffutils for cmp
BuildRequires: diffutils
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: unzip
BuildRequires: p7zip
BuildRequires: sed
%description %description
Miniz is a lossless, high performance data compression library in a single Miniz is a lossless, high performance data compression library in a single
@ -35,34 +40,59 @@ Header files for developing applications that use the %{name} library.
%prep %prep
%setup -c -T -n %{name}-%{version}_%{miniz_revision} %setup -c -T -n %{name}-%{version}
7za e '%{SOURCE0}' unzip -e '%{SOURCE0}'
# Remove prebuilt executables %patch0 -p1
find -name '*.exe' -exec rm -- {} +
# Extract a header file
sed -e '/End of Header/q' < %{name}.c > %{name}.h
# Prepare test for linking against the library
sed -i -e 's/#include "miniz.c"/#include <miniz.h>/' miniz_tester.cpp
%global soname lib%{name}.so.0.1 %global soname lib%{name}.so.0.2
%build %build
# Upstream CMakeLists.txt does not produce a library, build it.
# Inject downstream SONAME, bug #1152653 # Inject downstream SONAME, bug #1152653
gcc %{optflags} -fPIC -DPIC -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \ gcc %{optflags} -fPIC -DPIC -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \
-fno-strict-aliasing %{name}.c -c -o %{name}.o %{name}.c -c -o %{name}.o
gcc %{?__global_ldflags} -fPIC -shared -Wl,-soname,%{soname} \ gcc %{?__global_ldflags} -fPIC -shared -Wl,-soname,%{soname} \
%{name}.o -o %{soname} %{name}.o -o %{soname}
ln -s %{soname} lib%{name}.so ln -s %{soname} lib%{name}.so
# Build test against the library # Build examples against the library
g++ %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \ pushd examples
-I. miniz_tester.cpp -c -o miniz_tester.o for EXAMPLE in *.c; do
g++ %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \ EXAMPLE=${EXAMPLE%.c}
-I. timer.cpp -c -o timer.o gcc %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \
g++ %{?__global_ldflags} miniz_tester.o timer.o -L. -l%{name} -o miniz_tester -I.. "${EXAMPLE}.c" -c -o "${EXAMPLE}.o"
case "$EXAMPLE" in
example6)
gcc %{?__global_ldflags} "${EXAMPLE}.o" -L.. -l%{name} -lm -o "$EXAMPLE"
;;
*)
gcc %{?__global_ldflags} "${EXAMPLE}.o" -L.. -l%{name} -o "$EXAMPLE"
;;
esac
done
%check %check
LD_LIBRARY_PATH=$PWD ./miniz_tester pushd examples
for EXAMPLE in *.c; do
EXAMPLE=${EXAMPLE%.c}
case "$EXAMPLE" in
example3)
LD_LIBRARY_PATH=.. "./${EXAMPLE}" c ../readme.md readme.md.z
LD_LIBRARY_PATH=.. "./${EXAMPLE}" d readme.md.z readme.md
cmp ../readme.md readme.md
;;
example4)
LD_LIBRARY_PATH=.. "./${EXAMPLE}" readme.md.z readme.md
cmp ../readme.md readme.md
;;
example5)
LD_LIBRARY_PATH=.. "./${EXAMPLE}" c ../readme.md readme.md.z
LD_LIBRARY_PATH=.. "./${EXAMPLE}" d readme.md.z readme.md
cmp ../readme.md readme.md
;;
*)
LD_LIBRARY_PATH=.. "./${EXAMPLE}"
;;
esac
done
%install %install
install -d '%{buildroot}/%{_libdir}' install -d '%{buildroot}/%{_libdir}'
@ -71,17 +101,24 @@ ln -s %{soname} '%{buildroot}/%{_libdir}/lib%{name}.so'
install -d '%{buildroot}/%{_includedir}' install -d '%{buildroot}/%{_includedir}'
install -m 0644 %{name}.h '%{buildroot}/%{_includedir}' install -m 0644 %{name}.h '%{buildroot}/%{_includedir}'
%ldconfig_scriptlets
%files %files
%license LICENSE
%doc ChangeLog.md readme.md
%{_libdir}/%{soname} %{_libdir}/%{soname}
%files devel %files devel
%doc examples/*.c
%{_includedir}/%{name}.h %{_includedir}/%{name}.h
%{_libdir}/lib%{name}.so %{_libdir}/lib%{name}.so
%changelog %changelog
* Wed May 22 2019 Petr Pisar <ppisar@redhat.com> - 2.1.0-1
- 2.1.0 bump
- Upstream moved to <https://github.com/richgel999/miniz>
- License changed from "Unlicense" to "MIT and Unlicense"
- ABI changed, API preserved
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.15-12.r4 * Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.15-12.r4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

@ -1 +1 @@
f3146e44ef1182467592e2f2f4665260 miniz_v115_r4.7z SHA512 (miniz-2.1.0.zip) = 03fb5d351e83b8e26bc9bb342dcfcd975c7838d5900ca57460364d40151cb9638254ee51393b6c665f4a1d5bb1e901e5c761cb9d5b9c3ede9f1cd20ad14be609

Loading…
Cancel
Save