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

# 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
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

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.

    Thomas Boutell <>

%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.

    Thomas Boutell <>

%setup -q
%patch2 -p1

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

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 
# 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



%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files devel
%exclude %{_libdir}/*.la