File openCOLLADA.spec of Package openCOLLADA

#
# spec file for package openCOLLADA (Version svn788)
#
# Copyright (c) 2010 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/
#

# norootforbuild

%define libversion 0.788.0

Name:           openCOLLADA
Version:        svn788
Release:        1
License:        MIT
Summary:        Collada 3D import and export libraries
Group:          Productivity/Graphics/CAD
Url:            http://www.opencollada.org/
Source0:        http://opencollada.googlecode.com/svn/trunk/%{name}-%{version}.tar.bz2
Source1:        CHANGES.txt
# This patch will be submitted upstream.
Patch0:         COLLADA-linuxbuild.patch
# This patch is a temporary work around to get scons to use RPM_OPT_FLAGS, note. libOpenCOLLADASaxFrameworkLoader cannot build with -O2 only -O0.
Patch1:         openCOLLADA-buildflags.patch
# This patch enables an SONAME in the built libraries
Patch2:         openCOLLADA-soname.patch
# Patch to stop dae2ogre building
Patch3:         openCOLLADA-nodae2ogre.patch

BuildRequires:  dos2unix fftw3-devel gcc-c++ libexpat-devel pcre-devel scons zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
OpenCOLLADA is a stream based reader and writer library for COLLADA files

Authors
-------
sebastian@opencollada.org gtempaccount.com
robert@opencollada.org gtempaccount.com

%package  -n libOpenCOLLADA0
Summary:        Collada 3D import and export libraries
License:        MIT
Group:          Productivity/Graphics/CAD
Provides:       %{name} = %{version}

%description -n libOpenCOLLADA0
COLLADA is a royalty-free XML schema that enables digital asset
exchange within the interactive 3D industry.
OpenCOLLADA is a Google summer of code opensource project providing
libraries for 3D file interchange between applications like blender.
COLLADABaseUtils          Utils used by many of the other projects
COLLADAFramework          Datamodel used to load COLLADA files
COLLADAStreamWriter       Sources (Library to write COLLADA files)
COLLADASaxFrameworkLoader Library that loads COLLADA files in a sax
                          like manner into the framework data model
COLLADAValidator          XML validator for COLLADA files, based on
                          the COLLADASaxFrameworkLoader
GeneratedSaxParser        Library used to load xml files in the way
                          used by COLLADASaxFrameworkLoader
Authors
-------
sebastian@opencollada.org
robert@opencollada.org

%package  devel
Summary:        Include files for openCOLLADA development
License:        MIT
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
This package provides the include files necessary to build and
develop with the openCOLLADA export and import libraries.

%prep
%setup -q
%patch0
%patch1
%patch2
%patch3

%build
# Build openCOLLADA shared libraries.
%if 0%{?jobs}
%define jobsflag --jobs=%{jobs}
%endif
scons %{?jobsflag} SHAREDLIB=yes PCRENATIVE=yes XMLPARSER=expatNative LIBDIRNAME=%{_lib}/

# copy CHANGES.txt
cp %{S:1} ./

%install
# Manual install linking and renaming of libraries is necessary.
mkdir -p %{buildroot}%{_libdir}
find GeneratedSaxParser COLLADA* Externals common -name *.so -exec cp -v {} %{buildroot}%{_libdir}/ \;
pushd %{buildroot}%{_libdir}/
find *.so -exec /bin/mv -v {} {}.%{libversion} \; -exec ln -s {}.%{libversion} {} \; -exec ln -s {}.%{libversion} {}.0 \;
#strip --strip-debug *.so.*
popd
# Manual install of include files is necessary.
mkdir -p %{buildroot}%{_prefix}
find *Sax* COLLADAS* COLLADAB* COLLADAF* Externals/MathMLSolver Externals/UTF common -name include -exec cp -vr {} %{buildroot}%{_prefix}/ \;
# Add some docs, need to fix eol encoding with dos2unix in some files.
find ./ -name .project -delete
cp -f COLLADAStreamWriter/README README.COLLADAStreamWriter
cp -f COLLADAStreamWriter/LICENSE ./
dos2unix -f README.COLLADAStreamWriter
dos2unix -f LICENSE
dos2unix -f README
find htdocs/ -name *.php -exec dos2unix -f {} \;
find htdocs/ -name *.css -exec dos2unix -f {} \;

%post  -n libOpenCOLLADA0 -p /sbin/ldconfig

%postun -n libOpenCOLLADA0 -p /sbin/ldconfig

%files -n libOpenCOLLADA0
%defattr(-,root,root,-)
%{_libdir}/lib*.so.0*

%files devel
%defattr(-,root,root,-)
%doc README htdocs/ LICENSE README.COLLADAStreamWriter COLLADAStreamWriter/AUTHORS CHANGES.txt
%{_libdir}/*.so
%{_includedir}/*

%changelog
openSUSE Build Service is sponsored by