From b79f868d2d63461cf8e9db5155930c7d0414c9e4 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 18 Oct 2022 09:06:26 -0400 Subject: [PATCH] Enable gtkdoc documentation; build a -doc subpackage --- libinstpatch.spec | 55 +++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/libinstpatch.spec b/libinstpatch.spec index 4a341a7..7ab9735 100644 --- a/libinstpatch.spec +++ b/libinstpatch.spec @@ -3,15 +3,6 @@ # Since this has never worked, we do not have %%files entries for the result. %bcond_with introspection -# Fails with -# CMake Error: Error required internal CMake variable not set, cmake may not be -# built correctly. -# Missing variable is: -# CMAKE_FIND_LIBRARY_PREFIXES -# -# When/if this is fixed, we will probably want a -doc subpackage. -%bcond_with gtkdoc - Name: libinstpatch Version: 1.1.6 %global api_version 1.0 @@ -53,10 +44,8 @@ BuildRequires: pkgconfig(gobject-2.0) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gthread-2.0) BuildRequires: pkgconfig(sndfile) -%if %{with gtkdoc} # GTKDOC_ENABLED BuildRequires: pkgconfig(gtk-doc) -%endif %if %{with introspection} # INTROSPECTION_ENABLED BuildRequires: pkgconfig(gobject-introspection-1.0) @@ -87,14 +76,9 @@ Summary: Development files for %{name} # - examples/split_sfont.c # See the comment above the License field for the base package for full # details. -%if %{with gtkdoc} # None of the LicenseRef-Fedora-Public-Domain files are included in this # subpackage. License: LGPL-2.1-only -%else -# The examples are included in this subpackage. The License is implicitly the -# same as the base package. -%endif Requires: %{name}%{?_isa} = %{version}-%{release} Requires: glib2-devel%{?_isa} @@ -105,7 +89,6 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. -%if %{with gtkdoc} %package doc Summary: Documentation and examples for %{name} BuildArch: noarch @@ -123,7 +106,6 @@ BuildArch: noarch %description doc The %{name}-doc package contains documentation and examples for %{name}. -%endif %prep @@ -134,39 +116,46 @@ find examples -type f -name '*.py' -print -delete %build +# In the RPM build environment, a parallel build with gtkdoc documentation +# enabled fails with: +# /usr/bin/ld: cannot find -linstpatch-1.0: No such file or directory +# +# The best fix would be to find the missing dependency relationship or other +# problem in the CMake build scripts, but this is not quite obvious. +# +# Additionally, the problem seems to be triggered by something in the RPM build +# environment (CMake options, CFLAGS, etc.), and we haven’t narrowed this down +# yet, which means we aren’t prepared to report the problem upstream. +# Assistance is welcome. +# +# For now, the workaround is fine on Fedora 35–38 (although it does not work on +# EPEL7–EPEL9). +%global _smp_build_ncpus 1 + %cmake \ - -DGTKDOC_ENABLED:BOOL=%{?with_gtkdoc:ON}%{!?with_gtkdoc:OFF} \ + -DGTKDOC_ENABLED:BOOL=ON \ -DINTROSPECTION_ENABLED:BOOL=\ %{?with_introspection:ON}%{!?with_introspection:OFF} \ -GNinja %cmake_build + %install %cmake_install %files %license COPYING -%if %{without gtkdoc} -%doc ABOUT-NLS -%doc AUTHORS -%doc ChangeLog -%doc README.md -%doc TODO.tasks -%endif %{_libdir}/%{name}-%{api_version}.so.%{so_version} %{_libdir}/%{name}-%{api_version}.so.%{so_version}.* %files devel -%if %{without gtkdoc} -%doc examples -%endif %{_includedir}/%{name}-%{so_version} %{_libdir}/%{name}-%{api_version}.so %{_libdir}/pkgconfig/%{name}-%{api_version}.pc -%if %{with gtkdoc} + %files doc %license COPYING %doc ABOUT-NLS @@ -174,9 +163,9 @@ find examples -type f -name '*.py' -print -delete %doc ChangeLog %doc README.md %doc TODO.tasks -%doc examples -# TODO: built gtkdoc documentation -%endif +%doc examples/ +# gtkdoc +%doc %{_vpath_builddir}/docs/reference/html/ %changelog