%define __libtoolize echo

# Note that this is NOT a relocatable package
Summary: An image loading and rendering library for X11R6.
Name: imlib
Version: 1.9.13
Release: 12
Epoch: 1
Copyright: LGPL
Group: System Environment/Libraries
Source: ftp://ftp.enlightenment.org/enlightenment/imlib/imlib-%{version}.tar.gz
Source2: local-hack-gmodule.tar.gz
Obsoletes: Imlib
BuildRoot: %{_tmppath}/%{name}-%{version}-root
URL: http://ftp.gnome.org/pub/GNOME/sources/imlib/
Requires: libtiff
Requires: libjpeg
Requires: zlib
Requires: gtk+ >= 1.2
BuildRequires: libpng-devel >= 1.2.2
BuildRequires: libtiff-devel
BuildRequires: libjpeg-devel
BuildRequires: zlib-devel
BuildRequires: gtk+-devel
BuildRequires: libungif-devel
BuildRequires: XFree86-devel
BuildRequires: /usr/bin/automake-1.4

Patch2: imlib-1.9.10-ac25.patch
Patch3: imlib-1.9.10-cppflags.patch
Patch4: imlib-1.9.13-gmodulehack.patch
# Bug fixes from 1.9.14
Patch5: imlib-1.9.13-waitpid.patch

%description
Imlib is a display depth independent image loading and rendering
library. Imlib is designed to simplify and speed up the process of
loading images and obtaining X Window System drawables. Imlib
provides many simple manipulation routines which can be used for
common operations.

Install imlib if you need an image loading and rendering library for
X11R6, or if you are installing GNOME. You may also want to install
the imlib-cfgeditor package, which will help you configure Imlib.

%package devel
Summary: Development tools for Imlib applications.
Group: Development/Libraries
Requires: imlib = %{epoch}:%{version}
Requires: libtiff-devel
Requires: libjpeg-devel
Requires: zlib-devel
Requires: gtk+-devel
Requires: libungif-devel
Requires: XFree86-devel
Obsoletes: Imlib

%description devel
The header files, static libraries and documentation needed for
developing Imlib applications. Imlib is an image loading and
rendering library for X11R6.

Install the imlib-devel package if you want to develop Imlib
applications. You will also need to install the imlib and
imlib_cfgeditor packages.

%package cfgeditor
Summary: A configuration editor for the Imlib library.
Group: System Environment/Libraries
Requires: imlib = %{epoch}:%{version}

%description cfgeditor
The imlib-cfgeditor package contains the imlib_config program, which
you can use to configure the Imlib image loading and rendering
library. Imlib_config can be used to control how Imlib uses color and
handles gamma corrections, etc.

If you are installing the imlib package, you should also install
imlib_cfgeditor.

%prep
%setup -q

%patch2 -p1 -b .ac25
%patch3 -p1 -b .cppflags
%patch4 -p1 -b .gmodulehack
%patch5 -p1 -b .waitpid

(cd gdk_imlib && tar zxf %{SOURCE2})

perl -p -i.bak -e 's/gmodule.h/gmodule-local.h/g; s/g_module/local_hack_g_module/g; s/GModule/LocalHackGModule/g; s/G_MODULE/LOCAL_HACK_G_MODULE/g' gdk_imlib/modules.c
perl -pi -e 's/-static//g' gdk_imlib/local-hack-gmodule/Makefile

## Change soname to reflect new libpng
perl -pi -e 's/10:14:9/11:0:0/g' Imlib/Makefile*
perl -pi -e 's/10:13:9/11:0:0/g' Imlib/Makefile*

%build
libtoolize --copy --force
aclocal-1.4
automake-1.4
autoconf
%configure

(cd gdk_imlib/local-hack-gmodule && make && cp gmodule-local.h ..)

make ## %{?_smp_mflags}

###########################################################################

%install
rm -rf $RPM_BUILD_ROOT
%makeinstall

rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README AUTHORS ChangeLog NEWS
%attr(755,root,root) %{_libdir}/lib*.so.*
%config %{_sysconfdir}/*
%{_libdir}/libimlib-*.so

%files cfgeditor
%defattr(-,root,root)
%{_bindir}/imlib_config

%files devel
%defattr(-,root,root)
%doc doc/*.gif doc/*.html
%{_bindir}/imlib-config
%{_libdir}/libImlib.so
%{_libdir}/libgdk_imlib.so
%{_libdir}/*.a
%{_includedir}/*
%{_datadir}/aclocal/*
%{_libdir}/pkgconfig/*
%{_datadir}/man/man*/*

%changelog
* Fri Jan 24 2003 Jonathan Blandford <jrb@redhat.com>
- add epoch to requires, #77919
- Fix URI, #71008

* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Tue Nov  5 2002 Jeremy Katz <katzj@redhat.com>
- rebuild to fixup Xlib dir in .pc file

* Tue Aug 13 2002 Havoc Pennington <hp@redhat.com>
- bump soname for new libpng, matches Debian soname
- mop up unpackaged files

* Fri Jul 19 2002 Jakub Jelinek <jakub@redhat.com>
- really remove -static

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Mon Jun 17 2002 Havoc Pennington <hp@redhat.com>
- remove -static that messed up prelinking

* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Mon May 13 2002 Jeremy Katz <katzj@redhat.com>
- rebuild in new environment

* Wed Apr 10 2002 Owen Taylor <otaylor@redhat.com>
- Backport file descriptor leak and extra waitpid fixes from 1.9.14

* Fri Mar 15 2002 Owen Taylor <otaylor@redhat.com>
- Remove netpbm dependencies

* Thu Mar 14 2002 Owen Taylor <otaylor@redhat.com>
- Version 1.9.13
- Bump version for 6.x/7.x split
- Remove automake-1.4 references

* Thu Feb 28 2002 Havoc Pennington <hp@redhat.com>
- backport to Hampton

* Thu Feb  7 2002 Havoc Pennington <hp@redhat.com>
- remove libpng10, instead load libpng without RTLD_GLOBAL in
  gdk_imlib, and break ABI of plain Imlib

* Wed Jan 09 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Tue Jan  8 2002 Havoc Pennington <hp@redhat.com>
- get rid of -I/usr/include that was hosing up the png build

* Mon Jan  7 2002 Havoc Pennington <hp@redhat.com>
- try to build against libpng10
- minor spec file cleanup

* Mon Jun 18 2001 Than Ngo <than@redhat.com>
- use %%{_tmppath}
- fix to build against new libtool

* Tue Apr 17 2001 Jonathan Blandford <jrb@redhat.com>
- Updated to new version (1.9.10)

* Fri Aug 11 2000 Jonathan Blandford <jrb@redhat.com>
- Up Epoch and release

* Tue Aug 01 2000 Jonathan Blandford <jrb@redhat.com>
- updated to new version.

* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Thu Jun 29 2000 Dave Mason <dcm@redhat.com>
- updated spec file to new RPM Guidelines

* Sat Jun  3 2000 Nalin Dahyabhai <nalin@redhat.com>
- change dependencies from libgr to netpbm

* Wed May 31 2000 Matt Wilson <msw@redhat.com>
- use makeinstall macro
- 1.9.8

* Fri Feb 25 2000 Elliot Lee <sopwith@redhat.com>
- Patch to use fallback locations for palette files.

* Thu Feb 03 2000 Preston Brown <pbrown@redhat.com>
- strip format plugins

* Tue Aug 31 1999 Elliot Lee <sopwith@redhat.com>
- Updates from the RHL 6.0 package.

* Mon Jan 11 1999 Carsten Haitzler <raster@redhat.com>
- up to 1.9.0

* Wed Sep 23 1998 Carsten Haitzler <raster@redhat.com>
- up to 1.8.1

* Tue Sep 22 1998 Cristian Gafton <gafton@redhat.com>
- yet another build for today (%defattr and %attr in the files lists)
- devel docs are back on the spec file

* Tue Sep 22 1998 Carsten Haitzler <raster@redhat.com>
- Added minor patch for ps saving code.

* Mon Sep 21 1998 Cristian Gafton <gafton@redhat.com>
- updated to version 1.8

* Fri Sep 11 1998 Cristian Gafton <gafton@redhat.com>
- take out imlib_config from devel package

* Wed Sep 9 1998 Michael Fulbright <msf@redhat.com>
- upgraded to 1.7
- changed name so it will persist if user later install devel imlib
- added subpackage for imlib_config

* Fri Apr 3 1998 Michael K. Johnson <johnsonm@redhat.com>
- fixed typo

* Fri Mar 13 1998 Marc Ewing <marc@redhat.com>
- Added -k, Obsoletes
- Integrate into CVS source tree