File gd.spec of Package gd

#
# spec file for package gd (Version 2.0.36.RC1)
#
# 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/
#

# norootforbuild


Name:           gd
BuildRequires:  fontconfig-devel freetype2-devel libjpeg-devel libpng-devel xorg-x11-libX11-devel xorg-x11-libXau-devel xorg-x11-libXdmcp-devel xorg-x11-libXpm-devel
License:        MIT
Group:          System/Libraries
Provides:       gdlib
Obsoletes:      gdlib 
AutoReqProv:    on
Version:        2.0.36.RC1
Release:        54
Url:            http://www.libgd.org/
Summary:        A Drawing Library for Programs That Use PNG and JPEG Output
Source:         gd-%{version}.tar.bz2
Source1:        baselibs.conf
Patch0:         gd-2.0.36RC1-warn.patch
#Patch1:         gd-CAN-2004-0941.patch
Patch2:         gd-format.patch
Patch3:         gd-aliasing.patch
Patch6:         gd-fontpath.patch
Patch7:         gd-2.0.36RC1-config.patch
Patch8:         gd-2.0.36.RC1-ppc64.patch
Patch9:         gd-png_check_sig.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Gd allows your code to quickly draw images complete with lines, arcs,
text, and multiple colors. It supports cut and paste from other images
and flood fills. It outputs PNG, JPEG, and WBMP (for wireless devices)
and is supported by PHP4.



Authors:
--------
    Thomas Boutell <boutell@boutell.com>

%package devel
Requires:       %{name} = %{version} glibc-devel
License:        MIT
Summary:        Drawing Library for Programs with PNG and JPEG Output
Group:          Development/Libraries/C and C++

%description devel
gd allows code to quickly draw images complete with lines, arcs, text,
multiple colors, cut and paste from other images, and flood fills. gd
writes out the result as a PNG or JPEG file. This is particularly
useful in World Wide Web applications, where PNG and JPEG are two of
the formats accepted for inline images by most browsers.



Authors:
--------
    Thomas Boutell <boutell@boutell.com>

%prep
%setup -q
#%patch0
%patch2 -p1
%patch3
%patch6
%patch7
%patch8
%patch9

%build
autoreconf -fiv
export CFLAGS="$RPM_OPT_FLAGS"
export CPPFLAGS="%{optflags}" 
%configure \
	--with-freetype \
	--with-jpeg \
	--with-png \
	--with-xpm \
	--disable-static \
	--with-pic
%{__make} %{?jobs:-j%jobs}

%check
export MALLOC_CHECK_=2 MALLOC_PERTURB_=$((${RANDOM:-256} % 256))
#run test programs
cp test/gdtest_wbmp_to_png.png gdtest.png
./gdtest gdtest.png  2>&1 |tee gdtest.log
grep ERROR gdtest.log && exit 1
./gdtest demoin.png  2>&1 |tee gdtest.log
# wbmp test fails on color image, this is OK
grep -v "gdtest.png, gdtest.wbmp.*ERROR" gdtest.log | grep ERROR && exit 1 
./gddemo
# The following would require xorg-x11-fonts-scalable which we do not like to have as requirement
# so disable it.
#for f in `find /usr/share/fonts/truetype /usr/X11R6/lib/X11/fonts/truetype -name "*.ttf"` ; do
#    ./gdtestft $f
#done
unset MALLOC_CHECK_ MALLOC_PERTURB_

%install
make install DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc COPYING INSTALL README* index.html
/usr/bin/annotate
/usr/bin/bdftogd
/usr/bin/gd2copypal
/usr/bin/gd2togif
/usr/bin/gd2topng
/usr/bin/gdcmpgif
/usr/bin/gdparttopng
/usr/bin/gdtopng
/usr/bin/giftogd2
/usr/bin/pngtogd
/usr/bin/pngtogd2
/usr/bin/webpng
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root)
%{_bindir}/gdlib-config
%{_includedir}/*
%{_libdir}/*.so
%exclude %{_libdir}/*.la

%changelog