File fontforge.spec of Package fontforge

#
# spec file for package fontforge
#
# Copyright (c) 2015 SUSE LINUX 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/
#


%define src_version %{version}-b
Name:           fontforge
Version:        20120731
Release:        0
Summary:        A Font Editor
License:        BSD-3-Clause
Group:          Productivity/Graphics/Vector Editors
Url:            http://fontforge.org/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}_full-%{src_version}.tar.bz2
Source1:        http://downloads.sourceforge.net/%{name}/%{name}_htdocs-%{src_version}.tar.bz2
# PATCH-FIX-OPENSUSE -- set path to documentation
Patch0:         fontforge-docdir.patch
Patch1:         fontforge-fdleak.patch
# workaround, this should be resolved upstream (use pkg-config) bnc#867041
Patch2:         fontforge-libpng.diff
# PATCH-FIX-OPENSUSE fontforge-python-module-name.diff -- change python module name according to naming policy
Patch3:         fontforge-python-module-name.diff
Patch4:         fontforge-fixgiflib.patch
# PATCH-FIX-UPSTREAM http://sourceforge.net/p/fontforge/git/ci/9ae25e0
Patch5:         fontforge-arraysubscript.patch
# suse specific
Patch6:         propagate-creation-and-modification-times-to-ttf.patch
BuildRequires:  cairo-devel
BuildRequires:  fdupes
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
BuildRequires:  gettext-tools
BuildRequires:  giflib-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  libuninameslist-devel
BuildRequires:  libxml2-devel
BuildRequires:  pango-devel
BuildRequires:  pkgconfig
BuildRequires:  python-devel
BuildRequires:  update-desktop-files
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xft)
BuildRequires:  pkgconfig(xi)
# following to avoid warning
# 'Application built with libpng-1.5.14 but running with 1.6.1'
%requires_eq    libpng16-16
Obsoletes:      PfaEdit < 20110222
Provides:       PfaEdit = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1210
BuildRequires:  libspiro-devel
%endif

%description
FontForge allows editing of outline and bitmap fonts.  With it, you can
create new fonts or modify old ones.  It also converts font formats and
can convert among PostScript (ASCII & binary Type 1, some Type 3s, and
some Type 0s), TrueType, OpenType (Type2), and CID-keyed fonts.

%package doc
Summary:        Documentation for FontForge
Group:          Documentation/HTML
%if 0%{?suse_version} >= 1230
BuildArch:      noarch
%endif

%description doc
FontForge allows editing of outline and bitmap fonts. With it, you can
create new fonts or modify old ones. It also converts font formats and
can convert among PostScript, TrueType, OpenType, and CID-keyed fonts.

This subpackage contains the documentation to FontForge.

%package devel
Summary:        Include Files and Libraries mandatory for Development
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       freetype2-devel

%description devel
FontForge allows editing of outline and bitmap fonts. With it, you can
create new fonts or modify old ones. It also converts font formats and
can convert among PostScript, TrueType, OpenType, and CID-keyed fonts.

This subpackage contains all necessary include files and libraries needed
to develop applications that use FontForge libraries.

%prep
%setup -q -T -n fontforge-%{src_version} -b 0
%patch0 -p 1 -b .docdir
%patch1
%patch2
%patch3
%if 0%{?suse_version} > 1230
%patch4 -p1
%endif
%patch5 -p1
%patch6 -p1
mkdir docs
tar -jxvf %{SOURCE1} -C docs
chmod 644 docs/quadraticspline.gif
chmod 644 docs/FontForgeSplash.png
chmod 644 docs/*.html
# tar zxvf docs/cidmaps.tgz
find . -name CVS -type d | xargs rm -rf
# fix wrong-file-end-of-line-encoding
sed -i 's/\r$//' docs/{Big5.txt,corpchar.txt}

%build
# workaround, this should be resolved upstream (use pkg-config) bnc#867041
pkg-config --exists 'libpng >= 1.7.0' && echo 'Libpng was updated to 1.7, fontforge-libpng.patch will probably need to be adapted.' && exit 1
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure \
    --disable-static \
    --enable-pyextension \
    --with-regular-link

make %{?_smp_mflags}
pushd pyhook
python setup.py build
popd

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
# symlink for old FontForge name - PfaEdit
pushd %{buildroot}%{_bindir}
    ln -s fontforge pfaedit
popd
# install CMaps to be able to edit CID-keyed fonts:
# install -m 644 Adobe* %{buildroot}%{_datadir}/fontforge
# desktop file and icon
install -Dm 644 Packaging/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm 644 Packaging/icons/48x48/apps/%{name}.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
%suse_update_desktop_file -i %{name} VectorGraphics
%find_lang FontForge
find %{buildroot} -type f -name "*.la" -delete -print
pushd pyhook
python setup.py install \
   --root=%{buildroot} \
   --prefix=%{_prefix} \
   --record-rpm=%{name}-python.files
popd
%fdupes -s %{buildroot}%{_datadir}/%{name}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files -f FontForge.lang
%defattr(-,root,root)
%doc LICENSE
%{_bindir}/*
%{_libdir}/lib*.so.*
%{_datadir}/fontforge/
%{_mandir}/man1/*.1*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{py_sitedir}/*

%files doc
%defattr(-,root,root)
%doc AUTHORS VERSION LICENSE README-unix docs/

%files devel
%defattr(-, root, root)
%{_includedir}/fontforge/
%{_libdir}/pkgconfig/*.pc
%{_libdir}/lib*.so

%changelog
openSUSE Build Service is sponsored by