File fontconfig.spec of Package fontconfig

# spec file for package fontconfig
# Copyright (c) 2011 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:           fontconfig
%define build_docs 0
BuildRequires:  freetype2-devel libexpat-devel pkgconfig
%if %{build_docs}
BuildRequires:  docbook-dsssl-stylesheets docbook-utils docbook_3 docbook_4 iso_ent jadetex libpng libxml2 libxml2-devel lynx openjade opensp perl-SGMLS sgml-skel
License:        Public Domain, Freeware ; MIT License (or similar)
Provides:       XFree86:/etc/fonts/fonts.dtd
Group:          System/Libraries
AutoReqProv:    on
# bug437293
%ifarch ppc64
Obsoletes:      fontconfig-64bit
Requires:       bash
Version:        2.8.0
Release:        14
Summary:        Library for Font Configuration
# CVS can be found here: (CVS is gone, fontconfig uses git now).
# $ cvs -d login
# CVS password: <hit return>
# $ cvs -d co fontconfig
# oldneededforbuild  expat freetype2 freetype2-devel pkgconfig
# After building with "build_docs" defined to "1" generate the doc tarball with:
# tar jcf fontconfig-doc.tar.bz2 fc-*/*.[0-9] doc/*.[0-9] doc/*.html doc/*/*.html doc/*.txt 
Source1:        %name-doc-%version.tar.bz2
Source2:        iso639-1
Source3:        iso639-2
Source4:        baselibs.conf
Source10:       suse-generic-names.conf
Source11:       suse-pre-user.conf
Source12:       suse-post-user.conf
Source13:       suse-hinting.conf
Source14:       suse-bitmaps.conf
Source15:       suse-font-dirs.conf
Source20:       local.conf.instsys
Source30:       29-liberation-aliases.conf
Source31:       10-lcdfilter-lcddefault.conf
Patch5:         AppleRoman-DynaFont.patch
Patch10:        conf.patch
Patch16:        make-check.patch
Patch30:        bugzilla-179457-fix-font-file-names-for-wine.patch
Patch31:        bugzilla-246783-do-not-crash-when-config-files-contain-broken-stuff.patch
Patch32:        usr-share-doc-packages.patch
Patch33:        bnc438855-make-FcInitReinitialize-work-again.patch
Patch34:        urw-aliases-whitespaces.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Fontconfig is a library for configuring and customizing font access. It
contains two essential modules: the configuration module, which builds
an internal configuration from XML files, and the matching module,
which accepts font patterns and returns the nearest matching font.

%package devel
License:        MIT License (or similar)
Requires:       %{name} = %version
Requires:       freetype2-devel glibc-devel
Provides:       XFree86-devel:%_libdir/pkgconfig/fontconfig.pc
Group:          Development/Libraries/C and C++
Summary:        Include Files and Libraries mandatory for Development
# bug437293
%ifarch ppc64
Obsoletes:      fontconfig-devel-64bit

%description devel
This package countains all include files, libraries, configuration
files needed for compiling applications which use the fontconfig

In addition, it contains extensive documentation and manual pages for
developers using the library.

Fontconfig is a library for configuring and customizing font access. It
contains two essential modules, the configuration module which builds
an internal configuration from XML files and the matching module which
accepts font patterns and returns the nearest matching font.

%setup -q
%if %{build_docs} < 1
   tar xvf %{SOURCE1}
%patch5 -p0 -b .dynafont
%patch10 -p1 -b .fonts.conf
%patch16 -p1
#%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1

%configure --with-pic  \
%if %suse_version > 1100
        --disable-static \
	--with-freetype-lib=%_libdir \
  	--with-x \
  	--enable-libxml2=no \
  	--with-confdir=/etc/fonts \
  	--with-docdir=%{_defaultdocdir}/%{name} \
  	--with-add-fonts=/usr/X11R6/lib/X11/fonts,/opt/kde3/share/fonts,/usr/local/share/fonts \
	%if %{build_docs} < 1
make %{?jobs:-j %jobs}

export MALLOC_CHECK_=2
make %{?jobs:-j %jobs} check

make DESTDIR=$RPM_BUILD_ROOT pkgconfigdir=%{_libdir}/pkgconfig install
mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/fontconfig
mkdir -p $RPM_BUILD_ROOT/%{_defaultdocdir}/fontconfig-devel
install -m 644 AUTHORS COPYING ChangeLog README $RPM_SOURCE_DIR/iso639-? \
#install -m 644 fc-lang/iso639-{1,2} $RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}
install -m 644 doc/*.html $RPM_BUILD_ROOT/%{_defaultdocdir}/fontconfig
install -m 644 doc/fontconfig-user.txt $RPM_BUILD_ROOT/%{_defaultdocdir}/fontconfig
install -m 644 doc/fontconfig-devel/*  $RPM_BUILD_ROOT/%{_defaultdocdir}/fontconfig-devel
install -m 644 doc/fontconfig-devel.txt  $RPM_BUILD_ROOT/%{_defaultdocdir}/fontconfig-devel
for i in 1 3 5
    mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man${i}/
    for j in fc-*/*.${i} doc/*.${i} doc/*/*.${i}
        test -f ${j} && install -m 644 ${j} $RPM_BUILD_ROOT/%{_mandir}/man${i}/
    gzip --best $RPM_BUILD_ROOT/%{_mandir}/man${i}/*.${i}
# install the conf.d README as well, I think it's helpful:
install -m 644 conf.d/README $RPM_BUILD_ROOT/etc/fonts/conf.d
install -m 644 $RPM_SOURCE_DIR/suse*.conf $RPM_BUILD_ROOT/etc/fonts/
install -m 644 $RPM_SOURCE_DIR/local.conf.instsys $RPM_BUILD_ROOT/etc/fonts/
install -m 644 $RPM_SOURCE_DIR/29-liberation-aliases.conf $RPM_BUILD_ROOT/etc/fonts/conf.avail
install -m 644 $RPM_SOURCE_DIR/10-lcdfilter-lcddefault.conf $RPM_BUILD_ROOT/etc/fonts/conf.avail
# tune links in conf.d:
pushd $RPM_BUILD_ROOT/etc/fonts/conf.d
    ln -s ../suse-font-dirs.conf 05-suse-font-dirs.conf
    ln -s ../conf.avail/29-liberation-aliases.conf 29-liberation-aliases.conf 
    ln -s ../conf.avail/10-lcdfilter-lcddefault.conf 10-lcdfilter-lcddefault.conf
    rm -f 50-user.conf
    rm -f 51-local.conf
    ln -s ../suse-pre-user.conf 50-suse-pre-user.conf
    ln -s ../conf.avail/51-local.conf 55-local.conf
    ln -s ../conf.avail/50-user.conf 56-user.conf
    ln -s ../suse-post-user.conf 58-suse-post-user.conf
# don't package any files in the cache directory, only the directory itself:
rm -f $RPM_BUILD_ROOT/var/cache/fontconfig/*
%if %suse_version > 1100
rm -f %{buildroot}%{_libdir}/*.la

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%doc %{_defaultdocdir}/%{name}
%dir /etc/fonts
%config /etc/fonts/fonts.dtd
%config /etc/fonts/fonts.conf
%config /etc/fonts/suse-generic-names.conf
%config /etc/fonts/suse-font-dirs.conf
%config /etc/fonts/suse-pre-user.conf
%config /etc/fonts/suse-post-user.conf
%config %verify(not md5 size mtime) /etc/fonts/suse-hinting.conf
%config %verify(not md5 size mtime) /etc/fonts/suse-bitmaps.conf
%dir /etc/fonts/conf.avail/
%dir /etc/fonts/conf.d/
%config(noreplace) /etc/fonts/conf.d/*.conf
%config /etc/fonts/local.conf.instsys
%dir /var/cache/fontconfig/

%files devel
%doc %{_defaultdocdir}/%{name}-devel
%if %suse_version <= 1100