420fad1
# Sphinx-generated HTML documentation is not suitable for packaging; see
420fad1
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
420fad1
#
f5b6624
# We can generate PDF documentation as a substitute.
a35c1ad
%bcond doc_pdf 1
420fad1
2f00d0a
Name:           gi-docgen
4040705
Version:        2023.3
6773cbe
Release:        %autorelease
2f00d0a
Summary:        Documentation tool for GObject-based libraries
2f00d0a
ca5976b
# Based on the “Copyright and Licensing terms” in README.md, on the contents of
ca5976b
# .reuse/dep5, and on inspection of SPDX headers or other file contents with
ca5976b
# assistance from licensecheck.
ca5976b
#
b78801f
# The entire source is (Apache-2.0 OR GPL-3.0-or-later) except the following files that are
ca5976b
# packaged or are used to generate packaged files:
2f00d0a
#
4040705
# (Apache-2.0 OR GPL-3.0-or-later) AND BSD-2-Clause:
4040705
#   - gidocgen/mdext.py
4040705
#
2f00d0a
# MIT:
2f00d0a
#   - gidocgen/templates/basic/fzy.js
ca5976b
#   - gidocgen/templates/basic/solarized-{dark,light}.js
2f00d0a
#
b78801f
# CC0-1.0:
ca5976b
#   - gi-docgen.pc.in (from which gi-docgen.pc is generated)
ca5976b
#   - gidocgen/templates/basic/*.png
2f00d0a
#   - docs/CODEOWNERS (-doc subpackage)
2f00d0a
#   - examples/*.toml (-doc subpackage)
b78801f
#
4040705
# Note that CC0-1.0 is allowed in Fedora for content only; all of the above
4040705
# files may reasonably be called content.
4040705
#
4040705
# Additionally, CC0-1.0 appears in certain sample configuration snippets within
4040705
# the following files, which are otherwise (Apache-2.0 OR GPL-3.0-or-later):
4040705
#   - docs/project-configuration.rst
4040705
#   - docs/tutorial.rst
4040705
# On one hand, these are copied from real projects; on the other hand, they are
4040705
# very trivial. It’s not obvious whether they should be considered “real”
4040705
# CC0-1.0 content or not.
4040705
#
4040705
# The identifier LGPL-2.1-or-later also appears in a sample configuration
4040705
# template in docs/tutorial.rst, but the configuration in question is filled
4040705
# with placeholder values and is not copied from a real project, so it’s
4040705
# reasonable to consider LGPL-2.1-or-later a placeholder rather than a real
4040705
# license as well.
4040705
#
4040705
# -----
2f00d0a
#
3f899e3
# Additionally, the following sources are under licenses other than (Apache-2.0
3f899e3
# OR GPL-3.0-or-later), but are not packaged in any of the binary RPMs:
ca5976b
#
b78801f
# CC0-1.0:
d403f5d
#   - .editorconfig (not installed)
d403f5d
#   - .gitlab-ci.yml (not installed)
ca5976b
#   - gi-docgen.doap (not installed)
ca5976b
#   - MANIFEST.in (not installed)
4040705
#   - pytest.ini (not installed; test only)
4040705
#   - tests/data/config/*.toml (not installed; test only)
ca5976b
#
b78801f
# CC-BY-SA-3.0:
ca5976b
#   - docs/gi-docgen.{png,svg} (for HTML docs; not currently packaged)
d403f5d
#   - code-of-conduct.md (not installed)
ca5976b
#
b78801f
# OFL-1.1:
ca5976b
#   - gidocgen/templates/basic/*.{woff,woff2} (removed in prep)
ca5976b
#
b78801f
# GPL-2.0-or-later:
4040705
#   - tests/data/gir/{Utility-1.0,Regress-1.0}.gir (not installed; test only)
ca5976b
#
b78801f
# LGPL-2.0-or-later:
4040705
#   - tests/data/gir/{GLib,GObject,Gio}-2.0.gir (not installed; test only)
ca5976b
#
b78801f
# LGPL-2.0-or-later OR MPL-1.1:
4040705
#   - tests/data/gir/cairo-1.0.gir (not installed; test only)
4040705
License:        %{shrink:
4040705
                (Apache-2.0 OR GPL-3.0-or-later) AND
4040705
                BSD-2-Clause AND
4040705
                MIT AND
4040705
                CC0-1.0
4040705
                }
6ab2368
URL:            https://gitlab.gnome.org/GNOME/gi-docgen
887ece1
Source:         %{url}/-/archive/%{version}/gi-docgen-%{version}.tar.bz2
2f00d0a
2f00d0a
# We are prohibited from bundling fonts, and we are prohibited from shipping
2f00d0a
# fonts in web font formats; see
2f00d0a
# https://docs.fedoraproject.org/en-US/packaging-guidelines/FontsPolicy/#_web_fonts.
2f00d0a
#
2f00d0a
# Since upstream uses *only* web fonts, we need a patch. We haven’t offered it
2f00d0a
# upstream since upstream has no reason NOT to use web fonts.
2f00d0a
#
2f00d0a
# This patch removes all references to WOFF/WOFF2 font files (which we still
2f00d0a
# must remove in %%prep) and ensures the CSS correctly references corresponding
2f00d0a
# local system fonts.
93ea121
Patch:          gi-docgen-2022.2-no-web-fonts.patch
44c30c1
1db67ba
# https://gitlab.gnome.org/GNOME/gi-docgen/-/issues/179
1db67ba
Patch:          fix-broken-since-obsoletes.patch
1db67ba
2f00d0a
BuildArch:      noarch
2f00d0a
2f00d0a
BuildRequires:  python3-devel
2f00d0a
ca5976b
BuildRequires:  python3dist(pytest)
ca5976b
2f00d0a
# Documentation
420fad1
%if %{with doc_pdf}
2f00d0a
BuildRequires:  make
2f00d0a
BuildRequires:  python3dist(sphinx)
2f00d0a
BuildRequires:  python3dist(sphinx-rtd-theme)
420fad1
BuildRequires:  python3-sphinx-latex
420fad1
BuildRequires:  latexmk
420fad1
%endif
2f00d0a
2f00d0a
# Unbundling fonts:
2f00d0a
BuildRequires:  font(redhatdisplay)
2f00d0a
BuildRequires:  font(redhatdisplayblack)
2f00d0a
BuildRequires:  font(redhatdisplaymedium)
2f00d0a
BuildRequires:  font(redhattext)
2f00d0a
BuildRequires:  font(redhattextmedium)
2f00d0a
BuildRequires:  font(sourcecodepro)
2f00d0a
BuildRequires:  font(sourcecodeprosemibold)
2f00d0a
2f00d0a
# Unbundling fonts:
69d6241
Requires:       gi-docgen-fonts = %{version}-%{release}
2f00d0a
2f00d0a
# Trivial fork of https://github.com/jhawthorn/fzy.js (looks like it was
2f00d0a
# basically just wrapped in an IIFE). Given that modification, it’s not clear
2f00d0a
# how we could unbundle it, either downstream or with some kind of upstream
2f00d0a
# support.
2f00d0a
#
2f00d0a
# It’s not clear what version was used for the fork.
2f00d0a
Provides:       bundled(js-fzy)
2f00d0a
2f00d0a
%description
2f00d0a
GI-DocGen is a document generator for GObject-based libraries. GObject is the
2f00d0a
base type system of the GNOME project. GI-Docgen reuses the introspection data
2f00d0a
generated by GObject-based libraries to generate the API reference of these
2f00d0a
libraries, as well as other ancillary documentation.
2f00d0a
2f00d0a
GI-DocGen is not a general purpose documentation tool for C libraries.
2f00d0a
2f00d0a
While GI-DocGen can be used to generate API references for most GObject/C
2f00d0a
libraries that expose introspection data, its main goal is to generate the
2f00d0a
reference for GTK and its immediate dependencies. Any and all attempts at
2f00d0a
making this tool more generic, or to cover more use cases, will be weighted
2f00d0a
heavily against its primary goal.
2f00d0a
2f00d0a
GI-DocGen is still in development. The recommended use of GI-DocGen is to add
2f00d0a
it as a sub-project to your Meson build system, and vendor it when releasing
2f00d0a
dist archives.
2f00d0a
2f00d0a
You should not depend on a system-wide installation until GI-DocGen is declared
2f00d0a
stable.
2f00d0a
2f00d0a
2f00d0a
%package fonts
2f00d0a
Summary:        Metapackage providing fonts for gi-docgen output
2f00d0a
# Really, there is nothing copyrightable in this metapackage, so we give it the
2f00d0a
# overall license of the project.
b78801f
License:        Apache-2.0 OR GPL-3.0-or-later
2f00d0a
2f00d0a
Requires:       font(redhatdisplay)
2f00d0a
Requires:       font(redhatdisplayblack)
2f00d0a
Requires:       font(redhatdisplaymedium)
2f00d0a
Requires:       font(redhattext)
2f00d0a
Requires:       font(redhattextmedium)
2f00d0a
Requires:       font(sourcecodepro)
2f00d0a
Requires:       font(sourcecodeprosemibold)
2f00d0a
2f00d0a
%description fonts
69d6241
Because web fonts from upstream are not bundled in the gi-docgen package,
69d6241
documentation packages generated with gi-docgen must depend on this metapackage
2f00d0a
to ensure the proper system fonts are present.
2f00d0a
2f00d0a
2f00d0a
%package doc
69d6241
Summary:        Documentation for gi-docgen
b78801f
License:        (Apache-2.0 OR GPL-3.0-or-later) AND CC0-1.0
2f00d0a
2f00d0a
%description doc
69d6241
Documentation for gi-docgen.
2f00d0a
2f00d0a
2f00d0a
%generate_buildrequires
175ebda
%pyproject_buildrequires
2f00d0a
2f00d0a
2f00d0a
%prep
2f00d0a
%autosetup -p1
2f00d0a
56f1683
# Remove all bundled fonts. See gi-docgen-*-no-web-fonts.patch.
2f00d0a
find . -type f \( -name '*.woff' -o -name '*.woff2' \) -print -delete
2f00d0a
2f00d0a
2f00d0a
%build
2f00d0a
%pyproject_wheel
2f00d0a
420fad1
%if %{with doc_pdf}
ee7a1d9
sphinx-build -b latex -j%{?_smp_build_ncpus} docs %{_vpath_builddir}/_latex
f5b6624
%make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet'
420fad1
%endif
2f00d0a
2f00d0a
2f00d0a
%install
2f00d0a
%pyproject_install
2f00d0a
%pyproject_save_files gidocgen
2f00d0a
2f00d0a
install -t '%{buildroot}%{_pkgdocdir}' -D -m 0644 -p \
e0d8399
    CHANGES.md \
2f00d0a
    CONTRIBUTING.md \
2f00d0a
    docs/CODEOWNERS \
2f00d0a
    README.md
420fad1
%if %{with doc_pdf}
420fad1
install -t '%{buildroot}%{_pkgdocdir}' -p -m 0644 \
420fad1
    '%{_vpath_builddir}/_latex/gi-docgen.pdf'
420fad1
%endif
2f00d0a
cp -rp examples '%{buildroot}%{_pkgdocdir}/'
2f00d0a
2f00d0a
ca5976b
%check
ca5976b
%pytest
10b9115
10b9115
2f00d0a
%files -f %{pyproject_files}
53b5fa5
%license LICENSES/ .reuse/dep5
2f00d0a
69d6241
%{_bindir}/gi-docgen
69d6241
%{_mandir}/man1/gi-docgen.1*
2f00d0a
# Normally, this would go in a -devel package, but there is little point in
2f00d0a
# providing a -devel package for *just* the .pc file when there are no
2f00d0a
# libraries or headers.
69d6241
%{_datadir}/pkgconfig/gi-docgen.pc
2f00d0a
2f00d0a
2f00d0a
%files fonts
2f00d0a
# Empty; this is a metapackage
2f00d0a
2f00d0a
2f00d0a
%files doc
53b5fa5
%license LICENSES/ .reuse/dep5
f3d69a5
%doc %{_pkgdocdir}/
2f00d0a
2f00d0a
2f00d0a
%changelog
6773cbe
%autochangelog