gnucash-docs maint: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Wed Sep 11 10:50:39 EDT 2019
Updated via https://github.com/Gnucash/gnucash-docs/commit/1527cb2f (commit)
via https://github.com/Gnucash/gnucash-docs/commit/585d6071 (commit)
from https://github.com/Gnucash/gnucash-docs/commit/5777d258 (commit)
commit 1527cb2f639d16a8082482835b8fbe6d73421ec5
Author: Geert Janssens <geert at kobaltwit.be>
Date: Wed Sep 11 16:50:32 2019 +0200
Autotools - add svg files to dist. They are used for pdf generation.
diff --git a/xmldocs.make b/xmldocs.make
index 96bdff2..059a698 100644
--- a/xmldocs.make
+++ b/xmldocs.make
@@ -52,6 +52,7 @@ xml_files = $(entities) $(docname).xml $(top_srcdir)/docbook/gnc-docbookx.dtd
gnomehelp_DATA = $(xml_files)
gnomehelpfiguresdir = $(gnomehelpdir)/$(figdir)
gnomehelpfigures_DATA = $(shell ls ${srcdir}/${figdir}/*.png)
+gnomehelpfigures_DATA += $(shell ls ${srcdir}/${figdir}/*.svg)
uninstall-hook:
rmdir --ignore-fail-on-non-empty "$(DESTDIR)$(gnomehelpfiguresdir)"
commit 585d6071bce98073f7ef13798037794bc8eb4b86
Author: Geert Janssens <geert at kobaltwit.be>
Date: Wed Sep 11 16:45:50 2019 +0200
CMake - revisit dist and distcheck
- as we had with code add an option AUTOTOOLS_IN_DIST to enable or disable
addition of autotools files in the dist tarball
- dist target may run autogen.sh to generate the autotools files if they don't
exist yet. This is only possible when working from a git checkout dir as
autogen.sh is not distributed. If generating the dist target from a
dist tarball, the autotools files are assumed to be present already.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index de17a57..f75ba4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,6 +55,10 @@ else()
endif()
option (WITH_MOBI "Enable build rules for Mobipocket document format" OFF)
+# If AUTOTOOLS_IN_DIST is OFF, then 'dist' wont run autogen.sh, and 'distcheck'
+# won't run the autotools distcheck. Note that various Makefile.am files are still
+# included in the dist when this is OFF. I'll fix that at some point.
+option (AUTOTOOLS_IN_DIST "Add autotools support to distribution tarballs." ON)
# ############################################################
# Following parameters can equally be set using -D switches on the CMake command line.
# Set font dirs and font for Russian pdf documents
@@ -90,6 +94,20 @@ if(NOT XMLLINT)
message(SEND_ERROR "Can't find xmllint, perhaps you should install the xsltproc or libxslt package ?")
endif(NOT XMLLINT)
+# Find a proper bash executable, only used in case of distcheck with autotools
+set(GNC_SHELL $ENV{GNC_SHELL})
+if (GNC_SHELL) # Replacing this with if ($ENV{GNC_SHELL}) doesn't work.
+ # Allow shell override by setting the GNC_SHELL environment variable
+ set(SHELL ${GNC_SHELL})
+else()
+ find_package(UnixCommands)
+ if (BASH)
+ set(SHELL ${BASH})
+ else()
+ message(SEND_ERROR "Can't find a suitable bash executable. Please set GNC_SHELL.")
+ endif()
+endif()
+
# Check for optional fop
if(WITH_PDF)
find_program(FOP fop)
@@ -164,27 +182,40 @@ endif()
add_subdirectory (guide)
add_subdirectory (help)
-set(autotoolsfiles
- configure.ac
- configure
- config.guess
- config.sub
- COPYING
- INSTALL
- Makefile.am
- Makefile.in
- aclocal.m4
- gnucash-docs.spec.in
- install-sh
- ltmain.sh
- missing
- chm.make
- epub.make
- mobi.make
- omf.make
- pdf.make
- xmldocs.make)
-add_to_dist(${autotoolsfiles})
+if(AUTOTOOLS_IN_DIST)
+ set(autotoolsfiles
+ configure.ac
+ configure
+ config.guess
+ config.sub
+ COPYING
+ INSTALL
+ Makefile.am
+ aclocal.m4
+ gnucash-docs.spec.in
+ install-sh
+ ltmain.sh
+ missing
+ chm.make
+ epub.make
+ mobi.make
+ omf.make
+ pdf.make
+ xmldocs.make)
+
+ # If autogen.sh is not in the source tree, we assume the source is extracted
+ # from a dist tarball. In that case the Makefile.in files are already present
+ # and we can include the directly instead of generating them from autogen.sh
+ find_file(AUTOGEN autogen.sh
+ HINTS "${CMAKE_SOURCE_DIR}"
+ NO_DEFAULT_PATH)
+ if(NOT AUTOGEN)
+ list(APPEND autotoolsfiles Makefile.in)
+ message(STATUS "autogen.sh not in source tree. Assuming Makefile.in files are present instead")
+ endif()
+
+ add_to_dist(${autotoolsfiles})
+endif()
file(GLOB_RECURSE extrafiles
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
@@ -214,6 +245,8 @@ add_custom_command(OUTPUT ${DIST_FILE}.gz ${DIST_FILE}.bz2
-D GNUCASH_SOURCE_DIR=${CMAKE_SOURCE_DIR}
-D BUILD_SOURCE_DIR=${CMAKE_BINARY_DIR}
"-Ddist_files=\"${dist_files}\""
+ -D AUTOGEN=${AUTOGEN}
+ -D SHELL=${SHELL}
-P ${CMAKE_SOURCE_DIR}/cmake/MakeDist.cmake
DEPENDS
@@ -226,6 +259,9 @@ add_custom_target(distcheck DEPENDS dist
COMMAND ${CMAKE_COMMAND}
-D CMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/cmake
-D PACKAGE_PREFIX=${PACKAGE_PREFIX}
+ -D GNUCASH_SOURCE_DIR=${CMAKE_SOURCE_DIR}
+ -D AUTOTOOLS_IN_DIST=${AUTOTOOLS_IN_DIST}
+ -D SHELL=${SHELL}
-P ${CMAKE_SOURCE_DIR}/cmake/MakeDistCheck.cmake
)
diff --git a/cmake/AddGncDocTargets.cmake b/cmake/AddGncDocTargets.cmake
index ae054f8..140b933 100644
--- a/cmake/AddGncDocTargets.cmake
+++ b/cmake/AddGncDocTargets.cmake
@@ -38,10 +38,15 @@ function (add_gnc_doc_targets docname entities)
endif()
endif()
- set(autotoolsfiles
- Makefile.am
- Makefile.in
- ${docname}-${lang}.omf)
+ if(AUTOTOOLS_IN_DIST)
+ set(autotoolsfiles
+ Makefile.am
+ ${docname}-${lang}.omf)
+
+ if(NOT AUTOGEN)
+ list(APPEND autotoolsfiles Makefile.in)
+ endif()
+ endif()
file(GLOB_RECURSE figures_dist
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/cmake/MakeDist.cmake b/cmake/MakeDist.cmake
index 7ae269e..92a7a1a 100644
--- a/cmake/MakeDist.cmake
+++ b/cmake/MakeDist.cmake
@@ -10,6 +10,31 @@
include(${CMAKE_MODULE_PATH}/DistCommon.cmake)
+function(find_automake AUTOMAKE_VAR ACLOCAL_VAR AUTOMAKE_VERSION_VAR)
+ find_program(AUTOMAKE automake)
+ execute_process(
+ COMMAND ${AUTOMAKE} --version
+ RESULT_VARIABLE AUTOMAKE_RESULT
+ OUTPUT_VARIABLE AUTOMAKE_OUTPUT
+ ERROR_VARIABLE AUTOMAKE_ERROR
+ )
+
+ set(NEED_OVERRIDE FALSE)
+ if(AUTOMAKE)
+ string(REGEX REPLACE ".*automake \\(GNU automake\\) ([0-9]\\.[0-9]+).*" "\\1" AUTOMAKE_VERSION "${AUTOMAKE_OUTPUT}")
+ find_program(ACLOCAL aclocal)
+ if(NOT ACLOCAL)
+ message(FATAL_ERROR "Found ok version of automake, but can't find aclocal")
+ endif()
+ else()
+ message(FATAL_ERROR "Can't find 'automake' or 'automake-1.11'")
+ message(" You can set AUTOTOOLS_IN_DIST=OFF to exclude autotools support.")
+ endif()
+ set(${AUTOMAKE_VAR} ${AUTOMAKE} PARENT_SCOPE)
+ set(${ACLOCAL_VAR} ${ACLOCAL} PARENT_SCOPE)
+ set(${AUTOMAKE_VERSION_VAR} ${AUTOMAKE_VERSION} PARENT_SCOPE)
+endfunction()
+
function(make_dist PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR)
# -- Remove any existing packaging directory.
@@ -31,6 +56,41 @@ function(make_dist PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR)
cmake_policy(SET CMP0012 NEW)
+ # When making a dist tarball including autotools files
+ # the Makefile.in files may have to be generated by running autogen.sh
+ # The toplevel cmake configuration determines whether this is required or not
+ if(AUTOGEN)
+ find_automake(AUTOMAKE ACLOCAL AUTOMAKE_VERSION)
+
+ # -- Run autogen.sh to cause Makefile.in files to be created.
+ file(COPY ${GNUCASH_SOURCE_DIR}/autogen.sh DESTINATION ${PACKAGE_PREFIX})
+ execute_process(
+ COMMAND ${SHELL} -c ./autogen.sh
+ WORKING_DIRECTORY ${PACKAGE_PREFIX}
+ RESULT_VARIABLE AUTOGEN_RESULT
+ OUTPUT_VARIABLE AUTOGEN_OUTPUT
+ )
+ if(NOT ${AUTOGEN_RESULT} STREQUAL "0")
+ message(FATAL_ERROR "autogen.sh step failed: ${AUTOGEN_RESULT}")
+ endif()
+
+ # -- Remove autogen files as they are not distributed.
+ file(REMOVE ${PACKAGE_PREFIX}/autogen.sh)
+ file(REMOVE_RECURSE ${PACKAGE_PREFIX}/autom4te.cache)
+
+ # -- Autogen.sh creates some files as symbolic links that we turn into real files here.
+ if(NOT WIN32) # No symbolic links on Windows
+ set(LINKS config.guess config.sub COPYING INSTALL install-sh ltmain.sh missing)
+ foreach(link ${LINKS})
+ get_filename_component(realpath ${PACKAGE_PREFIX}/${link} REALPATH)
+ file(REMOVE ${PACKAGE_PREFIX}/${link})
+ file(COPY ${realpath} DESTINATION ${PACKAGE_PREFIX})
+ endforeach(link)
+ endif()
+
+ endif()
+
+
# -- Create the tarballs.
execute_process_and_check_result(
diff --git a/cmake/MakeDistCheck.cmake b/cmake/MakeDistCheck.cmake
index c634134..39bc565 100644
--- a/cmake/MakeDistCheck.cmake
+++ b/cmake/MakeDistCheck.cmake
@@ -42,6 +42,7 @@ function(run_dist_check PACKAGE_PREFIX EXT)
execute_process_and_check_result(
COMMAND ${CMAKE_COMMAND} -G Ninja
-D CMAKE_INSTALL_PREFIX=../${INSTALL_DIR}
+ -D AUTOTOOLS_IN_DIST=${AUTOTOOLS_IN_DIST}
../${PACKAGE_PREFIX}
WORKING_DIRECTORY ${BUILD_DIR}
ERROR_MSG "CMake configure command failed."
@@ -79,4 +80,56 @@ function(run_dist_check PACKAGE_PREFIX EXT)
endfunction()
+function(run_autotools_dist_check PACKAGE_PREFIX)
+ # We assume that the RUN_DIST_CHECK() function has been run so that we can
+ # use the untarred distribution created by that step.
+ set(BUILD_DIR ${PACKAGE_PREFIX})
+ set(INSTALL_DIR "_cmake_install_autotools")
+ file(REMOVE_RECURSE ${BUILD_DIR}/${INSTALL_DIR})
+ file(MAKE_DIRECTORY ${BUILD_DIR}/${INSTALL_DIR})
+
+ message("Running autotools configure")
+ message("CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
+ execute_process_and_check_result(
+ COMMAND ${CMAKE_COMMAND} -E env ./configure --prefix=${CMAKE_CURRENT_SOURCE_DIR}/${INSTALL_DIR}
+ WORKING_DIRECTORY ${BUILD_DIR}
+ ERROR_MSG "Autotools 'configure' step failed."
+ )
+
+ message("Running autotools make")
+ execute_process_and_check_result(
+ COMMAND ${CMAKE_COMMAND} -E env make -j 4
+ WORKING_DIRECTORY ${BUILD_DIR}
+ ERROR_MSG "Autotools 'make' step failed."
+ )
+
+ message("Running autotools make check")
+ execute_process_and_check_result(
+ COMMAND ${CMAKE_COMMAND} -E env make check
+ WORKING_DIRECTORY ${BUILD_DIR}
+ ERROR_MSG "Autotools 'make check' step failed."
+ )
+
+ message("Running autotools make install")
+ execute_process_and_check_result(
+ COMMAND ${CMAKE_COMMAND} -E env make install
+ WORKING_DIRECTORY ${BUILD_DIR}
+ ERROR_MSG "Autotools 'make install' step failed."
+ )
+
+ message("Running autotools make uninstall")
+ execute_process_and_check_result(
+ COMMAND ${CMAKE_COMMAND} -E env make uninstall
+ WORKING_DIRECTORY ${BUILD_DIR}
+ ERROR_MSG "Autotools 'make uninstall' step failed."
+ )
+
+ message("Autotools distcheck complete.")
+
+endfunction()
+
run_dist_check(${PACKAGE_PREFIX} .gz)
+
+if(AUTOTOOLS_IN_DIST)
+ run_autotools_dist_check(${PACKAGE_PREFIX})
+endif()
diff --git a/guide/CMakeLists.txt b/guide/CMakeLists.txt
index 8b047f7..5d4d4d8 100644
--- a/guide/CMakeLists.txt
+++ b/guide/CMakeLists.txt
@@ -40,7 +40,10 @@ add_subdirectory(ja)
add_subdirectory(pt)
add_subdirectory(ru)
-set(autotoolsfiles
- Makefile.am
- Makefile.in)
+if(AUTOTOOLS_IN_DIST)
+ set(autotoolsfiles Makefile.am)
+ if(NOT AUTOGEN)
+ list(APPEND autotoolsfiles Makefile.in)
+ endif()
+endif()
add_to_dist(CMakeLists.txt ${autotoolsfiles})
diff --git a/help/CMakeLists.txt b/help/CMakeLists.txt
index dc75695..b50cbd8 100644
--- a/help/CMakeLists.txt
+++ b/help/CMakeLists.txt
@@ -38,7 +38,10 @@ add_subdirectory(de)
add_subdirectory(it)
add_subdirectory(pt)
-set(autotoolsfiles
- Makefile.am
- Makefile.in)
+if(AUTOTOOLS_IN_DIST)
+ set(autotoolsfiles Makefile.am)
+ if(NOT AUTOGEN)
+ list(APPEND autotoolsfiles Makefile.in)
+ endif()
+endif()
add_to_dist(CMakeLists.txt ${autotoolsfiles})
Summary of changes:
CMakeLists.txt | 78 ++++++++++++++++++++++++++++++++------------
cmake/AddGncDocTargets.cmake | 13 +++++---
cmake/MakeDist.cmake | 60 ++++++++++++++++++++++++++++++++++
cmake/MakeDistCheck.cmake | 53 ++++++++++++++++++++++++++++++
guide/CMakeLists.txt | 9 +++--
help/CMakeLists.txt | 9 +++--
xmldocs.make | 1 +
7 files changed, 192 insertions(+), 31 deletions(-)
More information about the gnucash-changes
mailing list