File dba-cairo-1142-static.spec of Package dba-cairo-1142-static

%define real_name cairo
%define prefix    /DBA/%{real_name}/%{version}
%define	version	1.14.2
%define vers    1142
%define dba_pix 1
%define dba_png 0
%define dba_xml 1
%if 0%{?sles_version} == 10
%define dba_pix 0
%endif

Name:		dba-%{real_name}-%{vers}-static
Summary:	A 2D graphics library version 1.14.2
Version:	%{version}
Release:	1%{?dist}
URL:		http://cairographics.org
License:	LGPL-2.0
Group:		System Environment/Libraries
Source0:	http://cairographics.org/releases/%{real_name}-%{version}.tar.bz2
Patch3:         cairo-multilib.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires: autoconf automake libtool
BuildRequires: perl(ExtUtils::MakeMaker) perl(Digest::MD5) perl(Data::Dumper) perl(Module::Build)
BuildRequires: pkgconfig
%if 0%{?suse_version}
BuildRequires:  xorg-x11-devel
%else
BuildRequires:  libX11-devel
%endif
BuildRequires: freetype-devel
BuildRequires: fontconfig-devel
BuildRequires: glib2-devel
BuildRequires: Mesa-devel

%if %{dba_pix}
BuildRequires:  dba-pixman-0326-static
%define pixpath /DBA/pixman/0.32.6
#!BuildIgnore:  libpixman-1-0-devel pixman-devel
%else
BuildRequires:  pixman-devel
%endif

%if %{dba_png}
BuildRequires:  dba-libpng-1617-static
%define pngpath /DBA/libpng/1.6.17
#!BuildIgnore:  libpng-devel libpng
%else
BuildRequires:  libpng-devel
%endif

%if %{dba_xml}
BuildRequires:  dba-libxml2-291-static
BuildRequires:  libxml2-devel
%define xmlpath /DBA/libxml2/2.9.1
%else
BuildRequires:  libxml2-devel
%endif

%if 0%{?suse_version} >= 1100
BuildRequires:	-post-build-checks
%endif


%description
Cairo is a 2D graphics library designed to provide high-quality display
and print output. Currently supported output targets include the X Window
System, OpenGL (via glitz), in-memory image buffers, and image files (PDF,
PostScript, and SVG).

Cairo is designed to produce consistent output on all output media while
taking advantage of display hardware acceleration when available (e.g.
through the X Render Extension or OpenGL).


%prep
%setup -q -n %{real_name}-%{version}
%patch3 -p1 -b .multilib

%build
export CFLAGS="%{optflags}"
export LDFLAGS="$LDFLAGS -lX11"

%if %{dba_pix}
export CFLAGS="$CFLAGS -I%{pixpath}/include"
export CPPFLAGS="$CPPFLAGS -I%{pixpath}/include"
export LDFLAGS="$LDFLAGS -L%{pixpath}/lib"
%endif

%if %{dba_xml}
export CFLAGS="$CFLAGS -I%{xmlpath}/include"
export CPPFLAGS="$CPPFLAGS -I%{xmlpath}/include"
export LDFLAGS="$LDFLAGS -L%{xmlpath}/lib"
%endif


./configure \
  --prefix=%{prefix} \
  --disable-shared \
  --enable-static \
  --with-pic \
  --disable-xlib \
  --enable-win32=no \
%if %{dba_xml}
  --enable-xml \
%endif
  --enable-ft		\
  --enable-ps		\
  --enable-pdf		\
  --enable-svg		\
  --enable-tee		\
  --enable-gl		\
  --enable-gobject	\
  --disable-gtk-doc

sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make V=1 %{?_smp_mflags}


%install
make install V=1 DESTDIR=$RPM_BUILD_ROOT
rm -f `find %{buildroot} -name *.la`


%post
# add cairo*.pc to pkgconfig directory
if [ -d %{_libdir}/pkgconfig ]; then
  %{buildroot}%{prefix}/lib/pkgconfig
  FILES=`ls cairo*.pc`
  cd %{_libdir}/pkgconfig
  for F in $FILES
  do
  if [ -e $F ]; then
    %{__rm} -f $F
  fi
  %{__ln_s} -f %{prefix}/lib/pkgconfig/$F .
fi


%files
%defattr(-,root,root)
%dir %{prefix}
%{prefix}/*


%changelog
* Fri Apr 24 2015 Holger Manthey <holger.manthey@bertelsmann.de>
- inital version