File fontforge-git.spec of Package fontforge-git

%define THISMONTHSHORT %(LC_TIME='en_US.UTF-8' date +%%b)
%define THISMONTHLONG %(LC_TIME='en_US.UTF-8' date +%%B)
%define THISYEAR %(date +%%Y)
%define DAYNUMBER %(LC_TIME='en_US.UTF-8' date +%%d)
%define DAYNAMESHORT %(LC_TIME='en_US.UTF-8' date +%%a)
#today format: Mon Jan 1 2024
%define today %{DAYNAMESHORT} %{THISMONTHSHORT} %{DAYNUMBER} %{THISYEAR}
#TODO: add manpage if missing
#manpage_date format: January 2024
%define manpage_date "%{THISMONTHLONG} %{THISYEAR}"
%define packager Kimi
%define packager_lowercase %(echo %{packager} | tr '[:upper:]' '[:lower:]')
%define packagerEmail noreply@nodomain.org
%define _name fontforge
%define _install_prefix /usr
Name:           %{_name}-git
Version:        20230101.27+git9f2d72e3
Release:        0
Summary:        A Font Editor
License:        GPL-3.0-or-later
URL:            https://fontforge.org/
#Source0:        https://github.com/fontforge/fontforge/archive/%%{version}.tar.gz
Source0:        %{name}-%{version}.tar.xz
# workaround for bug 930076, imho upstream should fix this
# https://github.com/fontforge/fontforge/issues/2270
# Patch0:         fontforge-version.patch
# Patch5:         add-bitmap-transform-support.patch
Patch0:         0002-remove-custom-library-search-path.patch
Patch1:         0003-use-local-libjs-mathjax.patch
Patch2:         2003_avoid_privacy_breach.patch
Patch3:         2004-fix-privacy-breach-logo.patch
BuildRequires:  cairo-devel
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  fontconfig-devel
BuildRequires:  gcc-c++
BuildRequires:  giflib-devel
BuildRequires:  git
BuildRequires:  gtk3-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libspiro-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  pango-devel
BuildRequires:  pkgconfig
BuildRequires:  python3-devel
BuildRequires:  readline-devel
BuildRequires:  woff2-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xft)
BuildRequires:  pkgconfig(xi)
%if 0%{?suse_version}
BuildRequires:  ninja
BuildRequires:  freetype2-devel
BuildRequires:  gettext-tools
BuildRequires:  python3-Sphinx
BuildRequires:  update-desktop-files
BuildRequires:  gtkmm3-devel
%endif
%if 0%{?fedora_version}
BuildRequires:  ninja-build
BuildRequires:  desktop-file-utils
#BuildRequires:  ghc-gi-freetype2-devel
BuildRequires:  freetype-devel
BuildRequires:  gettext
BuildRequires:  python3-sphinx
BuildRequires:  shared-mime-info
BuildRequires:  gtk3-devel
BuildRequires:  libXt-devel
BuildRequires:  xorg-x11-proto-devel
BuildRequires:  libappstream-glib
BuildRequires:  gtkmm3.0-devel
Requires:       xdg-utils
Requires:       (autotrace or potrace)
Requires:       hicolor-icon-theme
%py_provides python3-fontforge
%py_provides python3-psMat
%endif
Conflicts:      %{_name}

%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
%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
Requires:       %{name} = %{version}
%if 0%{?suse_version}
Requires:       freetype2-devel
%endif
Conflicts:      %{_name}-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
%autosetup -p1

%build
#find /home/abuild/rpmbuild
echo "--- Listing rpmbuild variables ---"
echo %%_prefix=%{_prefix}
echo %%_exec_prefix=%{_exec_prefix}
echo %%_bindir=%{_bindir}
echo %%_sbindir=%{_sbindir}
echo %%_libexecdir=%{_libexecdir}
echo %%_datadir=%{_datadir}
echo %%_sysconfdir=%{_sysconfdir}
echo %%_sharedstatedir=%{_sharedstatedir}
echo %%_localstatedir=%{_localstatedir}
echo %%_libdir=%{_libdir}
echo %%_includedir=%{_includedir}
echo %%_oldincludedir==%{_oldincludedir}
echo %%_infodir=%{_infodir}
echo %%_mandir=%{_mandir}
echo %%buildroot=%{buildroot}
echo %%_topdir=%{_topdir}
echo %%_builddir=%{_builddir}
echo %%_rpmdir=%{_rpmdir}
echo %%_sourcedir=%{_sourcedir}
echo %%_specdir=%{_specdir}
echo %%_srcrpmdir=%{_srcrpmdir}
echo %%_buildrootdir=%{_buildrootdir}
echo %%sourcefile=%{sourcefile}
echo %%source_root_directory=%{source_root_directory}
echo "--- Ported variables ---"
echo %%{builddir}=%{builddir}
echo %%{_builddir}=%{_builddir}
echo %%{_srcdir}=%{_srcdir}
echo %%{sourcedir}=%{sourcedir}
echo %%{_sourcedir}=%{_sourcedir}
echo "--- End variables ---"
echo "pwd=$(pwd)"
# Source file %%{_sourcedir}/*.tar.xz is extracted into %%{_builddir}/%%{name}-%%{version}
# Create the build directory
mkdir -pv %{_builddir}/%{name}-%{version}/build
cmake . \
    -B %{_builddir}/%{name}-%{version}/build -S %{_builddir}/%{name}-%{version} \
    -GNinja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=%{_install_prefix} \
    -DENABLE_MAINTAINER_TOOLS=TRUE \
    -DENABLE_FONTFORGE_EXTRAS=TRUE \
    -DCMAKE_INSTALL_DOCDIR=%{_docdir}/%{name}/html \
    -DUNIX=TRUE
echo "Configuration should have completed here."
ninja -C %{_builddir}/%{name}-%{version}/build
echo "Build should have completed here."

%install
DESTDIR="%{buildroot}" ninja -C %{_builddir}/%{name}-%{version}/build install
%if 0%{?suse_version}
%suse_update_desktop_file -i org.fontforge.FontForge VectorGraphics
%endif
%if 0%{?fedora_version}
desktop-file-install \
  --dir %{buildroot}%{_datadir}/applications            \
  --add-category X-Fedora                                  \
  desktop/org.fontforge.FontForge.desktop
%endif
%find_lang FontForge
# remove unneeded .la and .a files
find %{buildroot} -type f -name "*.la" -delete -print
find %{buildroot} -type f -name "*.a" -delete -print
rm %{buildroot}%{_docdir}/%{name}/html/.buildinfo
rm %{buildroot}%{_docdir}/%{name}/html/.nojekyll
%fdupes -s %{buildroot}%{_datadir}/%{_name}
echo "--- List files that will be packaged ---"
find %{buildroot} | sed "s|%{buildroot}||g"
echo "--- End list files that will be packaged ---"

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files -f FontForge.lang
%license LICENSE COPYING.gplv3
%exclude %{_docdir}/%{name}/html
%{_mandir}/man1/*.1%{?ext_man}
%{_bindir}/*
%{_libdir}/lib*.so.*
%{_datadir}/fontforge/
%{python3_sitearch}/*
%{_datadir}/applications/org.fontforge.FontForge.desktop
%{_datadir}/icons/hicolor/*/apps/org.fontforge.FontForge.png
%{_datadir}/icons/hicolor/scalable/apps/org.fontforge.FontForge.svg
%{_datadir}/metainfo/org.fontforge.FontForge.*.xml
# %%{_datadir}/pixmaps/org.fontforge.FontForge.*
%{_datadir}/mime/packages/%{_name}.xml
%dir %{_docdir}/%{name}

%files doc
%license LICENSE
%doc AUTHORS README.md
%doc %{_docdir}/%{name}/html

%files devel
%doc CONTRIBUTING.md
%{_libdir}/lib*.so

%changelog
* %{today} %{packager} <%{packagerEmail}> - %{version}
- Initial build.
openSUSE Build Service is sponsored by