File freeglut.spec of Package freeglut

#
# spec file for package freeglut (Version 080721)
#
# Copyright (c) 2009 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


Name:           freeglut
BuildRequires:  Mesa-devel gcc-c++ libdrm-devel pkgconfig xorg-x11-devel
Summary:        Freely licensed alternative to the GLUT library
Version:        080721
Release:        20.<RELEASE2>
Url:            http://freeglut.sourceforge.net/
%define USE_EXTERNAL_MESA 1
Source0:        freeglut-%{version}.tar.bz2
Source1:        glutman.tar.bz2
Source2:        glxdemos.tar.bz2
Source3:        xdriinfo-1.0.2.tar.bz2
Source4:        compat70.tar.bz2
Patch:          freeglut-%{version}.diff
Patch1:         glxdemos.diff
Patch2:         freeglut-sig11-bug466806.diff
License:        X11/MIT
Provides:       mesaglut
Obsoletes:      mesaglut
# bug437293
%ifarch ppc64
Obsoletes:      freeglut-64bit
%endif
#
Group:          System/Libraries
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Freeglut is a completely open source alternative to the OpenGL Utility
Toolkit (GLUT) library. GLUT was originally written by Mark Kilgard to
support the sample programs in the second edition OpenGL Redbook. Since
then, GLUT has been used in a wide variety of practical applications
because it is simple, universally available, and highly portable.

GLUT (and freeglut) allow the user to create and manage windows
containing OpenGL contexts and also read the mouse, keyboard, and
joystick functions on a wide range of platforms.



Authors:
--------
    Pawel W. Olszta
    Andreas Umbach
    Steve Baker

%package devel
License:        X11/MIT
Summary:        Development libraries, includes and man pages for freeglut (GLUT Library)
Group:          Development/Libraries/X11
Requires:       %{name} = %{version}-%{release} xorg-x11-Mesa-devel xorg-x11-devel
Provides:       mesaglut-devel
Obsoletes:      mesaglut-devel
# bug437293
%ifarch ppc64
Obsoletes:      freeglut-devel-64bit
%endif
#

%description devel
This package contains all necessary include files and libraries needed
to compile and link applications for the freeglut library.

In addition, it also includes manual pages which describe all functions
provided by the freeglut library.

freeglut is a completely open source alternative to the OpenGL Utility
Toolkit (GLUT) library. GLUT was originally written by Mark Kilgard to
support the sample programs in the second edition OpenGL Redbook. Since
then, GLUT has been used in a wide variety of practical applications
because it is simple, universally available, and highly portable.

GLUT (and freeglut) allow the user to create and manage windows
containing OpenGL contexts and also read the mouse, keyboard, and
joystick functions on a wide range of platforms.



%prep
%setup -q -b1 -b2 -b3 -b4 -n freeglut
%patch
%patch2
%if %USE_EXTERNAL_MESA
pushd ..
%patch1
# Change lib -> %_lib
if [ "%_lib" != lib ] ; then
  for f in `find usr/ \! -wholename '*/include/*' -type f -print` ; do
    sed -i 's|/lib/|/%_lib/|g;s|/lib$|/%_lib|' "$f"
  done
  for f in `find usr/ -wholename '*/lib/*' -type f -print` ; do
    d="`echo "$f" | sed 's|/lib|/%_lib|g'`"
    mkdir -p "`dirname "$d"`"
    mv "$f" "$d"
  done
  find usr -type d -print | xargs rmdir 2>/dev/null || true
fi
popd
%endif

%build
autoreconf -fi
CFLAGS="$RPM_OPT_FLAGS" \
  ./configure --prefix=/usr --libdir=%_libdir
make %{?jobs:-j%jobs}
%if %USE_EXTERNAL_MESA
pushd ..
  for i in glxinfo glxgears; do
    pushd $i; xmkmf -a; make CDEBUGFLAGS="$RPM_OPT_FLAGS"; popd
  done
  pushd xdriinfo-*
    test -f /usr/%_lib/pkgconfig/x11.pc || \
      export PKG_CONFIG_PATH=/usr/%_lib/pkgconfig:$RPM_BUILD_DIR/usr/%_lib/pkgconfig
    CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --mandir=%{_mandir}
    make
  popd
popd
%endif

%install
rm -rf $RPM_BUILD_ROOT
%makeinstall 
# remove demos
rm -f ${RPM_BUILD_ROOT}/usr/bin/{fractals*,lorenz,one}
# glut Manual Pages
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man3
pushd ../glut-3.7
  for i in man/glut/glut*; do
    install -m 644 $i ${RPM_BUILD_ROOT}/%{_mandir}/man3/`basename $i man`3
  done
popd
%if %USE_EXTERNAL_MESA
pushd ..
  for i in glxinfo glxgears; do
    pushd $i
      make install DESTDIR=$RPM_BUILD_ROOT BINDIR=/usr/bin
      make install.man DESTDIR=$RPM_BUILD_ROOT MANDIR=%_mandir/man1
   popd
  done
  pushd xdriinfo-*
     make install DESTDIR=$RPM_BUILD_ROOT
  popd
popd
%endif

%post
%run_ldconfig

%postun
%run_ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%if %USE_EXTERNAL_MESA
/usr/bin/glxgears
/usr/bin/glxinfo
/usr/bin/xdriinfo
%{_mandir}/man1/glxgears.1x.gz
%{_mandir}/man1/glxinfo.1x.gz
%{_mandir}/man1/xdriinfo.1.gz
%endif
%{_libdir}/libglut.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/GL/*
%{_libdir}/libglut.a
%{_libdir}/libglut.la
%{_libdir}/libglut.so
%{_mandir}/man3/*

%changelog
* Sat Jan 17 2009 sndirsch@suse.de
- freeglut-sig11-bug466806.diff
  * fix Sig11 in glutCreateWindow() for GLX drivers < 1.3
  (bnc #466806)
* Wed Dec 10 2008 olh@suse.de
- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade
  (bnc#437293)
* Thu Oct 30 2008 olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
* Mon Aug 11 2008 sndirsch@suse.de
- switched to current freeglut sources in SVN (2008-07-21):
  * Changed "fgStructure.GameMode" to "fgStructure.GameModeWindow"
  to reflect better what it is
  * Added an end-of-line character to a warning message about an
  unknown X event type
  * Fixing a problem in which "glutGetWindow" would return a menu's
  window instead of the menu's parent window
  * Added some handy comments, spacing, fixed a typo in a comment
  * Changed "TARGET_HOST_UNIX_X11" to "TARGET_HOST_POSIX_X11" to
  avoid trademark issues, per Joe Krahn; also rationalized the
  other "TARGET_HOST" definitions
  * Added futher callback functionality to the CallbackMaker demo
  program.  Also added a prompt for user input to highlight a
  difference betwen GLUT and "freeglut"
  * Added multisampling support for *nix and Windows; some other
  pixel format changes for Windows
  * Added Markus Henschel's change (e-mail to developers' list,
  June 28, 2006) to have the "glutInitDisplayString" ignore
  numerical assignments to tokens as a temporary fix.
  * Fixed buy #1398196 in the bug tracker to the effect that
  passing the wrong argument in "fghSleepForEvents" can cause
  odd delays
* Thu Apr 10 2008 ro@suse.de
- added baselibs.conf file to build xxbit packages
  for multilib support
* Sat Aug 18 2007 sndirsch@suse.de
- xdriinfo 1.0.2
  * X.Org bug #10616: Add all the X info commands to See Also in
  man page
* Sun Sep 03 2006 sndirsch@suse.de
- update to current CVS (2006-09-03)
  * Check fgets for return value to avoid warnings
* Sun Jul 23 2006 sndirsch@suse.de
- updated xdriinfo
- fixed build for X.Org 7
* Thu Jan 26 2006 mls@suse.de
- fix BuildRequires
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Nov 11 2005 sndirsch@suse.de
- moved glxinfo/glxgears/xdriinfo from -devel to main package
* Thu Nov 10 2005 sndirsch@suse.de
- updated to current CVS (05-11-10) to fix all these "freeglut
  ERROR: Function <glut<whatever>> called without first calling
  'glutInit'" errors, which prevented many programs from starting
  (e.g. FlightGear); freeglut 2.4 seems known to be broken :-(
* Mon Nov 07 2005 sndirsch@suse.de
- switched to external built Mesa
* Wed Oct 26 2005 sndirsch@suse.de
- added build of glxinfo/glxgears/xdriinfo when %%USE_EXTERNAL_MESA
  is set
* Fri Jun 24 2005 sndirsch@suse.de
- update to final release 2.4.0
* Fri Jun 10 2005 sndirsch@suse.de
- removed "-Werror"
* Mon Jun 06 2005 sndirsch@suse.de
- update to release 2.4.0-rc4
- obsoletes freeglut-gcc4.diff
* Sun Apr 10 2005 sndirsch@suse.de
- new gcc4 patch (use the bits of CVS)
* Thu Apr 07 2005 meissner@suse.de
- fortran does not appear to be needed here (just libtool
  checks for it as standard).
* Sat Apr 02 2005 coolo@suse.de
- fix casts
* Thu Apr 29 2004 coolo@suse.de
- build parallel if available
- build as user
* Mon Dec 15 2003 sndirsch@suse.de
- updated to release 2.2.0
  * Mousewheel Support for Win32 & X11
  * More unified Win32/*nix behavior and code
  * Code style cleanups
  * Visibility support in Win32
  * Many other Good Bug Fixes
* Sat Dec 06 2003 sndirsch@suse.de
- updated to release 2.0.1
  * fixes a number of bugs with menus
* Fri Oct 10 2003 adrian@suse.de
- fix build for mips
- satisfy configure checks
* Thu Oct 02 2003 sndirsch@suse.de
- provides/obsoletes mesaglut/mesglut-devel now
* Tue Sep 30 2003 sndirsch@suse.de
- removed demos
* Tue Sep 30 2003 sndirsch@suse.de
- added GLUT manual pages
* Mon Sep 29 2003 sndirsch@suse.de
- updated to final release 2.0.0
* Thu Aug 14 2003 sndirsch@suse.de
- added GameMode fix (GameModeFixes-4.dif)
* Thu Aug 07 2003 sndirsch@suse.de
- created package