diff options
Diffstat (limited to 'CMake')
-rw-r--r-- | CMake/Documentation.cmake | 38 | ||||
-rw-r--r-- | CMake/FindBerkeleyDB.cmake | 17 | ||||
-rw-r--r-- | CMake/FindIconv.cmake | 20 | ||||
-rw-r--r-- | CMake/FindLZ4.cmake | 25 | ||||
-rw-r--r-- | CMake/FindLZMA.cmake | 25 | ||||
-rw-r--r-- | CMake/Misc.cmake | 13 | ||||
-rw-r--r-- | CMake/Translations.cmake | 14 | ||||
-rw-r--r-- | CMake/config.h.in | 18 | ||||
-rw-r--r-- | CMake/endian.h.in | 9 |
9 files changed, 167 insertions, 12 deletions
diff --git a/CMake/Documentation.cmake b/CMake/Documentation.cmake index 9e7135ea4..f3bbfdc6b 100644 --- a/CMake/Documentation.cmake +++ b/CMake/Documentation.cmake @@ -24,6 +24,34 @@ # SOFTWARE. +find_path(DOCBOOK_XSL manpages/docbook.xsl + # Debian + /usr/share/xml/docbook/stylesheet/docbook-xsl + /usr/share/xml/docbook/stylesheet/nwalsh + # OpenSUSE + /usr/share/xml/docbook/stylesheet/nwalsh/current + # Arch + /usr/share/xml/docbook/xsl-stylesheets + # Fedora + /usr/share/sgml/docbook/xsl-stylesheets + # Fink + ${CMAKE_INSTALL_PREFIX}/share/xml/xsl/docbook-xsl + # FreeBSD + ${CMAKE_INSTALL_PREFIX}/share/xsl/docbook/ + NO_DEFAULT_PATH) + +if(NOT DOCBOOK_XSL) + message(FATAL_ERROR "Could not find docbook xsl") +endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docbook-text-style.xsl.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/docbook-text-style.xsl) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docbook-html-style.xsl.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/docbook-html-style.xsl) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/manpage-style.xsl) + + # Split up a string of the form DOCUMENT[.DOCUMENT][.LANGUAGE][.SECTION].EXTENSION # # There might be up to two parts in the document name. The language must be @@ -75,7 +103,7 @@ function(po4a_one stamp_out out full_document language deps) OUTPUT ${stamp} COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${language} COMMAND po4a --previous --no-backups - --package-name='${PROJECT}-doc' + --package-name='${PROJECT_NAME}-doc' --package-version='${PACKAGE_VERSION}' --msgid-bugs-address='${PACKAGE_MAIL}' --translate-only ${dest}.${ext} @@ -123,7 +151,8 @@ function(xsltproc_one) else() set(manpage_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.${section}") endif() - set(manpage_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl") + set(manpage_stylesheet "${CMAKE_CURRENT_BINARY_DIR}/manpage-style.xsl") + set(manpage_params) install(FILES ${manpage_output} DESTINATION ${CMAKE_INSTALL_MANDIR}/${language}/man${section} @@ -136,7 +165,7 @@ function(xsltproc_one) set(html_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.html") endif() set(html_params --stringparam base.dir ${html_output}) - set(html_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/docbook-html-style.xsl") + set(html_stylesheet "${CMAKE_CURRENT_BINARY_DIR}/docbook-html-style.xsl") install(DIRECTORY ${html_output} DESTINATION ${DOC_INSTALL} OPTIONAL) @@ -149,7 +178,7 @@ function(xsltproc_one) set(text_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.text") endif() set(text_params --stringparam base.dir ${text_output}) - set(text_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/docbook-text-style.xsl") + set(text_stylesheet "${CMAKE_CURRENT_BINARY_DIR}/docbook-text-style.xsl") file(RELATIVE_PATH text_output_relative ${CMAKE_CURRENT_BINARY_DIR} ${text_output}) @@ -221,6 +250,7 @@ endfunction() function(add_docbook target) set(generated "") set(options HTML TEXT MANPAGE ALL) + set(oneValueArgs) set(multiValueArgs INSTALL DOCUMENTS LINGUAS DEPENDS) cmake_parse_arguments(DOC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) diff --git a/CMake/FindBerkeleyDB.cmake b/CMake/FindBerkeleyDB.cmake index 44cfd3ddb..34bc3b0d1 100644 --- a/CMake/FindBerkeleyDB.cmake +++ b/CMake/FindBerkeleyDB.cmake @@ -33,14 +33,25 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# We need NO_DEFAULT_PATH here, otherwise CMake helpfully picks up the wrong +# db.h on BSD systems instead of the Berkeley DB one. find_path(BERKELEY_DB_INCLUDE_DIRS db.h - /usr/include/db5 + ${CMAKE_INSTALL_FULL_INCLUDEDIR}/db5 /usr/local/include/db5 - /usr/include/db4 + /usr/include/db5 + + ${CMAKE_INSTALL_FULL_INCLUDEDIR}/db4 /usr/local/include/db4 + /usr/include/db4 + + ${CMAKE_INSTALL_FULL_INCLUDEDIR} + /usr/local/include + /usr/include + + NO_DEFAULT_PATH ) -find_library(BERKELEY_DB_LIBRARIES NAMES db ) +find_library(BERKELEY_DB_LIBRARIES NAMES db db-5) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIRS BERKELEY_DB_LIBRARIES) diff --git a/CMake/FindIconv.cmake b/CMake/FindIconv.cmake new file mode 100644 index 000000000..67046d95d --- /dev/null +++ b/CMake/FindIconv.cmake @@ -0,0 +1,20 @@ +find_path(ICONV_INCLUDE_DIR NAMES iconv.h) + +find_library(ICONV_LIBRARY NAMES iconv) +if (ICONV_LIBRARY) + set(ICONV_SYMBOL_FOUND "${ICONV_LIBRARY}") +else() + check_function_exists(iconv_open ICONV_SYMBOL_FOUND) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Iconv DEFAULT_MESSAGE ICONV_INCLUDE_DIR ICONV_SYMBOL_FOUND) + +if(ICONV_LIBRARY) + set(ICONV_LIBRARIES "${ICONV_LIBRARY}") +else() + set(ICONV_LIBRARIES) +endif() +set(ICONV_INCLUDE_DIRS "${ICONV_INCLUDE_DIR}") + +mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR) diff --git a/CMake/FindLZ4.cmake b/CMake/FindLZ4.cmake new file mode 100644 index 000000000..597f520a8 --- /dev/null +++ b/CMake/FindLZ4.cmake @@ -0,0 +1,25 @@ +# - Try to find LZ4 +# Once done, this will define +# +# LZ4_FOUND - system has LZ4 +# LZ4_INCLUDE_DIRS - the LZ4 include directories +# LZ4_LIBRARIES - the LZ4 library +find_package(PkgConfig) + +pkg_check_modules(LZ4_PKGCONF liblz4) + +find_path(LZ4_INCLUDE_DIRS + NAMES lz4frame.h + PATHS ${LZ4_PKGCONF_INCLUDE_DIRS} +) + + +find_library(LZ4_LIBRARIES + NAMES lz4 + PATHS ${LZ4_PKGCONF_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LZ4 DEFAULT_MSG LZ4_INCLUDE_DIRS LZ4_LIBRARIES) + +mark_as_advanced(LZ4_INCLUDE_DIRS LZ4_LIBRARIES) diff --git a/CMake/FindLZMA.cmake b/CMake/FindLZMA.cmake new file mode 100644 index 000000000..6abc4fa77 --- /dev/null +++ b/CMake/FindLZMA.cmake @@ -0,0 +1,25 @@ +# - Try to find LZMA +# Once done, this will define +# +# LZMA_FOUND - system has LZMA +# LZMA_INCLUDE_DIRS - the LZMA include directories +# LZMA_LIBRARIES - the LZMA library +find_package(PkgConfig) + +pkg_check_modules(LZMA_PKGCONF liblzma) + +find_path(LZMA_INCLUDE_DIRS + NAMES lzma.h + PATHS ${LZMA_PKGCONF_INCLUDE_DIRS} +) + + +find_library(LZMA_LIBRARIES + NAMES lzma + PATHS ${LZMA_PKGCONF_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LZMA DEFAULT_MSG LZMA_INCLUDE_DIRS LZMA_LIBRARIES) + +mark_as_advanced(LZMA_INCLUDE_DIRS LZMA_LIBRARIES) diff --git a/CMake/Misc.cmake b/CMake/Misc.cmake index 68ab22758..82cb4da37 100644 --- a/CMake/Misc.cmake +++ b/CMake/Misc.cmake @@ -86,3 +86,16 @@ function(path_join out path1 path2) set(${out} "${path1}/${path2}" PARENT_SCOPE) endif() endfunction() + +# install_empty_directories(path ...) +# +# Creates empty directories in the install destination dir. Paths may be +# absolute or relative; in the latter case, the value of CMAKE_INSTALL_PREFIX +# is prepended. +function(install_empty_directories) + foreach(path ${ARGN}) + path_join(full_path "${CMAKE_INSTALL_PREFIX}" "${path}") + INSTALL(CODE "MESSAGE(STATUS \"Creating directory: \$ENV{DESTDIR}${full_path}\")" + CODE "FILE(MAKE_DIRECTORY \$ENV{DESTDIR}${full_path})") + endforeach() +endfunction() diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 509e4e378..79f2633a7 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -11,6 +11,7 @@ function(apt_add_translation_domain) set(abs_files "") set(scripts "") set(abs_scripts "") + set(mofiles) set(targets ${NLS_TARGETS}) set(domain ${NLS_DOMAIN}) set(xgettext_params @@ -67,16 +68,19 @@ function(apt_add_translation_domain) # build a ${domain.pot}-tmp as a byproduct. The msgfmt command than depend # on the byproduct while their target depends on the output, so that msgfmt # does not have to be rerun if nothing in the template changed. + # + # Make sure the .pot-tmp has no line numbers, to avoid useless rebuilding + # of .mo files. add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp - COMMAND msgcomm --more-than=0 --sort-by-file + COMMAND msgcomm --more-than=0 --omit-header --sort-by-file --add-location=file ${sh_pot} ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot - --output=${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot - COMMAND msgcomm --more-than=0 --omit-header --sort-by-file + --output=${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp0 + COMMAND msgcomm --more-than=0 --sort-by-file ${sh_pot} ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot - --output=${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp0 + --output=${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot COMMAND cmake -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp0 ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp @@ -146,7 +150,7 @@ function(apt_add_update_po) continue() endif() add_custom_target(update-po-${langcode} - COMMAND msgmerge -q --update --backup=none ${translation} ${output} + COMMAND msgmerge -q --previous --update --backup=none ${translation} ${output} DEPENDS nls-${master_name} ) add_dependencies(update-po update-po-${langcode}) diff --git a/CMake/config.h.in b/CMake/config.h.in index e929646fa..6f39e2f58 100644 --- a/CMake/config.h.in +++ b/CMake/config.h.in @@ -25,6 +25,12 @@ /* Define if we have sys/mount.h */ #cmakedefine HAVE_MOUNT_H +/* Define if we have sys/endian.h */ +#cmakedefine HAVE_SYS_ENDIAN_H + +/* Define if we have machine/endian.h */ +#cmakedefine HAVE_MACHINE_ENDIAN_H + /* Define if we have enabled pthread support */ #cmakedefine HAVE_PTHREAD @@ -49,6 +55,18 @@ /* The mail address to reach upstream */ #define PACKAGE_MAIL "${PACKAGE_MAIL}" +/* Various directories */ +#cmakedefine CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_FULL_BINDIR}" +#cmakedefine STATE_DIR "${STATE_DIR}" +#cmakedefine CACHE_DIR "${CACHE_DIR}" +#cmakedefine LOG_DIR "${LOG_DIR}" +#cmakedefine CONF_DIR "${CONF_DIR}" +#cmakedefine LIBEXEC_DIR "${LIBEXEC_DIR}" +#cmakedefine BIN_DIR "${BIN_DIR}" + +/* Group of the root user */ +#cmakedefine ROOT_GROUP "${ROOT_GROUP}" + #define APT_8_CLEANER_HEADERS #define APT_9_CLEANER_HEADERS #define APT_10_CLEANER_HEADERS diff --git a/CMake/endian.h.in b/CMake/endian.h.in new file mode 100644 index 000000000..1d9198c24 --- /dev/null +++ b/CMake/endian.h.in @@ -0,0 +1,9 @@ +#include <config.h> + +#ifdef HAVE_MACHINE_ENDIAN_H +#include <machine/endian.h> +#endif +#ifdef HAVE_SYS_ENDIAN_H +#include <sys/types.h> +#include <sys/endian.h> +#endif |