File tagparser.spec of Package tagparser

#
# spec file for package tagparser
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 Martchus
#
# 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 reponame tagparser
%define soname 12

Name:           %{reponame}
Version:        12.0.0
Release:        0
Summary:        C++ library for reading and writing tags supporting various formats
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Url:            https://github.com/Martchus/%{reponame}
Source:         %{reponame}-%{version}.tar.xz
%if (0%{?suse_version} > 1500) || (0%{?fedora} && 0%{?fedora_version} > 40)
BuildRequires:  iso-codes
BuildRequires:  cmake >= 3.19
%else
Source1:        https://martchus.no-ip.biz/src/iso_language_codes.h
BuildRequires:  cmake >= 3.9
%endif
%if 0%{?fedora}
%else
BuildRequires:  ninja
%endif
%if 0%{?sle_version} && 0%{?sle_version} < 160000
BuildRequires:  gcc9-c++
%else
BuildRequires:  gcc-c++
%endif
BuildRequires:  c++utilities-devel
BuildRequires:  pkgconfig
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
C++ library for reading and writing MP4/M4A/AAC (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
This text was intentionally added to make the description larger than the summary.

%package -n lib%{reponame}%{soname}
Summary:        C++ library for reading and writing tags supporting various formats
Group:          System/Libraries

%description -n lib%{reponame}%{soname}
C++ library for reading and writing MP4/M4A/AAC (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
This text was intentionally added to make the description larger than the summary.

%package devel
Summary:        Devel files for %{reponame}
Group:          Development/Libraries/C and C++
Requires:       c++utilities-devel
Requires:       lib%{reponame}%{soname} = %{version}
Requires:       zlib-devel

%description devel
Development files for %{reponame}

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

%build
%if (0%{?suse_version} > 1500) || (0%{?fedora} && 0%{?fedora_version} > 40)
%else
echo '' > "cmake/scripts/generate_iso_language_codes.cmake"
%endif
%if 0%{?sle_version} && 0%{?sle_version} < 160000
export CC=gcc-9
export CXX=g++-9
%endif
%if 0%{?fedora}
%else
%define __builder ninja
%endif
%cmake \
  -DBUILD_SHARED_LIBS:BOOL=ON
%if (0%{?suse_version} > 1500) || (0%{?fedora} && 0%{?fedora_version} > 40)
%else
%if 0%{?fedora}
%if 0%{?fedora} && 0%{?fedora_version} < 33
cp --target-directory="resources" "${PWD}/../../SOURCES/iso_language_codes.h"
%else
cp --target-directory="%{__cmake_builddir}/resources" "${PWD}/../../SOURCES/iso_language_codes.h"
%endif
%else
cp --target-directory="resources" "${OLDPWD:-$PWD}/../../SOURCES/iso_language_codes.h"
%endif
%endif
%if 0%{?fedora} && 0%{?fedora_version} < 33
make %{?_smp_mflags}
%else
%cmake_build
%endif

%install
%if 0%{?fedora} && 0%{?fedora_version} < 33
DESTDIR=%{buildroot} make %{?_smp_mflags} install
%else
%cmake_install
%endif

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

%files -n lib%{reponame}%{soname}
%license LICENSE
%{_libdir}/lib%{reponame}.so.%{soname}*

%files devel
%doc README.md
%{_includedir}/%{reponame}
%{_datadir}/%{reponame}
%{_libdir}/pkgconfig/%{reponame}.pc
%{_libdir}/lib%{reponame}.so

%changelog
openSUSE Build Service is sponsored by