File libSOIL.spec of Package libSOIL

#
# spec file for package libSOIL
#
# 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/
#


%define soname 1

Name:           libSOIL
Version:        1.07.20080707
Release:        0
Summary:        Simple OpenGL Image Library
License:        SUSE-Public-Domain
Group:          System/Libraries
# Upstream URL dead.  Comment out for now until we find a new source.
#URL:            http://lonesock.net/soil.html
Source0:        soil.zip
# PATCH-FIX-UPSTREAM libSOIL-makefile.patch -- fix SuSE build/packaging issues
Patch0:         libSOIL-makefile.patch
BuildRequires:  Mesa-devel
BuildRequires:  unzip

%description
SOIL is a tiny C library used primarily for uploading textures into OpenGL.
It supports loading BMP, PNG, JPG, TGA, DDS, PSD and HDR files as well as
saving into TGA, BMP and DDS Files.
It is also able to perform common functions needed in loading OpenGL textures.

%package -n %{name}%{soname}
Summary:        Simple OpenGL Image Library
Group:          System/Libraries

%description -n %{name}%{soname}
SOIL is a tiny C library used primarily for uploading textures into OpenGL.
It supports loading BMP, PNG, JPG, TGA, DDS, PSD and HDR files as well as
saving into TGA, BMP and DDS Files.
It is also able to perform common functions needed in loading OpenGL textures.

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

%description devel
Headers and libraries to program against %{name}

%prep
# Can't use %%setup here, because the spaces within the extracted path
# blow up when -debug* packages are enabled.  Until the underlying macros
# are fixed, we must bypass the problem by removing the spaces from the
# source directory, thusly:
rm -rf %{name}-%{version}
unzip %{SOURCE0}
mv "Simple OpenGL Image Library" %{name}-%{version}
cd %{name}-%{version}
%patch -P0

%build
export CFLAGS='%{optflags}'
cd %{name}-%{version}
make %{?_smp_mflags} -C src -f ../projects/makefile/alternate\ Makefile.txt

%install
cd %{name}-%{version}
%make_install LIBDIR=%{_libdir} -C src -f ../projects/makefile/alternate\ Makefile.txt

%post -n %{name}%{soname} -p /sbin/ldconfig

%postun -n %{name}%{soname} -p /sbin/ldconfig

%files -n %{name}%{soname}
%defattr(0644, root, root, 0755)
%doc %{name}-%{version}/soil.html
%{_libdir}/%{name}.so.%{soname}*

%files devel
%defattr(0644, root, root, 0755)
%{_libdir}/%{name}.so
%{_includedir}/SOIL

%changelog
openSUSE Build Service is sponsored by