From ade5888b4107f3181abd2a7dd15d8b2b4a997f82 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 19 Aug 2016 15:52:14 +0200 Subject: CMake: Translations: Don't rebuild .mo for line number changes If only the line numbers changed in a file without any of the translatable strings changing, the .po and .mo files were rebuilt, making building simple code changes somewhat annoying. We can work around this by passing --add-location=file to msgcomm when we are creating the temporary .pot file used for building the .mo files. --- CMake/Translations.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'CMake') diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 509e4e378..d7e992b3e 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -67,13 +67,16 @@ 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 ${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 + 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-tmp0 -- cgit v1.2.3 From 0eaa491c63d0583812a795f872be71ea54e7f01d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 19 Aug 2016 16:31:55 +0200 Subject: CMake: Translations: Pass --previous to msgmerge When updating our .po files, pass --previous to msgmerge to make it easier for translators to translate fuzzy strings. Thanks: Guillem Jover for the suggestion. --- CMake/Translations.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMake') diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index d7e992b3e..c2d3901fd 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -149,7 +149,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}) -- cgit v1.2.3 From 35d74be55fccad485b105e97110bb1b153e0de74 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 19 Aug 2016 18:21:04 +0200 Subject: CMake: Install config and logging directories These directories are essential for apt to work, so we should install them in the upstream build system and not just in the debian packaging... --- CMake/Misc.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'CMake') 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() -- cgit v1.2.3 From c43a7ed46ce5fb88235c954dc210dd02a5e6e377 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 20 Aug 2016 01:15:27 +0200 Subject: CMake: Translations: Build byproduct before output This can lead to an inconsistent state otherwise, with the output being updated and the byproduct not; for example, when the build was manually interrupted. --- CMake/Translations.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'CMake') diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index c2d3901fd..3562172bd 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -72,14 +72,14 @@ function(apt_add_translation_domain) # 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 - ${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 --add-location=file ${sh_pot} ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot --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 COMMAND cmake -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp0 ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp -- cgit v1.2.3 From ee60e00ccc68104cae56a854ffd2fb65a959ce57 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 20 Aug 2016 14:41:33 +0200 Subject: CMake: Fix uninitialized variables This fixes some actual bugs for PROJECT and BZIP2_INCLUDE_DIR. Gbp-Dch: ignore --- CMake/Documentation.cmake | 4 +++- CMake/Translations.cmake | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'CMake') diff --git a/CMake/Documentation.cmake b/CMake/Documentation.cmake index 9e7135ea4..f679b82e1 100644 --- a/CMake/Documentation.cmake +++ b/CMake/Documentation.cmake @@ -75,7 +75,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} @@ -124,6 +124,7 @@ function(xsltproc_one) set(manpage_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.${section}") endif() set(manpage_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl") + set(manpage_params) install(FILES ${manpage_output} DESTINATION ${CMAKE_INSTALL_MANDIR}/${language}/man${section} @@ -221,6 +222,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/Translations.cmake b/CMake/Translations.cmake index 3562172bd..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 -- cgit v1.2.3 From 3fbd67460e1c4c38a79d00f09bf3113a39abbeca Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 20 Aug 2016 03:22:24 +0200 Subject: CMake: Add Large File Support This module should cover all sorts of large file supports, as long as they either support the getconf LFS_CFLAGS command; or the _FILE_OFFSET_BITS=64 or _LARGE_FILES macros. Closes: #834767 --- CMake/FindLFS.cmake | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 CMake/FindLFS.cmake (limited to 'CMake') diff --git a/CMake/FindLFS.cmake b/CMake/FindLFS.cmake new file mode 100644 index 000000000..e1fcf964c --- /dev/null +++ b/CMake/FindLFS.cmake @@ -0,0 +1,148 @@ +# CMake support for large files +# +# Copyright (C) 2016 Julian Andres Klode . +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation files +# (the "Software"), to deal in the Software without restriction, +# including without limitation the rights to use, copy, modify, merge, +# publish, distribute, sublicense, and/or sell copies of the Software, +# and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# This defines the following variables +# +# LFS_DEFINITIONS - List of definitions to pass to add_definitions() +# LFS_COMPILE_OPTIONS - List of definitions to pass to add_compile_options() +# LFS_LIBRARIES - List of libraries and linker flags +# LFS_FOUND - If there is Large files support +# + +include(CheckCXXSourceCompiles) +include(FindPackageHandleStandardArgs) + +# Test program to check for LFS. Requires that off_t has at least 8 byte large +set(_lfs_test_source + " + #include + typedef char my_static_assert[sizeof(off_t) >= 8 ? 1 : -1]; + int main(void) { return 0; } + " +) + +# Check if the given options are needed +# +# This appends to the variables _lfs_cppflags, _lfs_cflags, and _lfs_ldflags, +# it also sets LFS_FOUND to 1 if it works. +function(_lfs_check_compiler_option var options definitions libraries) + set(CMAKE_REQUIRED_QUIET 1) + set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${options}) + set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${definitions}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_DEFINITIONS} ${libraries}) + + message(STATUS "Looking for LFS support using ${options} ${definitions} ${libraries}") + check_cxx_source_compiles("${_lfs_test_source}" ${var}) + + if(${var}) + message(STATUS "Looking for LFS support using ${options} ${definitions} ${libraries} - found") + set(_lfs_cppflags ${_lfs_cppflags} ${definitions} PARENT_SCOPE) + set(_lfs_cflags ${_lfs_cflags} ${options} PARENT_SCOPE) + set(_lfs_ldflags ${_lfs_ldflags} ${libraries} PARENT_SCOPE) + set(LFS_FOUND TRUE PARENT_SCOPE) + else() + message(STATUS "Looking for LFS support using ${options} ${definitions} ${libraries} - not found") + endif() +endfunction() + +# Check for the availability of LFS. +# The cases handled are: +# +# * Native LFS +# * Output of getconf LFS_CFLAGS; getconf LFS_LIBS; getconf LFS_LDFLAGS +# * Preprocessor flag -D_FILE_OFFSET_BITS=64 +# * Preprocessor flag -D_LARGE_FILES +# +function(_lfs_check) + set(_lfs_cflags) + set(_lfs_cppflags) + set(_lfs_ldflags) + set(_lfs_libs) + set(CMAKE_REQUIRED_QUIET 1) + message(STATUS "Looking for native LFS support") + check_cxx_source_compiles("${_lfs_test_source}" lfs_native) + if (lfs_native) + message(STATUS "Looking for native LFS support - found") + set(LFS_FOUND TRUE) + else() + message(STATUS "Looking for native LFS support - not found") + endif() + + if (NOT LFS_FOUND) + # Check using getconf. If getconf fails, don't worry, the check in + # _lfs_check_compiler_option will fail as well. + execute_process(COMMAND getconf LFS_CFLAGS + OUTPUT_VARIABLE _lfs_cflags_raw + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + execute_process(COMMAND getconf LFS_LIBS + OUTPUT_VARIABLE _lfs_libs_tmp + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + execute_process(COMMAND getconf LFS_LDFLAGS + OUTPUT_VARIABLE _lfs_ldflags_tmp + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + + separate_arguments(_lfs_cflags_raw) + separate_arguments(_lfs_ldflags_tmp) + separate_arguments(_lfs_libs_tmp) + + # Move -D flags to the place they are supposed to be + foreach(flag ${_lfs_cflags_raw}) + if (flag MATCHES "-D.*") + list(APPEND _lfs_cppflags_tmp ${flag}) + else() + list(APPEND _lfs_cflags_tmp ${flag}) + endif() + endforeach() + + # Check if the flags we received (if any) produce working LFS support + _lfs_check_compiler_option(lfs_getconf_works + "${_lfs_cflags_tmp}" + "${_lfs_cppflags_tmp}" + "${_lfs_libs_tmp};${_lfs_ldflags_tmp}") + endif() + + if(NOT LFS_FOUND) # IRIX stuff + _lfs_check_compiler_option(lfs_need_n32 "-n32" "" "") + endif() + if(NOT LFS_FOUND) # Linux and friends + _lfs_check_compiler_option(lfs_need_file_offset_bits "" "-D_FILE_OFFSET_BITS=64" "") + endif() + if(NOT LFS_FOUND) # AIX + _lfs_check_compiler_option(lfs_need_large_files "" "-D_LARGE_FILES=1" "") + endif() + + set(LFS_DEFINITIONS ${_lfs_cppflags} CACHE STRING "Extra definitions for large file support") + set(LFS_COMPILE_OPTIONS ${_lfs_cflags} CACHE STRING "Extra definitions for large file support") + set(LFS_LIBRARIES ${_lfs_libs} ${_lfs_ldflags} CACHE STRING "Extra definitions for large file support") + set(LFS_FOUND ${LFS_FOUND} CACHE INTERNAL "Found LFS") +endfunction() + +if (NOT LFS_FOUND) + _lfs_check() +endif() + +find_package_handle_standard_args(LFS "Could not find LFS. Set LFS_DEFINITIONS, LFS_COMPILE_OPTIONS, LFS_LIBRARIES." LFS_FOUND) -- cgit v1.2.3 From 9fb81c6e54a2fe05c0ad0b877fd32f30358e3877 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 21 Aug 2016 20:37:14 +0200 Subject: CMake: Discover docbook stylesheet in other locations Distributions seem to install this stuff all over the place, so let's add a common list of paths we know about. --- CMake/Documentation.cmake | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'CMake') diff --git a/CMake/Documentation.cmake b/CMake/Documentation.cmake index f679b82e1..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 @@ -123,7 +151,7 @@ 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} @@ -137,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) @@ -150,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}) -- cgit v1.2.3 From b10ec8cc7b6b9d181cccacee6b4c1c4c5bdbd510 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 22 Aug 2016 22:54:07 +0200 Subject: CMake: Handle endian.h locations on other platforms Gbp-Dch: ignore --- CMake/config.h.in | 6 ++++++ CMake/endian.h.in | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 CMake/endian.h.in (limited to 'CMake') diff --git a/CMake/config.h.in b/CMake/config.h.in index e929646fa..f32f15b8a 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 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 + +#ifdef HAVE_MACHINE_ENDIAN_H +#include +#endif +#ifdef HAVE_SYS_ENDIAN_H +#include +#include +#endif -- cgit v1.2.3 From c799c3efe43d7fde53ea4a3c5f976375607a2805 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Aug 2016 14:13:24 +0200 Subject: CMake: Add FindLZ4 and FindLZMA This makes things work with /usr/local on FreeBSD. Gbp-Dch: ignore --- CMake/FindLZ4.cmake | 25 +++++++++++++++++++++++++ CMake/FindLZMA.cmake | 25 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 CMake/FindLZ4.cmake create mode 100644 CMake/FindLZMA.cmake (limited to 'CMake') 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) -- cgit v1.2.3 From 24ad9b325f2d277864e3a75931137b93dd75cd03 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Aug 2016 12:48:25 +0200 Subject: CMake: Handle Berkeley DB on FreeBSD The BSD systems still ship their own db.h with a historical BSD implementation, which is preferred by CMake, as it searches its default path first. We thus have to disable the DEFAULT_PATH for the search, unfortunately. We also need to pass the correct include directory to the target. Furthermore, on FreeBSD the library is called db-, so let's add db-5 to the list of allowed names. Gbp-Dch: ignore --- CMake/FindBerkeleyDB.cmake | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'CMake') 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) -- cgit v1.2.3 From 8757a0fdeee00ea6a7cc717188a0e129ad8a553c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Aug 2016 19:41:58 +0200 Subject: Make directory paths configurable This allows other vendors to use different paths, or to build your own APT in /opt for testing. Note that this uses + 1 in some places, as the paths we receive are absolute, but we need to strip of the initial /. --- CMake/config.h.in | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'CMake') diff --git a/CMake/config.h.in b/CMake/config.h.in index f32f15b8a..c23254929 100644 --- a/CMake/config.h.in +++ b/CMake/config.h.in @@ -55,6 +55,15 @@ /* 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}" + #define APT_8_CLEANER_HEADERS #define APT_9_CLEANER_HEADERS #define APT_10_CLEANER_HEADERS -- cgit v1.2.3 From 6f1f3c9afdb6ade6a7be110b90c8fc9e603254cf Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 25 Aug 2016 16:25:00 +0200 Subject: Make root group configurable via ROOT_GROUP This is needed on BSD where root's default group is wheel, not root. --- CMake/config.h.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'CMake') diff --git a/CMake/config.h.in b/CMake/config.h.in index c23254929..6f39e2f58 100644 --- a/CMake/config.h.in +++ b/CMake/config.h.in @@ -64,6 +64,9 @@ #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 -- cgit v1.2.3 From 01d207a5076b6fc37a064645b13f2c6550f58b94 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 26 Aug 2016 17:55:28 +0200 Subject: CMake: Add missing iconv dependency FreeBSD has two iconv systems: It ships an iconv.h itself, and symbols for that in the libc. But there's also the port of GNU libiconv, which unfortunately for us, Doxygen depends on. This changes things to prefer a separate libiconv library over the system one; that is, the port on FreeBSD. Gbp-Dch: ignore --- CMake/FindIconv.cmake | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 CMake/FindIconv.cmake (limited to 'CMake') 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) -- cgit v1.2.3