File unrar.spec of Package unrar

#
# spec file for package unrar
#
# Copyright (c) 2023 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 https://bugs.opensuse.org/
#


# majorversion should match the major version number.
%define majorversion 7
%define libsuffix 7_0_6
Name:           unrar
Version:        7.0.6
Release:        0
Summary:        A program to extract, test, and view RAR archives
License:        NonFree
URL:            https://www.rarlab.com
Source0:        https://www.rarlab.com/rar/%{name}src-%{version}.tar.gz
Source1:        unrar.1
Source99:       baselibs.conf
Patch1:         soname.patch
BuildRequires:  gcc-c++
%{?suse_build_hwcaps_libs}

%description
The unRAR utility is a freeware program distributed with source code
and developed for extracting, testing, and viewing the contents of
archives created with the RAR archiver.

%package -n libunrar%{libsuffix}
Summary:        Decompress library for RAR archives
Group:          System/Libraries

%description -n libunrar%{libsuffix}
The libunrar library allows programs linking against it to decompress
existing RAR v3 archives.

%package -n libunrar-devel
Summary:        Development files for libunrar
Group:          Development/Libraries/C and C++
Requires:       libunrar%{libsuffix} = %{version}

%description -n libunrar-devel
The libunrar-devel package contains libraries and header files for
developing applications that use libunrar.

%prep
%autosetup -n %{name} -p1

sed -i 's/\r$//' *.txt

%build
%make_build -f makefile unrar lib libversion=%{version} CXXFLAGS="%{optflags} -fPIC -fno-strict-aliasing" STRIP=true

%install
install -Dpm 0755 unrar \
  %{buildroot}%{_bindir}/unrar
install -Dpm 0644 %{SOURCE1} \
  %{buildroot}%{_mandir}/man1/unrar.1
install -Dpm 0755 libunrar.so.%{version} \
    %{buildroot}%{_libdir}/libunrar.so.%{version}
install -Dpm 0644 dll.hpp \
  %{buildroot}/%{_includedir}/unrar/dll.hpp
ln -s libunrar.so.%{version} \
    %{buildroot}%{_libdir}/libunrar.so

%post -n libunrar%{libsuffix} -p /sbin/ldconfig
%postun -n libunrar%{libsuffix} -p /sbin/ldconfig

%files
%license license.txt
%doc acknow.txt readme.txt
%{_bindir}/unrar
%{_mandir}/man1/unrar.1%{?ext_man}

%files -n libunrar%{libsuffix}
%license license.txt
%{_libdir}/*.so.%{version}

%files -n libunrar-devel
%license license.txt
%doc acknow.txt readme.txt
%{_includedir}/*
%{_libdir}/*.so

%changelog
openSUSE Build Service is sponsored by