File libminiz0_1.spec of Package libminiz0_1

#
# spec file for package libminiz0_1
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%global soname libminiz.so.0.1

Name:           libminiz0_1
Version:        2.0.7
Release:        0
Summary:        Single C source file zlib-replacement library
License:        Unlicense
Group:          Development/Libraries/C and C++
Url:            https://github.com/richgel999/miniz
Source0:        https://github.com/richgel999/miniz/archive/%{version}.tar.gz
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Miniz is a lossless, high performance data compression library in a single source file that implements the zlib (RFC 1950) and Deflate (RFC 1951) compressed data format specification standards. It supports the most commonly used functions exported by the zlib library, but is a completely independent implementation so zlib's licensing requirements do not apply. Miniz also contains simple to use functions for writing .PNG format image files and reading/writing/appending .ZIP format archives. Miniz's compression speed has been tuned to be comparable to zlib's, and it also has a specialized real-time compressor function designed to compare well against fastlz/minilzo.

%package devel
Group:      Development/Libraries/C and C++
Summary:    Development files for the miniz library
Requires:   %{name}%{?_isa} = %{version}-%{release}
Requires:   gcc%{?_isa}

%description devel
Header files for developing applications that use the miniz library.

%prep
%setup -q -n miniz-%{version}

%build
#%%configure
#cmake . \
#  -DCMAKE_INSTALL_PREFIX=%%{_prefix} \
#  -DCINSTALL_LIB_DIR=%%{_lib} \
#  -DCINSTALL_LIBDATA_DIR=%%{_lib}
#make %%{?_smp_mflags} VERBOSE=1

# 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 miniz.c -c -o miniz.o
gcc %{?__global_ldflags} -fPIC -shared -Wl,-soname,%{soname} \
    miniz.o -o %{soname}
ln -s %{soname} libminiz.so
# Build test against the library
g++ %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \
    -I. tests/miniz_tester.cpp -c -o miniz_tester.o
g++ %{optflags} -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 \
    -I. tests/timer.cpp -c -o timer.o
#g++ %{?__global_ldflags} -L. -lminiz miniz_tester.o timer.o -o miniz_tester


%install
#%%make_install
install -d '%{buildroot}/%{_libdir}'
install %{soname} '%{buildroot}/%{_libdir}'
ln -s %{soname} '%{buildroot}/%{_libdir}/libminiz.so'
install -d '%{buildroot}/%{_includedir}'
install -m 0644 miniz.h '%{buildroot}/%{_includedir}'


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc
%{_libdir}/%{soname}

%files devel
%defattr(-,root,root)
%{_includedir}/miniz.h
%{_libdir}/libminiz.so

%changelog
openSUSE Build Service is sponsored by