File StormLib.spec of Package StormLib

#
# spec file for package StormLib
#
# Copyright (c) 2021 SUSE LLC
#
# 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/
#


%define soname libstorm
%define sover 9

Name:           StormLib
Version:        9.23
Release:        0
Summary:        Library for work with Blizzard MPQ archive
License:        MIT
Group:          Development/Libraries/C and C++
Url:            http://www.zezula.net/mpq.html
Source0:        https://github.com/ladislav-zezula/StormLib/archive/v%{version}/StormLib-%{version}.tar.gz
Patch0:         clean-system-tomcrypt.patch
# PATCH-FIX-OPENSUSE -- Fix tommath on leap
Patch1:         tommath-leap.patch
BuildRequires:  c++_compiler
BuildRequires:  cmake
BuildRequires:  libtomcrypt-devel
BuildRequires:  libtommath-devel
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(zlib)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
StomLib library, an open-source project that can work with Blizzard MPQ archives.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{soname}%{sover} = %{version}

%description    devel
StomLib library, an open-source project that can work with Blizzard MPQ archives.
This package contains development files for %{name}.

%package     -n %{soname}%{sover}
Summary:        %{name} library
Group:          System/Libraries

%description -n %{soname}%{sover}
StomLib library, an open-source project that can work with Blizzard MPQ archives.
This package contains shared library for %{name}.

%prep
%setup -q
%patch0 -p1
%if 0%{?suse_version} <= 1500
# Fix leap (no LTM enabled in tomcrypt)
%patch1 -p1
%endif

# Remove bundled libraries (we use system provided ones)
rm -v -r src/{zlib,bzip2,libtomcrypt,libtommath}

%build
%cmake \
  -DBUILD_SHARED_LIBS=ON \
  -DSTORM_BUILD_TESTS=OFF \
  -DBUILD_DYNAMIC_MODULE=ON \
  -DWITH_LIBTOMCRYPT=ON
%make_build

%install
%cmake_install
%ifarch x86_64
mv -v %{buildroot}/%{_prefix}/lib %{buildroot}/%{_libdir}
%endif

%post -n %{soname}%{sover} -p /sbin/ldconfig
%postun -n %{soname}%{sover} -p /sbin/ldconfig

%files -n %{soname}%{sover}
%{_libdir}/%{soname}.so.%{sover}*

%files devel
%license LICENSE
%{_includedir}/Storm*
%{_libdir}/%{soname}.so

%changelog
openSUSE Build Service is sponsored by