diff --git a/.gitignore b/.gitignore index db1ae0b..55a4c53 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /miniz_v115_r4.7z +/miniz-2.1.0.zip diff --git a/miniz-2.1.0-Examples-to-include-system-miniz.h.patch b/miniz-2.1.0-Examples-to-include-system-miniz.h.patch new file mode 100644 index 0000000..945120a --- /dev/null +++ b/miniz-2.1.0-Examples-to-include-system-miniz.h.patch @@ -0,0 +1,101 @@ +From 2eeb23af281f056cd0a628a019ee70ccf8c61c25 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +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ř +--- + 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 +-#include "miniz.h" ++#include + 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 +-#include "miniz_zip.h" ++#include + + 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 + #include +-#include "miniz.h" ++#include + + 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 + #include + #include + +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 + + // Now include stdio.h because this test uses fopen(), etc. (but we still don't want miniz.c's stdio stuff, for testing). + #include +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 + + // Now include stdio.h because this test uses fopen(), etc. (but we still don't want miniz.c's stdio stuff, for testing). + #include +-- +2.20.1 + diff --git a/.rpmlint b/miniz.rpmlintrc similarity index 100% rename from .rpmlint rename to miniz.rpmlintrc diff --git a/miniz.spec b/miniz.spec index 1468fe3..08ffce9 100644 --- a/miniz.spec +++ b/miniz.spec @@ -1,18 +1,23 @@ -%global miniz_revision r4 - Name: miniz -Version: 1.15 -Release: 12.%{miniz_revision}%{?dist} +Version: 2.1.0 +Release: 1%{?dist} Summary: Compression library implementing the zlib and Deflate -License: Unlicense -URL: https://code.google.com/p/%{name}/ -Source0: https://%{name}.googlecode.com/files/%{name}_v%(echo '%{version}' | tr -d .)_%{miniz_revision}.7z +# LICENSE: MIT text +# miniz.c: MIT +# 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: findutils +# diffutils for cmp +BuildRequires: diffutils BuildRequires: gcc -BuildRequires: gcc-c++ -BuildRequires: p7zip -BuildRequires: sed +BuildRequires: unzip %description 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 -%setup -c -T -n %{name}-%{version}_%{miniz_revision} -7za e '%{SOURCE0}' -# Remove prebuilt executables -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_tester.cpp +%setup -c -T -n %{name}-%{version} +unzip -e '%{SOURCE0}' +%patch0 -p1 -%global soname lib%{name}.so.0.1 +%global soname lib%{name}.so.0.2 %build -# Upstream CMakeLists.txt does not produce a library, build it. # Inject downstream SONAME, bug #1152653 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} \ %{name}.o -o %{soname} ln -s %{soname} lib%{name}.so -# Build test against the library -g++ %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \ - -I. miniz_tester.cpp -c -o miniz_tester.o -g++ %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \ - -I. timer.cpp -c -o timer.o -g++ %{?__global_ldflags} miniz_tester.o timer.o -L. -l%{name} -o miniz_tester +# Build examples against the library +pushd examples +for EXAMPLE in *.c; do + EXAMPLE=${EXAMPLE%.c} + gcc %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \ + -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 -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 -d '%{buildroot}/%{_libdir}' @@ -71,17 +101,24 @@ ln -s %{soname} '%{buildroot}/%{_libdir}/lib%{name}.so' install -d '%{buildroot}/%{_includedir}' install -m 0644 %{name}.h '%{buildroot}/%{_includedir}' -%ldconfig_scriptlets - %files +%license LICENSE +%doc ChangeLog.md readme.md %{_libdir}/%{soname} %files devel +%doc examples/*.c %{_includedir}/%{name}.h %{_libdir}/lib%{name}.so %changelog +* Wed May 22 2019 Petr Pisar - 2.1.0-1 +- 2.1.0 bump +- Upstream moved to +- License changed from "Unlicense" to "MIT and Unlicense" +- ABI changed, API preserved + * Fri Feb 01 2019 Fedora Release Engineering - 1.15-12.r4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index 86ba868..bac90ab 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f3146e44ef1182467592e2f2f4665260 miniz_v115_r4.7z +SHA512 (miniz-2.1.0.zip) = 03fb5d351e83b8e26bc9bb342dcfcd975c7838d5900ca57460364d40151cb9638254ee51393b6c665f4a1d5bb1e901e5c761cb9d5b9c3ede9f1cd20ad14be609