Name:           fontforge
Version:        20170731
Release:        13
Summary:        Outline and bitmap font editor

License:        GPLv3+
URL:            http://fontforge.github.io/
Source0:        https://github.com/fontforge/fontforge/archive/20170731.tar.gz#/fontforge-%{version}.tar.gz
Source1:        http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=b324052;sf=tgz;name=gnulib-b324052.tar.gz
Patch0000:      fontforge-20140813-use-system-uthash.patch
Patch0001:      Add-python3-support.patch

Requires:       xdg-utils hicolor-icon-theme

BuildRequires:  gcc git libjpeg-devel libtiff-devel libpng-devel giflib-devel libxml2-devel freetype-devel
BuildRequires:  desktop-file-utils libXt-devel libXi-devel xorg-x11-proto-devel gettext pango-devel cairo-devel
BuildRequires:  python3-devel gnulib-devel libtool-ltdl-devel readline-devel uthash-devel shared-mime-info

Provides:       bundled(gnulib)

%description
FontForge is designed for editing outline and bitmap fonts in various formats, such as PostScript (ASCII and
binary Type 1, some Type 3 and Type 0), TrueType, OpenType (Type2) and CID-keyed fonts.

%package        devel
Summary:        Development tools for fontforge
Requires:       fontforge = %{version}-%{release} fontforge-help = %{version}-%{release} pkgconfig

%description    devel
This package includes the libraries and header files for developing applications against fontforge.

%package        help
Summary:        Documentation files for fontforge
BuildArch:      noarch

Provides:       fontforge-doc = %{version}-%{release}
Obsoletes:      fontforge-doc < %{version}-%{release}

%description    help
This package contains documentation files for fontforge.


%prep
%autosetup -p1
tar xzf %{SOURCE1}
sed -i -e '/^#!\//, 1d' pycontrib/webcollab.py
mkdir htdocs
cp -pr doc/html/* htdocs
%{__sed} -i 's/\r//' htdocs/Big5.txt
%{__sed} -i 's/\r//' htdocs/corpchar.txt

%build
./bootstrap --skip-git --gnulib-srcdir=gnulib-b324052
export CFLAGS="%{optflags} -fno-strict-aliasing"

%configure PYTHON=python3 --without-libspiro --without-libuninameslist
%make_build V=1

%install
%make_install
rm -f $RPM_BUILD_ROOT%{_libdir}/libgdraw.la
rm -f $RPM_BUILD_ROOT%{_libdir}/libgunicode.la
rm -f $RPM_BUILD_ROOT%{_libdir}/libgdraw.so
rm -f $RPM_BUILD_ROOT%{_libdir}/libgunicode.so

desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  desktop/fontforge.desktop


%delete_la_and_a

%find_lang      FontForge

install -d $RPM_BUILD_ROOT%{_datadir}/appdata
install -pm 644 desktop/fontforge.appdata.xml $RPM_BUILD_ROOT%{_datadir}/appdata

install -d $RPM_BUILD_ROOT%{_datadir}/mime/packages
install -pm 644 desktop/fontforge.xml $RPM_BUILD_ROOT%{_datadir}/mime/packages/

chmod 644 $RPM_BUILD_ROOT%{_datadir}/fontforge/python/gdraw/_gdraw.py

%files          -f FontForge.lang
%doc AUTHORS
%license LICENSE
%{_bindir}/*
%{_libdir}/lib*.so.*
%{_datadir}/applications/*fontforge.desktop
%{_datadir}/fontforge
%{_datadir}/icons/*
%{_datadir}/mime/*
%{_datadir}/appdata/*
%{python3_sitearch}/fontforge.so
%{python3_sitearch}/psMat.so
%exclude %{_datadir}/doc/fontforge

%files          devel
%{_includedir}/fontforge/
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc

%files          help
%doc htdocs
%{_mandir}/man1/*.1*

%changelog
* Tue Aug 18 2020 senlin<xiasenlin1@huawei.com> - 20170731-13
- add release for update

* Thu Apr 3 2020 zhujunhao <zhujunhao5@huawei.com> - 20170731-12
- Modify build option

* Thu Dec 12 2019 lihao <lihao129@huawei.com> - 20170731-11
- Package Init

