%define _defaultdocdir %{_prefix}/doc
%define freetype2_version 2.1.7

Summary:	Font configuration and customization library
Name:		fontconfig
Version:	2.2.2
Release:	3
License:	IBM_ILA
Group:		System Environment/Libraries
URL:		http://fontconfig.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-root
Source:		%{name}-%{version}.tar.gz
Source1:	IBM_ILA
Prereq:		freetype2 >= %{freetype2_version}
BuildRequires:	freetype2-devel >= %{freetype2_version}
Prefix:		%{_prefix}

%description
Fontconfig is designed to locate fonts within the system and select them
according to requirements specified by applications.

%package devel
Summary:	Font configuration and customization library
Group:		Development/Libraries
Requires:	%{name} = %{version}
Requires:	freetype2-devel >= %{freetype2_version}

%description devel
The fontconfig-devel package includes the header files, and developer docs
for the fontconfig package.
Install fontconfig-devel if you want to develop programs which will use
fontconfig.

%define DEFCC cc

%prep
%setup -q

# Put License into place
cp $RPM_SOURCE_DIR/IBM_ILA  LICENSE
cat COPYING >> LICENSE

%build
# Use the default compiler for this platform - gcc otherwise
if [[ -z "$CC" ]]
then
    if test "X`type %{DEFCC} 2>/dev/null`" != 'X'; then
       export CC=%{DEFCC}
    else
       export CC=gcc
    fi
fi
if test "X$CC" != "Xgcc"
then
       export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's:-fsigned-char::'`
       export CFLAGS="$RPM_OPT_FLAGS"
fi

./configure --prefix=%{_prefix} --disable-static
make

%install
if test "%{buildroot}" != "/"; then
        rm -rf %{buildroot}
fi
mkdir -p %{buildroot}
make DESTDIR=%{buildroot} install

( cd $RPM_BUILD_ROOT

 /usr/bin/strip .%{prefix}/bin/* || :

 mkdir -p usr/bin
 cd usr/bin
 ln -sf ../..%{prefix}/bin/* .
 cd -
 mkdir -p usr/include
 cd usr/include
 ln -sf ../..%{prefix}/include/* .
 cd -

 mkdir -p usr/lib
 cd usr/lib
 ln -sf ../..%{prefix}/lib/*.a .
 cd -
)

%post
# Force regeneration of all fontconfig cache files.
%{_bindir}/fc-cache -f >/dev/null 2>&1

%files
%defattr(-, root, system)
%doc README AUTHORS COPYING LICENSE
%{_libdir}/libfontconfig.a
%{_bindir}/fc-cache
%{_bindir}/fc-list
%dir %{_sysconfdir}/fonts
%{_sysconfdir}/fonts/*
/usr/bin/*
/usr/lib/*

%files devel
%defattr(-, root, system)
%{_libdir}/libfontconfig.la
%{_libdir}/pkgconfig/*.pc
%dir %{_includedir}/fontconfig
%{_includedir}/fontconfig/*
%{_mandir}/man*/*
/usr/include/fontconfig

%changelog
* Wed Nov 17 2004 David Clissold <cliss@austin.ibm.com> 2.2.2-3
- Prereq (not Require) freetype2.  add %dir fonts and fontconfig

* Wed Jun 09 2004 Dan McNichol <mcnichol@austin.ibm.com> 2.2.2-2
- Rebuild with TrueType fonts installed on the system.

* Fri Apr 23 2004 David Clissold <cliss@austin.ibm.com> 2.2.2-1
- Update to version 2.2.2

* Wed Jul 16 2003 David Clissold <cliss@austin.ibm.com>
- Correct requisite to freetype2, not freetype

* Wed Jul 02 2003 Dan McNichol <mcnichol@austin.ibm.com>
- Original build for AIX.

