summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2023-04-05 15:42:22 +0300
committerPanu Matilainen <pmatilai@redhat.com>2023-04-11 13:13:23 +0300
commitd648cb305cd6d49ca453b3b80941d9fc0cdad1f7 (patch)
treee97db9a54d56e86d5a51bed3078cea2dbcf74195
parent587b53cf6bffbc4526e3d3cc6570fc50abaf1c18 (diff)
downloadrpm-d648cb305cd6d49ca453b3b80941d9fc0cdad1f7.tar.gz
Include pre-built API docs and man pages in dist tarballs
There are multiple strange details buried in this all, such as having to run the main tarball creation in VERBATIM mode due to git submodule foreach variables, and because of that we can't use globs in the other commands but have to mask them behind other rules to do other steps and then concatenate the tarballs at end. On the build side we need to manually test for the presence of pre-built content in the source directory (normally that content would be in binary directories) and install differently in absence of the tooling that could actually build those docs. While at it, put both the API docs and man pages in their expected destinations, install(FILES .. TYPE MAN) is not aware of sections (:facepalm:) and just puts stuff into the root man directory. With DOC that is expected, but not where packaging expects to find it. Except that we're now *installing* the API docs too, put them under rpm/API docs without any extra html directories in between.
-rw-r--r--CMakeLists.txt15
-rw-r--r--docs/CMakeLists.txt5
-rw-r--r--docs/man/CMakeLists.txt21
3 files changed, 36 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 51a37386b..f7b167b3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -398,11 +398,21 @@ function(add_tarball targetname namever treeish)
set(distfmt tar)
set(tarname ${namever}.${distfmt})
set(distname ${tarname}.bz2)
+ set(docname ${namever}-doc.${distfmt})
+
+ add_custom_target(${docname}
+ DEPENDS man apidoc
+ COMMAND tar
+ -C ${CMAKE_BINARY_DIR}
+ --transform 's:^:${namever}/:'
+ -cf ${docname} docs/man/*.[1-8] docs/html/
+ )
add_custom_target(${distname}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ BYPRODUCTS ${distname} ${docname}
VERBATIM
- DEPENDS ChangeLog
+ DEPENDS ChangeLog ${docname}
COMMAND git archive
--format=${distfmt}
--output=${CMAKE_BINARY_DIR}/${tarname}
@@ -416,6 +426,9 @@ function(add_tarball targetname namever treeish)
--file=${CMAKE_BINARY_DIR}/${tarname} \
${CMAKE_BINARY_DIR}/$sha1.tar \
&& rm -f ${CMAKE_BINARY_DIR}/$sha1.tar"
+ COMMAND tar --concatenate
+ --file=${CMAKE_BINARY_DIR}/${tarname}
+ ${CMAKE_BINARY_DIR}/${docname}
COMMAND bzip2 -f ${CMAKE_BINARY_DIR}/${tarname}
)
add_custom_target(${targetname} DEPENDS ${distname})
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 0a56bd589..65cd4f61f 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -8,8 +8,11 @@ if (${DOXYGEN_FOUND})
file(GLOB headers ${CMAKE_SOURCE_DIR}/include/rpm/*.h)
doxygen_add_docs(apidoc librpm/Doxyheader.h ${headers}
ALL USE_STAMP_FILE)
- install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html TYPE DOC)
+ set(doxsrc ${CMAKE_CURRENT_BINARY_DIR})
+elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/html/index.html)
+ set(doxsrc ${CMAKE_CURRENT_SOURCE_DIR})
endif()
+install(DIRECTORY ${doxsrc}/html/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/API)
install(FILES
manual/arch_dependencies.md
diff --git a/docs/man/CMakeLists.txt b/docs/man/CMakeLists.txt
index 479ea297b..b1b901b05 100644
--- a/docs/man/CMakeLists.txt
+++ b/docs/man/CMakeLists.txt
@@ -31,13 +31,28 @@ if (ENABLE_PLUGINS)
endif()
foreach(man ${manuals})
- # XXX manuals should be pre-built in tarballs
+ unset(fn)
if (EXISTS ${PANDOC})
add_custom_command(OUTPUT ${man} COMMAND ${PANDOC}
${CMAKE_CURRENT_SOURCE_DIR}/${man}.md
-s -t man -o ${man} DEPENDS ${man}.md)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${man} TYPE MAN)
+ set(fn ${CMAKE_CURRENT_BINARY_DIR}/${man})
+ else()
+ # dist tarballs have pre-built manuals in the source dir
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${man})
+ set(fn ${CMAKE_CURRENT_SOURCE_DIR}/${man})
+ endif()
+ endif()
+ if (fn)
+ get_filename_component(ext ${fn} EXT)
+ string(REPLACE "." "man" section ${ext})
+ install(FILES ${fn}
+ DESTINATION ${CMAKE_INSTALL_MANDIR}/${section})
endif()
endforeach()
+if (fn)
+ add_custom_target(man ALL DEPENDS ${manuals})
+else()
+ message(WARNING "pandoc not available and not a dist tarball, man pages not available")
+endif()
-add_custom_target(man ALL DEPENDS ${manuals})