File openCOLLADA.spec of Package openCOLLADA

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


%define CURRENT 0
%define AGE 868
%define REVISION 1

%define libversion %{CURRENT}.%{AGE}.%{REVISION}

Name:           openCOLLADA
Version:        svn%{AGE}
Release:        0
Summary:        Collada 3D import and export libraries
License:        MIT
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 either by the Fedora creator or myself as I've added complete lib versioning to it.
Patch0:         openCOLLADA-cmakelinuxbuild.patch
# This patch fixes error: there are no arguments to 'COLLADABU_ASSERT' that depend on a template parameter,
# so a declaration of 'COLLADABU_ASSERT' must be available only for svn 839+
Patch1:         openCOLLADA-COLLADABU_ASSERT.patch
Patch2:         openCOLLADA-gcc47.patch
BuildRequires:  cmake
BuildRequires:  dos2unix
BuildRequires:  fftw3-devel
BuildRequires:  gcc-c++
BuildRequires:  libxml2-devel
BuildRequires:  pcre-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%global buildir %{_builddir}/%{name}-%{version}

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

%package  -n libOpenCOLLADA0
Summary:        Collada 3D import and export libraries
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.

%package  devel
Summary:        Include files for openCOLLADA development
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
echo %{buildir}
%setup -q
%patch0
#patch1
%patch2
# This section copied from Fedora spec with modidfications.
# Remove unused bundled libraries and other directories that aren't built.
rm -rf Externals/{Cg,expat,lib3ds,LibXML,MayaDataModel,pcre,zlib,zziplib} \
	dae23ds dae23ds_lib3ds dae2ma dae2ogre G3DWarehouseBrowser COLLADAMax COLLADAMaya

# Add some docs, need to fix eol encoding with dos2unix in some files.
find ./ -name .project -delete
cp -pf COLLADAStreamWriter/README README.COLLADAStreamWriter
cp -pf COLLADAStreamWriter/LICENSE ./

iconv -f ISO_8859-1 -t utf-8 COLLADAStreamWriter/AUTHORS > \
  COLLADAStreamWriter/AUTHORS.tmp
touch -r COLLADAStreamWriter/AUTHORS COLLADAStreamWriter/AUTHORS.tmp
mv COLLADAStreamWriter/AUTHORS.tmp COLLADAStreamWriter/AUTHORS

dos2unix -f -k README.COLLADAStreamWriter
dos2unix -f -k LICENSE
dos2unix -f -k README
find htdocs/ -name *.php -exec dos2unix -f {} \;
find htdocs/ -name *.css -exec dos2unix -f {} \;

# copy CHANGES.txt
install -p -m 0644 %{S:1} ./

%build

# Build openCOLLADA shared libraries.
mkdir -p Build
pushd Build
#note. libOpenCOLLADASaxFrameworkLoader cannot build with -O2 only -O0
#-Wall -fPIC is added by cmake and -O2 is added to all but OpenCOLLADASaxFrameworkLoader.
cmake ../ -G"Unix Makefiles" \
        -DLIB_INSTALL_DIR=%{_libdir} \
        -DINCLUDE_INSTALL_DIR=%{_includedir} \
	-DUSE_STATIC=OFF \
	-DUSE_SHARED=ON \
	-Dsoversion=%{?CURRENT} \
	-Dsoage=%{?AGE} \
	-Dsorevision=%{?REVISION} \
	-DCMAKE_SKIP_RPATH=ON \
	-DCMAKE_VERBOSE_MAKEFILE=ON \
	-DCMAKE_CXX_FLAGS:LIST="-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -ggdb"

#make -e %{?jobs:-j%{jobs}} all
make -e all
#
popd

%install
pushd Build
%make_install

mkdir -p %{buildroot}%{_bindir}/
install -p -m 0755 bin/* %{buildroot}%{_bindir}/

%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
%{_bindir}/OpenCOLLADAValidator
%{_libdir}/*.so
%dir %{_includedir}/COLLADABaseUtils
%dir %{_includedir}/COLLADAFramework
%dir %{_includedir}/COLLADASaxFrameworkLoader
%dir %{_includedir}/COLLADAStreamWriter
%dir %{_includedir}/GeneratedSaxParser
%{_includedir}/*

%changelog
openSUSE Build Service is sponsored by