File irrlicht.spec of Package irrlicht

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


%define  somajor 1
%define  sominor 8
Name:           irrlicht
Version:        1.7.9.3629
Release:        1
License:        zlib
Summary:        A high performance realtime 3D engine
Url:            http://irrlicht.sourceforge.net/
Group:          Development/Libraries/C and C++
Source0:        irrlicht-%{version}.tar.bz2
# Various fixes, optflags, system libraries/headers
# Don't call ldconfig during make install.
# http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=24076&highlight=
Patch0:         irrlicht-1.7.9.3629-config.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/Packaging/Patches
Patch2:         aes.patch
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  Mesa-devel
BuildRequires:  unzip
BuildRequires:  xorg-x11-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Irrlicht Engine is an open source high performance realtime 3D engine
written and usable in C++ and also available for .NET languages. It is
completely cross-platform, using D3D, OpenGL and its own software renderer,
and has all of the state-of-the-art features which can be found in
commercial 3d engines.

%package devel
Summary:        Development headers and libraries for irrlicht
Group:          Development/Libraries/C and C++
Requires:       Mesa-devel
Requires:       libIrrlicht%{somajor}_%{sominor} = %{version}
Requires:       libjpeg-devel
Requires:       libpng-devel
Requires:       xorg-x11-devel
Requires:       xorg-x11-libX11-devel
Requires:       zlib-devel

%description devel
Development headers and libraries for irrlicht.

The Irrlicht Engine is an open source high performance realtime 3D engine
written and usable in C++ and also available for .NET languages. It is
completely cross-platform, using D3D, OpenGL and its own software renderer,
and has all of the state-of-the-art features which can be found in
commercial 3d engines.

%package data
Summary:        Assorted data for irrlicht
Group:          Development/Libraries/C and C++

%description data
Data files for irrlicht applications

The Irrlicht Engine is an open source high performance realtime 3D engine
written and usable in C++ and also available for .NET languages. It is
completely cross-platform, using D3D, OpenGL and its own software renderer,
and has all of the state-of-the-art features which can be found in
commercial 3d engines.

%package -n libIrrlicht%{somajor}_%{sominor}
Summary:        A high performance realtime 3D engine
Group:          System/Libraries

%description -n libIrrlicht%{somajor}_%{sominor}
The Irrlicht Engine is an open source high performance realtime 3D engine
written and usable in C++ and also available for .NET languages. It is
completely cross-platform, using D3D, OpenGL and its own software renderer,
and has all of the state-of-the-art features which can be found in
commercial 3d engines.

%prep
%setup -q
%patch0 -p0
%patch2 -p1
sed -i 's/\r//' readme.txt
iconv -o readme.txt.iso88591 -f iso88591 -t utf8 readme.txt
mv readme.txt.iso88591 readme.txt
# We don't use any of this. Deleting it to be sure we are using system headers
rm -rf source/Irrlicht/jpeglib source/Irrlicht/zlib source/Irrlicht/libpng

for i in include/*.h doc/upgrade-guide.txt source/Irrlicht/*.cpp source/Irrlicht/*.h; do
  	sed -i 's/\r//' $i
	chmod -x $i
	touch -r changes.txt $i
done

%build
cd source/Irrlicht
#export RPM_OPT_FLAGS="%{optflags} -fno-strict-aliasing"
make %{?_smp_mflags} CFLAGS="%{optflags} -fno-strict-aliasing -fPIC" \
      ZLIBOBJ= JPEGLIBOBJ= LIBPNGOBJ= \
      CIrrDeviceLinux.cpp

make %{?_smp_mflags} \
     CFLAGS="%{optflags} -fstrict-aliasing -fPIC" \
     CXXFLAGS="%{optflags} -fstrict-aliasing -fno-exceptions -fno-rtti -fPIC" \
     ZLIBOBJ= JPEGLIBOBJ= LIBPNGOBJ= \
     LDFLAGS="-lz -ljpeg -lpng $(pkg-config --libs gl xxf86vm xext x11)" \
     sharedlib

%install
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}/irrlicht
make -C source/Irrlicht INSTALL_DIR=%{buildroot}%{_libdir} install \
     ZLIBOBJ= JPEGLIBOBJ= LIBPNGOBJ=
# Cleaning up after the really bad installer... 
pushd %{buildroot}%{_libdir}
rm 1.8
ln -s -f libIrrlicht.so.1.8.0-SVN libIrrlicht.so.1.8.0
ln -s -f libIrrlicht.so.1.8.0 libIrrlicht.so.1.8
ln -s -f libIrrlicht.so.1.8 libIrrlicht.so
popd
# End Makefile mess cleanup
install -d %{buildroot}%{_datadir}/irrlicht
cp -r media %{buildroot}%{_datadir}/irrlicht

echo cp -r examples %{buildroot}%{_datadir}/irrlicht

%clean
rm -rf %{buildroot}

%post -n libIrrlicht%{somajor}_%{sominor} -p /sbin/ldconfig

%postun -n libIrrlicht%{somajor}_%{sominor} -p /sbin/ldconfig

%files -n libIrrlicht%{somajor}_%{sominor}
%defattr(-,root,root,-)
%doc readme.txt
%{_libdir}/libIrrlicht.so.*

%files devel
%defattr(-,root,root,-)
%doc doc/upgrade-guide.txt
%{_includedir}/irrlicht/
%{_libdir}/libIrrlicht.so

%files data
%defattr(-,root,root,-)
%{_datadir}/irrlicht

%changelog
openSUSE Build Service is sponsored by