File Coin.spec of Package Coin

#
# spec file for package Coin
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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/
#

Name:           Coin
Version:        3.1.3
Release:        0
License:        GPL-2.0
Summary:        Multiplatform high-level 3D graphics library
Url:            http://www.coin3d.org/lib/coin/
Group:          Development/Libraries/C and C++
Source0:        http://ftp.coin3d.org/coin/src/all/%{name}-%{version}.tar.gz
Patch0:         fix-freetype2-includes.patch
BuildRequires:  c++_compiler
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
BuildRequires:  openal-soft-devel
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(dri)
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xt)
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The core rendering library Coin is a multiplatform high-level 3D graphics
library with a C++ API. Coin uses OpenGL for accelerated rendering, while
providing a higher abstraction level, 3D interactivity, and many complex
optimization features for fast rendering that are transparent for the
application programmer, thus facilitating the development of interactive 3D
applications and greatly increasing productivity.

%package devel
Summary:        Development files for Coin
Group:          Development/Libraries/C and C++
Requires:       libCoin60 = %{version}
Requires:       fontconfig-devel
Requires:       freetype2-devel
Requires:       openal-soft-devel
Requires:       pkgconfig(bzip2)
Requires:       pkgconfig(dri)
Requires:       pkgconfig(ice)
Requires:       pkgconfig(gl)
Requires:       pkgconfig(glu)
Requires:       pkgconfig(x11)
Requires:       pkgconfig(xt)
Requires:       zlib-devel

%description devel
The core rendering library Coin is a multiplatform high-level 3D graphics
library with a C++ API. Coin uses OpenGL for accelerated rendering, while
providing a higher abstraction level, 3D interactivity, and many complex
optimization features for fast rendering that are transparent for the
application programmer, thus facilitating the development of interactive 3D
applications and greatly increasing productivity.

%package -n libCoin60
Summary:        Multiplatform high-level 3D graphics library
Group:          System/Libraries
Provides:       %{name} = %{version}
Obsoletes:      %{name} < %{version}

%description -n libCoin60
The core rendering library Coin is a multiplatform high-level 3D graphics
library with a C++ API. Coin uses OpenGL for accelerated rendering, while
providing a higher abstraction level, 3D interactivity, and many complex
optimization features for fast rendering that are transparent for the
application programmer, thus facilitating the development of interactive 3D
applications and greatly increasing productivity.

%prep
%setup -q
%if 0%{?suse_version} > 1310
%patch0 -p1
%endif
sed -i '/^#include "fonts\/freetype.h"$/i #include <cstdlib>\n#include <cmath>' src/fonts/freetype.cpp
sed -i '/^#include <Inventor\/C\/basic.h>$/i #include <Inventor/C/errors/debugerror.h>' include/Inventor/SbBasic.h

# Remove build time references so build-compare can do its work
sed -i "s/Generated on \$datetime/Generated/" docs/doxygen/footer.html

%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"

%configure \
    --htmldir=%{_docdir}/%{name}-devel/html \
    --enable-3ds-import \
    --enable-javascript-api \
    --enable-threadsafe \
    --enable-html \
    --enable-man \
    --disable-dl-openal \
    --disable-dl-fontconfig \
    --disable-dl-freetype \
    --disable-dl-zlib \
    --disable-dl-libbzip2 \
    --disable-dl-glu \
    --with-freetype=%{_prefix}

make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install

# Fix rpmlint warning "pkgconfig-invalid-libs-dir". -L${libdir} is already included in the Coin.pc file
sed -i "s/\-L\/usr\/lib64 \-L\/usr\/lib/ /" %{buildroot}%{_libdir}/pkgconfig/Coin.pc

# Fix the libdir
sed -i -e "s,\-L/usr/lib64 \-L/usr/lib,\-L%{_libdir}," %{buildroot}%{_datadir}/Coin/conf/coin-default.cfg

# Remove unneeded files
rm -f %{buildroot}%{_libdir}/*.la

# Install additional documentation
install -pm 0644 AUTHORS COPYING ChangeLog FAQ FAQ.legal LICENSE.GPL NEWS README RELNOTES THANKS \
 %{buildroot}%{_docdir}/%{name}-devel/

%fdupes -s %{buildroot}%{_docdir}/%{name}-devel/

%post -n libCoin60 -p /sbin/ldconfig

%postun -n libCoin60 -p /sbin/ldconfig

%files -n libCoin60
%defattr(-,root,root,-)
%doc LICENSE.GPL
%{_datadir}/Coin/
%{_libdir}/libCoin.so.60*

%files devel
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-devel/
%{_bindir}/coin-config
%{_includedir}/Inventor/
%{_includedir}/SoDebug.h
%{_includedir}/SoWinEnterScope.h
%{_includedir}/SoWinLeaveScope.h
%{_libdir}/pkgconfig/Coin.pc
%{_libdir}/libCoin.so
%{_datadir}/aclocal/coin.m4
%doc %{_mandir}/man1/coin-config.1%{ext_man}
%doc %{_mandir}/man3/*.3%{ext_man}

%changelog