File libhl2.spec of Package libhl2

#
# spec file for package libhl2
#
# Copyright (c) 2024 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/
#


Name:           libhl2
Version:        2.4.3
Release:        0
Summary:        Library for access Half-life files
License:        LGPL-2.1-or-later
Group:          Development/Libraries/Other
URL:            http://nemesis.thewavelength.net/index.php?c=108
# Repacked, removed windows binaries and dos2unix converted http://nemesis.thewavelength.net/files/files/hllib243.zip
Source0:        %{name}-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM libhl2-2.4.3-abuild.patch adam@mizerski.pl -- add missing headers
Patch0:         %{name}-2.4.3-abuild.patch
# PATCH-FIX-OPENSUSE libhl2-2.4.3-Makefile.patch adam@mizerski.pl -- let make accept some external values
Patch1:         %{name}-2.4.3-Makefile.patch
# PATCH-FIX-UPSTREAM libhl2-2.4.3-switch_default.patch adam@mizerski.pl -- Append "default:" to switches to get rid of "warning: enumeration value '...' not handled in switch"
Patch2:         %{name}-2.4.3-switch_default.patch
BuildRequires:  gcc-c++

%description
HLLib is a package library for Half-Life that abstracts several package formats and provides a simple interface for all of them. HLLib is written in native C++ but exposes both a C and C++ interface which can be used in any C or C++ application (additional languages may also use the library with standard C imports). HLLib works natively in both Windows and Linux. BSP, GCF, NCF, PAK, VPK, WAD, XZP and uncompressed ZIP package formats are supported.

%package devel
Summary:        HLLib headers
License:        LGPL-2.1-or-later
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description devel
This package contains files required to build applications that use HLLib.

%package -n hlextract
Summary:        Command line utility to access Half-life files
License:        GPL-2.0-or-later
Group:          Productivity/File utilities
URL:            https://developer.valvesoftware.com/wiki/HLLib#HLExtract
Requires:       %{name} = %{version}

%description -n hlextract
HLExtract is a command-line utility that can browse, extract, validate and defragment all supported packages. It provides a lean and mean shell-like interface for browsing as well as a command-line interface for automating tasks.

%prep
%autosetup -p1

%build
%make_build -C HLLib CXXFLAGS="%{optflags} -fno-strict-aliasing -fPIC -funroll-loops -fvisibility=hidden"
ln -s HLLib.h lib/hl.h
ln -s libhl.so.%{version} HLLib/libhl.so
gcc HLExtract/Main.c -o HLExtract/hlextract -lhl -L./HLLib -I./lib %{optflags}

%install
make -C HLLib -f Makefile PREFIX=%{buildroot}%{_prefix} LIB=/%{_lib} install
install -D HLExtract/hlextract %{buildroot}%{_bindir}/hlextract
chmod +x %{buildroot}%{_libdir}/libhl.so.2

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post devel -p /sbin/ldconfig
%postun devel -p /sbin/ldconfig

%files
%{_libdir}/libhl.so.2
%{_libdir}/libhl.so.%{version}
%doc Readme.txt LGPL.txt

%files devel
%{_includedir}/hl.h
%{_libdir}/libhl.so

%files -n hlextract
%{_bindir}/hlextract
%doc GPL.txt

%changelog
openSUSE Build Service is sponsored by