File clanlib1.spec of Package clanlib1

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


Name:           clanlib1
Version:        1.0.0
Release:        0
Summary:        Cross Platform C++ Toolkit Library
License:        GPL-2.0-or-later
Group:          System/Libraries
URL:            http://www.clanlib.org/
# https://github.com/sphair/ClanLib
Source0:        http://clanlib.org/download/releases-1.0/ClanLib-%{version}.tgz
# PATCH-FIX-UPSTREAM ClanLib-0.8.0-gcc43.patch asterios.dramis@gmail.com -- Fix building with gcc 4.3
Patch0:         ClanLib-0.8.0-gcc43.patch
# PATCH-FIX-UPSTREAM ClanLib-1.0.0-libpng15.patch
Patch1:         ClanLib-1.0.0-libpng15.patch
# PATCH-FIX-UPSTREAM ClanLib-1.0.0-gcc6-c++14.patch - Fix build with gcc6 which defaults to c++14
Patch2:         ClanLib-1.0.0-gcc6-c++14.patch
# PATCH-FIX-UPSTREAM fix-perl.patch -- Fix build with Perl > 5.3
Patch3:         fix-perl.patch
# PATCH-FIX-UPSTREAM ClanLib-1.0.0-pthread.patch -- Use pthread_mutexattr_settype instead obsolete pthread_mutexattr_setkind_np
Patch4:         ClanLib-1.0.0-pthread.patch
Patch5:         reproducible.patch
BuildRequires:  alsa-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  libmikmod-devel
BuildRequires:  libxslt-devel
BuildRequires:  pkgconfig
BuildRequires:  xorg-x11-proto-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(SDL_gfx)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xxf86vm)

%description
ClanLib is a cross platform C++ toolkit library.

Essentially the library offers a series of different functionality under a
streamlined API. Its primary focus is on games, although not limited for that
usage only.

%package devel
Summary:        Development Libraries and Headers for ClanLib
Group:          Development/Libraries/X11
Requires:       %{name} = %{version}
Requires:       pkgconfig
Requires:       xorg-x11-proto-devel
Requires:       pkgconfig(gl)
Requires:       pkgconfig(glu)

%description devel
This package contains ClanLib development libraries and headers.

%prep
%setup -q -n ClanLib-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

# Fixup pc files (correct %%{libdir}). Also point to %%{libdir}/ClanLib-1.0
# instead of %%{libdir} in order to avoid conflicts with other ClanLib versions
sed -i 's|libdir=${exec_prefix}/lib|libdir=@libdir@|' pkgconfig/clan*.pc.in
sed -i 's|Libs:   -L${libdir}|Libs:   -L${libdir}/ClanLib-1.0|' pkgconfig/clan*.pc.in

%build
%configure \
 --docdir=%{_docdir}/clanlib1-devel \
 --htmldir=%{_docdir}/clanlib1-devel \
 --disable-static \
%ifarch %{ix86} x86_64
 --enable-asm386 \
%endif
 --enable-dyn \
 --enable-docs \
 --enable-clanDisplay \
 --enable-clanSDL \
 --enable-clanGL \
 --enable-clanSound \
 --enable-clanNetwork \
 --enable-clanGUI \
 --enable-clanMikMod \
 --enable-clanVorbis \
 --enable-getaddr \
 --with-x
%make_build

%install
make DESTDIR=%{buildroot} HTML_PREFIX=%{_docdir}/clanlib1-devel install

# Remove libtool config files
find %{buildroot} -type f -name "*.la" -delete -print

# Put .so links in a subdir of %%{libdir} so they don't conflict with
# ClanLib065-devel .so links. The pkg-config files are patched to transparently
# handle this for applications using 1.0
mkdir -p %{buildroot}%{_libdir}/ClanLib-1.0
mv %{buildroot}%{_libdir}/*.so %{buildroot}%{_libdir}/ClanLib-1.0
for i in %{buildroot}%{_libdir}/ClanLib-1.0/*; do
  ln -sf ../`readlink $i` $i
done

# 1.0 is API compatible with 0.8, add 0.8 pkgconfig symlinks, so 0.8
# expecting sources can be build against 1.0
for i in %{buildroot}%{_libdir}/pkgconfig/*.pc; do
  ln -s `basename $i` `echo $i|sed 's/1\.0\.pc/0\.8\.pc/'`
done

# Move devel documentation to the correct place
mv %{buildroot}%{_datadir}/doc/clanlib/* %{buildroot}%{_docdir}/clanlib1-devel/
rm -rf %{buildroot}%{_datadir}/doc/clanlib/

# Install additional devel documentation
install -pm 0644 CODING_STYLE PATCHES README.anjuta README.kdevelop README.sdl README.upgrade %{buildroot}%{_docdir}/clanlib1-devel/
%fdupes -s %{buildroot}

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

%files
%license COPYING
%doc CREDITS NEWS README TODO-RSN
%{_libdir}/libclan*.so.1*

%files devel
%{_docdir}/clanlib1-devel/
%{_includedir}/ClanLib-1.0/
%{_libdir}/ClanLib-1.0/
%{_libdir}/pkgconfig/clan*.pc

%changelog
openSUSE Build Service is sponsored by