Summary:	A low-level fullscreen SVGA graphics library.
Name:		svgalib
Version:	1.9.25
Release:	1%{?_dist_release}
Exclusivearch:	%{ix86} x86_64
License:	distributable
Group:		System Environment/Libraries
Source:		http://www.arava.co.il/matan/svgalib/svgalib-%{version}.tar.gz
Source1:	svgalib-todo
Patch0:		svgalib-1.9.21-makefiles.patch
Patch1:		svgalib-1.4.3-fhs.patch
Patch2:		svgalib-1.9.21-demos.patch
Patch3:		svgalib-1.9.21-cfg.patch
Patch4:		svgalib-1.9.25-kernel-2.6.26.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root

%description
The svgalib package provides the SVGAlib low-level graphics library
for Linux.  SVGAlib is a library which allows applications to use full
screen graphics on a variety of hardware platforms.  Many games and
utilities use SVGAlib for their graphics.

You'll need to have the svgalib package installed if you use any of
the programs which rely on SVGAlib for their graphics support.

#'
%package devel
Summary: Development tools for programs using the SVGAlib graphics library.
Group: Development/Libraries
Requires: svgalib = %{version}-%{release}
Provides: libvga-devel = %{version}-%{release}

%description devel
The svgalib-devel package contains the libraries and header files
needed to build programs which will use the SVGAlib low-level graphics
library.

Install the svgalib-devel package if you want to develop applications
which will use the SVGAlib library.

%prep
%setup -q 
%patch0 -p1 -b .makefiles
%patch1 -p1 -b .fhs
%patch2 -p1
%patch3 -p1 -b .defaultcfg
%patch4 -p1

#the testlinear demo needs svgalib's internal libvga header, so copy it to the
#demo dir
%__cp src/libvga.h demos


%build
#%{?_smp_mflags} doesn't work on x86_64 chances are it will fail on
#some i386 machines too.
%__make OPTIMIZE="$RPM_OPT_FLAGS -Wno-pointer-sign" LDFLAGS= \
  prefix=%{_prefix} \
  NO_HELPER=y \
  INCLUDE_ET4000_DRIVER=y \
  INCLUDE_OAK_DRIVER=y \
  INCLUDE_MACH32_DRIVER=y \
  INCLUDE_ET3000_DRIVER=y \
  INCLUDE_GVGA6400_DRIVER=y \
  INCLUDE_ATI_DRIVER=y \
  INCLUDE_G450C2_DRIVER=y \
  INCLUDE_ET4000_DRIVER_TEST=y \
  INCLUDE_FBDEV_DRIVER_TEST=y \
  INCLUDE_VESA_DRIVER_TEST=y \
  shared
%__make -C utils \
    OPTIMIZE="$RPM_OPT_FLAGS -Wno-pointer-sign" LDFLAGS= \
    prefix=%{_prefix}
%__make -C threeDKit \
    OPTIMIZE="$RPM_OPT_FLAGS -Wno-pointer-sign -I../gl" LDFLAGS= \
    prefix=%{_prefix} lib3dkit.so.%{version}


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/vga
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
make \
  TOPDIR=$RPM_BUILD_ROOT \
  prefix=$RPM_BUILD_ROOT/%{_prefix} \
  mandir=$RPM_BUILD_ROOT/%{_mandir} \
  sharedlibdir=$RPM_BUILD_ROOT/%{_libdir} \
  NO_HELPER=y \
  MANFORMAT=compressed \
  "INSTALL_PROGRAM=install -p -m 755" \
  "INSTALL_SCRIPT=install -p -m 755" \
  "INSTALL_SHLIB=install -p -m 755" \
  "INSTALL_DATA=install -p -m 644" \
  install
ln -s libvga.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/libvga.so.1
ln -s libvgagl.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/libvgagl.so.1
ln -s lib3dkit.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/lib3dkit.so.1
#for %ghost
touch $RPM_BUILD_ROOT/etc/vga/fontdata
touch $RPM_BUILD_ROOT/etc/vga/textregs


%clean
%__rm -fr $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc doc/CHANGES doc/README.joystick doc/README.keymap lrmi-0.6m/README
%doc doc/README.multi-monitor doc/README.vesa doc/TODO doc/dual-head-howto
%dir %{_sysconfdir}/vga/
%config(noreplace) %{_sysconfdir}/vga/dvorak-us.keymap
%config(noreplace) %{_sysconfdir}/vga/libvga.config
%config(noreplace) %{_sysconfdir}/vga/libvga.et4000
%config(noreplace) %{_sysconfdir}/vga/null.keymap
%ghost %{_sysconfdir}/vga/fontdata
%ghost %{_sysconfdir}/vga/textregs
%{_bindir}/*
%{_libdir}/*.so.*
%{_mandir}/man[^3]/*

%files devel
%defattr(-,root,root,-)
%doc demos doc/DESIGN doc/Driver-programming-HOWTO doc/README.patching
%{_includedir}/*
%{_libdir}/*.so
%{_mandir}/man3/*


%changelog
* Sun Jun 07 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.9.25-1
- new upstream release
- dropped/updated all old patches based on Fedora development package
- added Provides: libvga-devel in devel subpackage

* Tue Oct 26 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.4.3-0vl1
- updated Patch0, Patch2, Patch4
- Patch3 and Patch5 were merged into upstream, dropped
- added Patch7 to build vga.c correctly
- s/Copyright/License/

* Sat Aug 18 2001 Toru Sagami <sagami@vinelinux.org>
- 1.4.1-13vl1: was ported to Vine

* Thu Oct 26 2000 Than Ngo <than@redhat.com>
- rebuilt for 7.1

* Thu Oct 26 2000 Than Ngo <than@redhat.com>
- fixed makefile to link vgalib in sharelib instead /usr/lib (Bug #19732)
- fixed undefined reference to `cli' and 'sti'

* Mon Aug 21 2000 Than Ngo <than@redhat.com>
- fix for building the utils correct

* Sun Aug 20 2000 Than Ngo <than@redhat.com>
- fix 800x600 mode messed up on matrox millenium I (Bug #16641)

* Fri Aug 11 2000 Tim Powers <timp@redhat.com>
- rebuilt

* Mon Jul 24 2000 Prospector <prospector@redhat.com>
- rebuilt

* Mon Jul 24 2000 Than Ngo <than@redhat.de>
- fix unclean code to built against gcc-2.96-34
- set chipset Vesa as default

* Wed Jul 12 2000 Than Ngo <than@redhat.de>
- clean up specfile

* Mon Jun  4 2000 Bill Nottingham <notting@redhat.com>
- move to powertools

* Thu Feb  3 2000 Bill Nottingham <notting@redhat.com>
- handle compressed man pages

* Tue Jan 18 2000 Bill Nottingham <notting@redhat.com>
- update to 1.4.1 final

* Wed Dec 08 1999 Michael Maher <mike@lastfoot.com>
- built pre release of 1.4.1

* Mon Sep 13 1999 Bill Nottingham <notting@redhat.com>
- strip binaries

* Fri Aug 27 1999 Bill Nottingham <notting@redhat.com>
- update to 1.4.0, sort out patches

* Sun May 16 1999 Jeff Johnson <jbj@redhat.com>
- don't remove old binaries (not from BUILD_ROOT!) during install (#2735).

* Wed Mar 31 1999 Preston Brown <pbrown@redhat.com>
- moved temporary svgalib files to /var/lib/svgalib

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Sun Aug 23 1998 Jeff Johnson <jbj@redhat.com>
- verify dumpreg is not setuid (problem #760)
- specfile fiddles

* Thu Jul 30 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to 1.3.0
- security patch

* Thu May 07 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Thu Apr 30 1998 Cristian Gafton <gafton@redhat.com>
- devel package moved to Development/Libraries

* Mon Apr 06 1998 Erik Troan <ewt@redhat.com>
- updated to svgalib 1.2.13
- uses a build root

* Mon Nov  3 1997 Michael Fulbright <msf@redhat.com>
- removed Mach64 from configuration, as the driver does not work

* Tue Oct 14 1997 Donnie Barnes <djb@redhat.com>
- spec file cleanups

