From 9ee5154685e24bd588ae792af1e285e06a1f9dfc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 03:50:54 +0200 Subject: vendor/getinfo: Provide command to determine vendor to use Introduce the 'current' command to eventually replace the current symbolic link. The current command does roughly the same as the makefile, the code has just been cleaned up a bit to work better as a shell function. Gbp-Dch: ignore --- vendor/getinfo | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/vendor/getinfo b/vendor/getinfo index 79da83620..4f94d7c42 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -2,7 +2,41 @@ # small helper to extract information form *.ent files BASEDIR="$(readlink -f "$(dirname $0)")" -INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")" + +getcurrent() { + # search for an exact match to use the correct sources.list example + cd $BASEDIR + DISTROS="$(find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2)" + for DISTRO in $DISTROS; do + if dpkg-vendor --is $DISTRO; then + echo $DISTRO + return 0 + fi + done + + # if we haven't found a specific, look for a deriving + # we do ubuntu and debian last as those are the biggest families + # and would therefore potentially 'shadow' smaller families + # (especially debian as it sorts quiet early) + for DISTRO in $DISTROS; do + if [ "$DISTRO" = 'debian' -o "$DISTRO" = 'ubuntu' ]; then continue; fi + if dpkg-vendor --derives-from $DISTRO; then + echo $DISTRO + return 0 + fi + done + + # Do the ubuntu/debian dance we talked about + if dpkg-vendor --derives-from ubuntu; then + echo $DISTRO + return 0 + fi + + echo debian + return 0 +} + +INFO="$(readlink -f "${BASEDIR}/$(getcurrent)/apt-vendor.ent")" VERBATIM="${BASEDIR}/../doc/apt-verbatim.ent" if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then @@ -33,6 +67,10 @@ vendor) verbatim) getfield "$2" "$VERBATIM" ;; + +current) + getcurrent + ;; *) echo >&2 "Unknown data field $1 requested" exit 2 -- cgit v1.2.3 From f7a46d97368044e8a69f5a51067b5a0e12241d42 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 20:16:38 +0200 Subject: vendor/getinfo: Teach it about sourceslist-list-format This makes it easier to write a generic subsitution tool for handling substitutions in apt-key.in and sources.list.in Gbp-Dch: ignore --- vendor/getinfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/getinfo b/vendor/getinfo index 4f94d7c42..504b086af 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -58,7 +58,7 @@ case "$1" in debian-stable-codename|debian-oldstable-codename|debian-testing-codename|ubuntu-codename) getrawfield "$1" "$VERBATIM" ;; -keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) +sourceslist-list-format|keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) exec $0 'vendor' "$@" ;; vendor) -- cgit v1.2.3 From 2b54bc754edb937a5c9bfe6e0e62c2787d760976 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 05:10:36 +0200 Subject: debian/control: Use versioned provides for same-ver library deps This simplifies the design a bit, as we do not need to read the major ABI version number from some file / command. Gbp-Dch: ignore --- debian/control | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 77b62b4ef..daaff0e2d 100644 --- a/debian/control +++ b/debian/control @@ -47,6 +47,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends} Breaks: apt (<< 1.1~exp14), libapt-inst1.5 (<< 0.9.9~), appstream (<< 0.9.0-3~) Recommends: apt (>= ${binary:Version}) Section: libs +Provides: libapt-pkg (= ${binary:Version}) Description: package management runtime library This library provides the common functionality for searching and managing packages as well as information about packages. @@ -69,6 +70,7 @@ Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Section: libs +Provides: libapt-inst (= ${binary:Version}) Description: deb package format runtime library This library provides methods to query and extract information from deb packages. This includes the control data and the package @@ -88,7 +90,7 @@ Architecture: any Multi-Arch: same Priority: optional Pre-Depends: ${misc:Pre-Depends} -Depends: ${libapt-pkg-name} (= ${binary:Version}), ${libapt-inst-name} (= ${binary:Version}), ${misc:Depends}, zlib1g-dev +Depends: libapt-pkg (= ${binary:Version}), libapt-inst (= ${binary:Version}), ${misc:Depends}, zlib1g-dev Section: libdevel Description: development files for APT's libapt-pkg and libapt-inst This package contains the header files and libraries for -- cgit v1.2.3 From cc1b834fe966d40206d148e1f27f0502463ac69f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 19:07:22 +0200 Subject: prepare-release: Also search for libraries in CMake locations With this change, the 'library' command looks for a library libX in the directories: build/bin, */X, X. This allows it to find the library when building with the upcoming CMake backend, which places the libraries in a sub directory of the build tree with the same name as the source tree. For example, if building in 'build/', the apt-pkg library will be available at 'build/apt-pkg/libapt-pkg.so.5.0'. In case there are multiple instances of a library, the newest one will be used. Gbp-Dch: ignore --- prepare-release | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/prepare-release b/prepare-release index 18fd3af94..77d8580d9 100755 --- a/prepare-release +++ b/prepare-release @@ -127,7 +127,14 @@ elif [ "$1" = 'post-build' ]; then elif [ "$1" = 'library' ]; then librarysymbols() { + local libname=$(echo "${1}" | cut -c 4-) local buildlib="build/bin/${1}.so.${2}" + for dir in $libname */$libname; do + local new_buildlib="$dir/${1}.so.${2}" + if [ -r "${new_buildlib}" ] && [ ! -e "$buildlib" -o "$new_buildlib" -nt "$buildlib" ]; then + local buildlib="${new_buildlib}" + fi + done if [ ! -r "$buildlib" ]; then echo "ERROR: The library ${1} has to be built before symbols can be checked!" return -- cgit v1.2.3 From f3de2dbaf657f9040a4da448c57267de0fef7d33 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 21:03:43 +0200 Subject: CMake: Add basic CMake build system Introduce an initial CMake buildsystem. This build system can build a fully working apt system without translation or documentation. The FindBerkelyDB module is from kdelibs, with some small adjustements to also look in db5 directories. Initial work on this CMake build system started in 2009, and was resumed in August 2016. --- CMake/FindBerkeleyDB.cmake | 48 +++++++++++++++++ CMake/Misc.cmake | 65 ++++++++++++++++++++++ CMake/apti18n.h.in | 30 +++++++++++ CMake/config.h.in | 54 +++++++++++++++++++ CMakeLists.txt | 132 +++++++++++++++++++++++++++++++++++++++++++++ README.cmake | 36 +++++++++++++ apt-inst/CMakeLists.txt | 26 +++++++++ apt-pkg/CMakeLists.txt | 46 ++++++++++++++++ apt-private/CMakeLists.txt | 23 ++++++++ cmdline/CMakeLists.txt | 59 ++++++++++++++++++++ dselect/CMakeLists.txt | 4 ++ ftparchive/CMakeLists.txt | 10 ++++ methods/CMakeLists.txt | 35 ++++++++++++ vendor/CMakeLists.txt | 33 ++++++++++++ 14 files changed, 601 insertions(+) create mode 100644 CMake/FindBerkeleyDB.cmake create mode 100644 CMake/Misc.cmake create mode 100644 CMake/apti18n.h.in create mode 100644 CMake/config.h.in create mode 100644 CMakeLists.txt create mode 100644 README.cmake create mode 100644 apt-inst/CMakeLists.txt create mode 100644 apt-pkg/CMakeLists.txt create mode 100644 apt-private/CMakeLists.txt create mode 100644 cmdline/CMakeLists.txt create mode 100644 dselect/CMakeLists.txt create mode 100644 ftparchive/CMakeLists.txt create mode 100644 methods/CMakeLists.txt create mode 100644 vendor/CMakeLists.txt diff --git a/CMake/FindBerkeleyDB.cmake b/CMake/FindBerkeleyDB.cmake new file mode 100644 index 000000000..44cfd3ddb --- /dev/null +++ b/CMake/FindBerkeleyDB.cmake @@ -0,0 +1,48 @@ +# - Try to find Berkeley DB +# Once done this will define +# +# BERKELEY_DB_FOUND - system has Berkeley DB +# BERKELEY_DB_INCLUDE_DIRS - the Berkeley DB include directory +# BERKELEY_DB_LIBRARIES - Link these to use Berkeley DB +# BERKELEY_DB_DEFINITIONS - Compiler switches required for using Berkeley DB + +# Copyright (c) 2006, Alexander Dymo, +# Copyright (c) 2016, Julian Andres Klode +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +find_path(BERKELEY_DB_INCLUDE_DIRS db.h + /usr/include/db5 + /usr/local/include/db5 + /usr/include/db4 + /usr/local/include/db4 +) + +find_library(BERKELEY_DB_LIBRARIES NAMES db ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Berkeley "Could not find Berkeley DB >= 4.1" BERKELEY_DB_INCLUDE_DIRS BERKELEY_DB_LIBRARIES) +# show the BERKELEY_DB_INCLUDE_DIRS and BERKELEY_DB_LIBRARIES variables only in the advanced view +mark_as_advanced(BERKELEY_DB_INCLUDE_DIRS BERKELEY_DB_LIBRARIES) diff --git a/CMake/Misc.cmake b/CMake/Misc.cmake new file mode 100644 index 000000000..584a4da2a --- /dev/null +++ b/CMake/Misc.cmake @@ -0,0 +1,65 @@ +include(CheckCXXCompilerFlag) + +# Flatten our header structure +function(flatify target headers) + foreach(header ${headers}) + get_filename_component(tgt ${header} NAME) + configure_file(${header} ${target}/${tgt} @ONLY) + endforeach(header ${headers}) +endfunction() + + +function(add_optional_compile_options flags) + foreach(flag ${flags}) + check_cxx_compiler_flag(-${flag} have-compiler-flag:-${flag}) + if (have-compiler-flag:-${flag}) + add_compile_options("-${flag}") + endif() + endforeach() +endfunction() + +# Substitute vendor references in a file +function(add_vendor_file) + set(options) + set(oneValueArgs OUTPUT INPUT MODE) + set(multiValueArgs VARIABLES) + cmake_parse_arguments(AVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + message(STATUS "Configuring vendor file ${AVF_OUTPUT}") + + FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/${AVF_INPUT} input) + foreach(variable ${AVF_VARIABLES}) + execute_process(COMMAND ../vendor/getinfo ${variable} OUTPUT_VARIABLE value OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "&${variable};" "${value}" input "${input}") + endforeach() + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${AVF_OUTPUT} "${input}") + + execute_process(COMMAND chmod ${AVF_MODE} ${CMAKE_CURRENT_BINARY_DIR}/${AVF_OUTPUT}) +endfunction() + +# Add symbolic links to a file +function(add_slaves destination master) + set(slaves "") + foreach(slave ${ARGN}) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${slave} + COMMAND ${CMAKE_COMMAND} -E create_symlink ${master} ${CMAKE_CURRENT_BINARY_DIR}/${slave}) + list(APPEND slaves ${CMAKE_CURRENT_BINARY_DIR}/${slave}) + endforeach() + + STRING(REPLACE "/" "-" master "${master}") + add_custom_target(${master}-slaves ALL DEPENDS ${slaves}) + install(FILES ${slaves} DESTINATION ${destination}) +endfunction() + +# Generates a simple version script versioning everything with current SOVERSION +function(add_version_script target) + get_target_property(soversion ${target} SOVERSION) + set(script "${CMAKE_CURRENT_BINARY_DIR}/${target}.versionscript") + string(REPLACE "-" "" name "${target}_${soversion}") + string(TOUPPER "${name}" name) + add_custom_command(OUTPUT "${script}" + COMMAND echo "${name} {global: *; };" > "${script}" + VERBATIM ) + add_custom_target(${target}-versionscript DEPENDS "${script}") + target_link_libraries(${target} PRIVATE -Wl,-version-script="${script}") + add_dependencies(${target} ${target}-versionscript) +endfunction() diff --git a/CMake/apti18n.h.in b/CMake/apti18n.h.in new file mode 100644 index 000000000..9c843b037 --- /dev/null +++ b/CMake/apti18n.h.in @@ -0,0 +1,30 @@ +// -*- mode: cpp; mode: fold -*- +// $Id: apti18n.h.in,v 1.6 2003/01/11 07:18:18 jgg Exp $ +/* Internationalization macros for apt. This header should be included last + in each C file. */ + +// Set by autoconf +#cmakedefine USE_NLS + +#ifdef USE_NLS +// apt will use the gettext implementation of the C library +#include +#include +# ifdef APT_DOMAIN +# define _(x) dgettext(APT_DOMAIN,x) +# define P_(msg,plural,n) dngettext(APT_DOMAIN,msg,plural,n) +# else +# define _(x) gettext(x) +# define P_(msg,plural,n) ngettext(msg,plural,n) +# endif +# define N_(x) x +#else +// apt will not use any gettext +# define setlocale(a, b) +# define textdomain(a) +# define bindtextdomain(a, b) +# define _(x) x +# define P_(msg,plural,n) (n == 1 ? msg : plural) +# define N_(x) x +# define dgettext(d, m) m +#endif diff --git a/CMake/config.h.in b/CMake/config.h.in new file mode 100644 index 000000000..7515fc9a6 --- /dev/null +++ b/CMake/config.h.in @@ -0,0 +1,54 @@ +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#cmakedefine WORDS_BIGENDIAN + +/* Define if we have the timegm() function */ +#cmakedefine HAVE_TIMEGM + +/* Define if we have the zlib library for gzip */ +#cmakedefine HAVE_ZLIB + +/* Define if we have the bz2 library for bzip2 */ +#cmakedefine HAVE_BZ2 + +/* Define if we have the lzma library for lzma/xz */ +#cmakedefine HAVE_LZMA + +/* Define if we have the lz4 library for lz4 */ +#cmakedefine HAVE_LZ4 + +/* These two are used by the statvfs shim for glibc2.0 and bsd */ +/* Define if we have sys/vfs.h */ +#cmakedefine HAVE_VFS_H +#cmakedefine HAVE_STRUCT_STATFS_F_TYPE + +/* Define if we have sys/mount.h */ +#cmakedefine HAVE_MOUNT_H + +/* Define if we have enabled pthread support */ +#cmakedefine HAVE_PTHREAD + +/* Check for getresuid() function and similar ones */ +#cmakedefine HAVE_GETRESUID +#cmakedefine HAVE_GETRESGID +#cmakedefine HAVE_SETRESUID +#cmakedefine HAVE_SETRESGID + +/* Define the arch name string */ +#define COMMON_ARCH "${COMMON_ARCH}" + +/* The package name string */ +#define PACKAGE "${PACKAGE}" + +/* The version number string */ +#define PACKAGE_VERSION "${PACKAGE_VERSION}" + +/* The mail address to reach upstream */ +#define PACKAGE_MAIL "deity@lists.debian.org" + +#define APT_8_CLEANER_HEADERS +#define APT_9_CLEANER_HEADERS +#define APT_10_CLEANER_HEADERS + +/* unrolling is faster combined with an optimizing compiler */ +#define SHA2_UNROLL_TRANSFORM diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..90e5272c9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,132 @@ +# Copyright (C) 2009, 2016 Julian Andres Klode . +# Licensed under the same terms as APT; i.e. GPL 2 or later. + +# set minimum version +project(apt) +cmake_minimum_required(VERSION 3.3.0) + +option(WITH_DOC "Build documentation." OFF) +option(USE_NLS "Localisation support." ON) + +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake") + +# Work around bug in GNUInstallDirs +if (EXISTS "/etc/debian_version") + set(CMAKE_INSTALL_LIBEXECDIR "lib") +endif() + +# Include stuff +include(Misc) +include(CheckIncludeFiles) +include(CheckFunctionExists) +include(CheckStructHasMember) +include(GNUInstallDirs) +include(TestBigEndian) +find_package(Threads) +find_package(PkgConfig) + +# Set compiler flags +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + +add_optional_compile_options(Wall) +add_optional_compile_options(Wextra) +add_optional_compile_options(Wcast-align) +add_optional_compile_options(Wlogical-op) +add_optional_compile_options(Wredundant-decls) +add_optional_compile_options(Wmissing-declarations) +add_optional_compile_options(Wunsafe-loop-optimizations) +add_optional_compile_options(Wctor-dtor-privacy) +add_optional_compile_options(Wdisabled-optimization) +add_optional_compile_options(Winit-self) +add_optional_compile_options(Wmissing-include-dirs) +add_optional_compile_options(Wnoexcept) +add_optional_compile_options(Wsign-promo) +add_optional_compile_options(Wundef) + +# apt-ftparchive dependencies +find_package(BerkeleyDB REQUIRED) +if (BERKELEY_DB_FOUND) + set(HAVE_BDB 1) +endif() + + +# apt-transport-https dependencies +pkg_check_modules(CURL libcurl REQUIRED) +if (CURL_FOUND) + set(HAVE_CURL 1) +endif() + +# (De)Compressor libraries +find_package(ZLIB REQUIRED) +if (ZLIB_FOUND) + set(HAVE_ZLIB 1) +endif() + + +find_package(BZip2) +if (BZIP2_FOUND) + set(HAVE_BZ2 1) +endif() + +pkg_check_modules(LZMA liblzma) +if (LZMA_FOUND) + set(HAVE_LZMA 1) +endif() + +pkg_check_modules(LZ4 liblz4) +if (LZ4_FOUND) + set(HAVE_LZ4 1) +endif() + +# Mount()ing and stat()ing and friends + +check_function_exists(statvfs HAVE_STATVFS) +if (NOT HAVE_STATVFS) + check_symbol_exists(statfs sys/vfs.h HAVE_VFS_H) + check_symbol_exists(statfs sys/mount.h HAVE_MOUNT_H) + if (NOT HAVE_VFS_H AND NOT HAVE_MOUNT_H) + message(FATAL_ERROR "Can find neither statvfs() nor statfs()") + endif() + configure_file(buildlib/statvfs.h.in ${PROJECT_BINARY_DIR}/include/statvfs.h @ONLY) +endif() + +CHECK_STRUCT_HAS_MEMBER("struct statfs" f_type sys/vfs.h HAVE_STRUCT_STATFS_F_TYPE) + +# Other checks +check_function_exists(getresuid HAVE_GETRESUID) +check_function_exists(getresgid HAVE_GETRESGID) +check_function_exists(setresuid HAVE_SETRESUID) +check_function_exists(setresgid HAVE_SETRESGID) +check_function_exists(timegm HAVE_TIMEGM) +test_big_endian(WORDS_BIGENDIAN) + +if (CMAKE_USE_PTHREADS_INIT) + set(HAVE_PTHREAD 1) +endif() + +# Configure some variables like package, version and architecture. +set(PACKAGE "apt") + +execute_process(COMMAND dpkg-parsechangelog -SVersion -l${PROJECT_SOURCE_DIR}/debian/changelog + OUTPUT_VARIABLE PACKAGE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH + OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) + +# Configure our configuration headers (config.h and apti18n.h) +configure_file(CMake/config.h.in ${PROJECT_BINARY_DIR}/include/config.h) +configure_file(CMake/apti18n.h.in ${PROJECT_BINARY_DIR}/include/apti18n.h) + +# Generic header locations +include_directories(${PROJECT_BINARY_DIR}/include) + +# Add our subdirectories +add_subdirectory(vendor) +add_subdirectory(apt-pkg) +add_subdirectory(apt-private) +add_subdirectory(apt-inst) +add_subdirectory(cmdline) +add_subdirectory(dselect) +add_subdirectory(ftparchive) +add_subdirectory(methods) diff --git a/README.cmake b/README.cmake new file mode 100644 index 000000000..c9347a057 --- /dev/null +++ b/README.cmake @@ -0,0 +1,36 @@ +The Make System +================ + +To compile this program using cmake you require cmake 3.3 or newer. + +Building +-------- +The recommended way is to generate a build directory and build in it, e.g. + + mkdir build + cd build + cmake .. OR cmake -G Ninja .. + make -j4 OR ninja + +You can use either the make or the ninja generator; the ninja stuff is faster, +though. You can also build in-tree: + + cmake -G Ninja + ninja + +To build a subdirectory; for example, apt-pkg, use one of: + + ninja apt-pkg/all + make -C apt-pkg -j4 (or cd apt-pkg && make -j4) + +Ninja automatically parallelizes, make needs an explicit -j switch. The travis +system uses the make generator, the packaging as well. + +TODO +---- + +The following features have not been implemented yet: + + - documentation + - translation + - unit tests diff --git a/apt-inst/CMakeLists.txt b/apt-inst/CMakeLists.txt new file mode 100644 index 000000000..f7578231a --- /dev/null +++ b/apt-inst/CMakeLists.txt @@ -0,0 +1,26 @@ +# Include apt-pkg directly, as some files have #include +include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg) + +# Set the version of the library +set(MAJOR 2.0) +set(MINOR 0) +set(APT_INST_MAJOR ${MAJOR} PARENT_SCOPE) + +# Definition of the C++ files used to build the library +file(GLOB_RECURSE library "*.cc") +file(GLOB_RECURSE headers "*.h") + +# Create a library using the C++ files +add_library(apt-inst SHARED ${library}) + +# Link the library and set the SONAME +target_link_libraries(apt-inst PUBLIC apt-pkg ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(apt-inst PRIVATE ${CMAKE_THREAD_LIBS_INIT}) +set_target_properties(apt-inst PROPERTIES VERSION ${MAJOR}.${MINOR}) +set_target_properties(apt-inst PROPERTIES SOVERSION ${MAJOR}) +add_version_script(apt-inst) + +# Install the library and the headers +install(TARGETS apt-inst LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/apt-pkg) +flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}") diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt new file mode 100644 index 000000000..ec78f49c4 --- /dev/null +++ b/apt-pkg/CMakeLists.txt @@ -0,0 +1,46 @@ +# Include apt-pkg directly, as some files have #include +include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg) + +add_definitions("-DAPT_PKG_EXPOSE_STRING_VIEW") + +# Set the version of the library +execute_process(COMMAND awk -v ORS=. "/^\#define APT_PKG_M/ {print \$3}" + COMMAND sed "s/\\.\$//" + INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h + OUTPUT_VARIABLE MAJOR OUTPUT_STRIP_TRAILING_WHITESPACE) +execute_process(COMMAND grep "^#define APT_PKG_RELEASE" + COMMAND cut -d " " -f 3 + INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h + OUTPUT_VARIABLE MINOR OUTPUT_STRIP_TRAILING_WHITESPACE) + +message(STATUS "Building libapt-pkg ${MAJOR} (release ${MINOR})") +set(APT_PKG_MAJOR ${MAJOR} PARENT_SCOPE) # exporting for methods/CMakeLists.txt + +# Definition of the C++ files used to build the library +file(GLOB_RECURSE library "*.cc") +file(GLOB_RECURSE headers "*.h") + +# Create a library using the C++ files +add_library(apt-pkg SHARED ${library}) +add_dependencies(apt-pkg apt-pkg-versionscript) +# Link the library and set the SONAME +target_include_directories(apt-pkg + PRIVATE ${ZLIB_INCLUDE_DIRS} + ${BZIP2_INCLUDE_DIRS} + ${LZMA_INCLUDE_DIRS} + ${LZ4_INCLUDE_DIRS}) +target_link_libraries(apt-pkg + PRIVATE -lutil -ldl -lresolv + ${CMAKE_THREAD_LIBS_INIT} + ${ZLIB_LIBRARIES} + ${BZIP2_LIBRARIES} + ${LZMA_LIBRARIES} + ${LZ4_LIBRARIES}) +set_target_properties(apt-pkg PROPERTIES VERSION ${MAJOR}.${MINOR}) +set_target_properties(apt-pkg PROPERTIES SOVERSION ${MAJOR}) +add_version_script(apt-pkg) + +# Install the library and the header files +install(TARGETS apt-pkg LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/apt-pkg) +flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}") diff --git a/apt-private/CMakeLists.txt b/apt-private/CMakeLists.txt new file mode 100644 index 000000000..6de9e0281 --- /dev/null +++ b/apt-private/CMakeLists.txt @@ -0,0 +1,23 @@ +# Set the version of the library +set(MAJOR 0.0) +set(MINOR 0) + +# Definition of the C++ files used to build the library +file(GLOB_RECURSE library "*.cc") +file(GLOB_RECURSE headers "*.h") + +# Create a library using the C++ files +add_library(apt-private SHARED ${library}) + +# Link the library and set the SONAME +target_link_libraries(apt-private PUBLIC apt-pkg) +set_target_properties(apt-private PROPERTIES VERSION ${MAJOR}.${MINOR}) +set_target_properties(apt-private PROPERTIES SOVERSION ${MAJOR}) +add_version_script(apt-private) + +# Install the library and the headers +install(TARGETS apt-private + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + NAMELINK_SKIP) + +flatify(${PROJECT_BINARY_DIR}/include/apt-private/ "${headers}") diff --git a/cmdline/CMakeLists.txt b/cmdline/CMakeLists.txt new file mode 100644 index 000000000..8977b45d1 --- /dev/null +++ b/cmdline/CMakeLists.txt @@ -0,0 +1,59 @@ +# Create the executable tasks +add_executable(apt apt.cc) +add_executable(apt-cache apt-cache.cc) +add_executable(apt-get apt-get.cc) +add_executable(apt-mark apt-mark.cc) +add_executable(apt-config apt-config.cc) +add_executable(apt-cdrom apt-cdrom.cc) +add_executable(apt-helper apt-helper.cc) +add_executable(apt-sortpkgs apt-sortpkgs.cc) +add_executable(apt-extracttemplates apt-extracttemplates.cc) +add_executable(apt-internal-solver apt-internal-solver.cc) +add_executable(apt-dump-solver apt-dump-solver.cc) +add_executable(apt-internal-planner apt-internal-planner.cc) +add_vendor_file(OUTPUT apt-key + INPUT apt-key.in + MODE 755 + VARIABLES keyring-filename + keyring-removed-filename + keyring-master-filename + keyring-uri keyring-package) + + +# Link the executables against the libraries +target_link_libraries(apt apt-pkg apt-private) +target_link_libraries(apt-cache apt-pkg apt-private) +target_link_libraries(apt-get apt-pkg apt-private) +target_link_libraries(apt-config apt-pkg apt-private) +target_link_libraries(apt-cdrom apt-pkg apt-private) +target_link_libraries(apt-helper apt-pkg apt-private) +target_link_libraries(apt-mark apt-pkg apt-private) +target_link_libraries(apt-sortpkgs apt-pkg apt-private) +target_link_libraries(apt-extracttemplates apt-pkg apt-inst apt-private) +target_link_libraries(apt-internal-solver apt-pkg apt-inst apt-private) +target_link_libraries(apt-dump-solver apt-pkg apt-inst apt-private) +target_link_libraries(apt-internal-planner apt-pkg apt-inst apt-private) + +set_target_properties(apt-dump-solver + PROPERTIES RUNTIME_OUTPUT_DIRECTORY solvers + RUNTIME_OUTPUT_NAME dump) +set_target_properties(apt-internal-solver + PROPERTIES RUNTIME_OUTPUT_DIRECTORY solvers + RUNTIME_OUTPUT_NAME apt) +set_target_properties(apt-internal-planner + PROPERTIES RUNTIME_OUTPUT_DIRECTORY planners + RUNTIME_OUTPUT_NAME apt) + +# Install the executables +install(TARGETS apt apt-cache apt-get apt-config apt-cdrom apt-mark apt-sortpkgs + apt-extracttemplates + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +install(TARGETS apt-helper RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/) +install(TARGETS apt-dump-solver apt-internal-solver RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/solvers) +install(TARGETS apt-internal-planner RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/planners) + +add_slaves(${CMAKE_INSTALL_LIBEXECDIR}/apt/planners ../solvers/dump planners/dump) + +# Install the not-to-be-compiled programs +INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/apt-key DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/dselect/CMakeLists.txt b/dselect/CMakeLists.txt new file mode 100644 index 000000000..804306e72 --- /dev/null +++ b/dselect/CMakeLists.txt @@ -0,0 +1,4 @@ +install(PROGRAMS install setup update + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/dpkg/methods/apt) +install(FILES desc.apt names + DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/dpkg/methods/apt) diff --git a/ftparchive/CMakeLists.txt b/ftparchive/CMakeLists.txt new file mode 100644 index 000000000..1e1dc36ca --- /dev/null +++ b/ftparchive/CMakeLists.txt @@ -0,0 +1,10 @@ +# Create the executable tasks +file(GLOB_RECURSE source "*.cc") +add_executable(apt-ftparchive ${source}) + +# Link the executables against the libraries +target_include_directories(apt-ftparchive PRIVATE ${BERKELEY_DB_INCLUDE_DIRS}) +target_link_libraries(apt-ftparchive apt-inst apt-pkg apt-private ${BERKELEY_DB_LIBRARIES}) + +# Install the executables +install(TARGETS apt-ftparchive RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/methods/CMakeLists.txt b/methods/CMakeLists.txt new file mode 100644 index 000000000..2417c4dc1 --- /dev/null +++ b/methods/CMakeLists.txt @@ -0,0 +1,35 @@ +# Create the executable targets +add_executable(file file.cc) +add_executable(copy copy.cc) +add_executable(store store.cc) +add_executable(gpgv gpgv.cc) +add_executable(cdrom cdrom.cc) +add_executable(http http.cc http_main.cc rfc2553emu.cc connect.cc server.cc) +add_executable(mirror mirror.cc http.cc rfc2553emu.cc connect.cc server.cc) +add_executable(https https.cc server.cc) +add_executable(ftp ftp.cc rfc2553emu.cc connect.cc) +add_executable(rred rred.cc) +add_executable(rsh rsh.cc) + +# Add target-specific header directories +target_include_directories(https PRIVATE ${CURL_INCLUDE_DIRS}) + +# Link the executables against the libraries +target_link_libraries(file apt-pkg) +target_link_libraries(copy apt-pkg) +target_link_libraries(store apt-pkg) +target_link_libraries(gpgv apt-pkg) +target_link_libraries(cdrom apt-pkg) +target_link_libraries(http apt-pkg) +target_link_libraries(mirror apt-pkg -lresolv) +target_link_libraries(https apt-pkg ${CURL_LIBRARIES}) +target_link_libraries(ftp apt-pkg) +target_link_libraries(rred apt-pkg) +target_link_libraries(rsh apt-pkg) + +# Install the library +install(TARGETS file copy store gpgv cdrom http https ftp rred rsh mirror + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/methods) + +add_slaves(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods store gzip lzma bzip2 xz) +add_slaves(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods rsh ssh) diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt new file mode 100644 index 000000000..72aad49e1 --- /dev/null +++ b/vendor/CMakeLists.txt @@ -0,0 +1,33 @@ +# Determine the current vendor, export to CURRENT_VENDOR +execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current + OUTPUT_VARIABLE CURRENT_VENDOR OUTPUT_STRIP_TRAILING_WHITESPACE) +set(CURRENT_VENDOR ${CURRENT_VENDOR} PARENT_SCOPE) + +message(STATUS "Detected vendor: ${CURRENT_VENDOR}") + +# Handle sources.list example +add_vendor_file(OUTPUT sources.list + INPUT "${CURRENT_VENDOR}/sources.list.in" + MODE 644 + VARIABLES sourceslist-list-format + debian-stable-codename + debian-oldstable-codename + debian-testing-codename + ubuntu-codename + current-codename) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sources.list + DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) + +# Handle apt.conf snippets +file(GLOB conffiles ${CURRENT_VENDOR}/apt.conf-*) +foreach(file ${conffiles}) + file(RELATIVE_PATH confname ${CMAKE_CURRENT_SOURCE_DIR}/${CURRENT_VENDOR}/ ${file}) + string(REPLACE "apt.conf-" "" confname "${confname}") + install(FILES "${file}" + DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/apt/apt.conf.d/" + RENAME "${confname}") +endforeach() + +if (EXISTS "${CURRENT_VENDOR}/CMakeLists.txt") + add_subdirectory(${CURRENT_VENDOR}) +endif() -- cgit v1.2.3 From 7def24826c298df77e34fd17bb72c570a22b04bd Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 21:11:06 +0200 Subject: CMake: Add support for building and installing .mo files Introduce support for building translation domain-specific templates, merging them with the translations, and building a language-specific .mo file. The invocation of xgettext is done in the project source directory, not in the current source directory, and all paths are made relative to the project root, in order to have clean templates. This only supports the C++ source code for now, it unfortunately does not handle the shell scripts of deselect yet. --- CMake/Translations.cmake | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 2 ++ README.cmake | 4 +++- po/CMakeLists.txt | 20 ++++++++++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 CMake/Translations.cmake create mode 100644 po/CMakeLists.txt diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake new file mode 100644 index 000000000..2a1e03d4c --- /dev/null +++ b/CMake/Translations.cmake @@ -0,0 +1,53 @@ +# translations.cmake - Translations using APT's translation system. +# Copyright (C) 2009, 2016 Julian Andres Klode + +function(apt_add_translation_domain domain) + set(targets ${ARGN}) + # Build the list of source files of the target + set(files "") + foreach(target ${targets}) + get_target_property(source_dir ${target} SOURCE_DIR) + get_target_property(sources ${target} SOURCES) + foreach(source ${sources}) + string(SUBSTRING ${source} 0 1 init_char) + string(COMPARE EQUAL ${init_char} "/" is_absolute) + if (${is_absolute}) + set(file "${source}") + else() + set(file "${source_dir}/${source}") + endif() + file(RELATIVE_PATH relfile ${PROJECT_SOURCE_DIR} ${file}) + set(files ${files} ${relfile}) + endforeach() + + target_compile_definitions(${target} PRIVATE -DAPT_DOMAIN="${domain}") + endforeach() + + # Create the template for this specific sub-domain + add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.pot + COMMAND xgettext --add-comments --foreign -k_ -kN_ + -o ${PROJECT_BINARY_DIR}/${domain}.pot ${files} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) + + # Build .mo files + file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") + list(SORT translations) + foreach(file ${translations}) + get_filename_component(langcode ${file} NAME_WE) + set(outdir ${PROJECT_BINARY_DIR}/locale/${langcode}/LC_MESSAGES) + file(MAKE_DIRECTORY ${outdir}) + # Command to merge and compile the messages + add_custom_command(OUTPUT ${outdir}/${domain}.mo + COMMAND msgmerge -qo - ${file} ${PROJECT_BINARY_DIR}/${domain}.pot | + msgfmt -o ${outdir}/${domain}.mo - + DEPENDS ${file} ${PROJECT_BINARY_DIR}/${domain}.pot + ) + + set(mofiles ${mofiles} ${outdir}/${domain}.mo) + install(FILES ${outdir}/${domain}.mo + DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${langcode}/LC_MESSAGES") + endforeach(file ${translations}) + + add_custom_target(nls-${domain} ALL DEPENDS ${mofiles}) +endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index 90e5272c9..cba893227 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ endif() # Include stuff include(Misc) +include(Translations) include(CheckIncludeFiles) include(CheckFunctionExists) include(CheckStructHasMember) @@ -130,3 +131,4 @@ add_subdirectory(cmdline) add_subdirectory(dselect) add_subdirectory(ftparchive) add_subdirectory(methods) +add_subdirectory(po) diff --git a/README.cmake b/README.cmake index c9347a057..d94a46f12 100644 --- a/README.cmake +++ b/README.cmake @@ -32,5 +32,7 @@ TODO The following features have not been implemented yet: - documentation - - translation + - Translated docbook guides + - dselect translations - unit tests + - update-po diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 000000000..0dd14839c --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,20 @@ +apt_add_translation_domain(libapt-pkg${APT_PKG_MAJOR} apt-pkg) + +apt_add_translation_domain(apt # Domain + apt apt-cache apt-get apt-config apt-cdrom + apt-helper apt-mark + apt-private + # Methods + file copy store gpgv cdrom http https ftp rred rsh) + + +apt_add_translation_domain(apt-utils # Domain + apt-sortpkgs + apt-extracttemplates + apt-internal-solver + apt-dump-solver + apt-internal-planner + apt-ftparchive) + +# Add the translations for libapt-inst, and set the translation domain. +apt_add_translation_domain(libapt-inst${APT_INST_MAJOR} apt-inst) -- cgit v1.2.3 From 9a2aa0e7f21ef33345f6093ca17fab97a678d543 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 21:18:39 +0200 Subject: CMake: Add initial support for documentation building Build HTML docbook guides (untranslated) and manual pages (including translations). Also install the examples in the example subdirectory. Translation of docbook guides has not been implemented yet, but should be easy to do. The code also needs some cleanup to automatically detect the available translations. --- CMake/Documentation.cmake | 134 ++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 1 + README.cmake | 1 - doc/CMakeLists.txt | 21 +++++++ doc/examples/CMakeLists.txt | 4 ++ 5 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 CMake/Documentation.cmake create mode 100644 doc/CMakeLists.txt create mode 100644 doc/examples/CMakeLists.txt diff --git a/CMake/Documentation.cmake b/CMake/Documentation.cmake new file mode 100644 index 000000000..98e07176b --- /dev/null +++ b/CMake/Documentation.cmake @@ -0,0 +1,134 @@ +# Copyright (C) 2009, 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. + +function(add_docbook target sourcefiles installdest) + foreach(file ${sourcefiles}) + get_filename_component(relfile ${file} NAME) + string(REPLACE ".dbk" "" manual ${relfile}) + get_filename_component(absolute ${file} ABSOLUTE) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html/ + COMMAND xsltproc --nonet --novalid --xinclude + --stringparam base.dir ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html/ + --path ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/${CURRENT_VENDOR}/ + --path ${CMAKE_CURRENT_SOURCE_DIR}/ + ${CMAKE_CURRENT_SOURCE_DIR}/docbook-html-style.xsl + ${absolute} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${file} + ) + set(commands ${commands} ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html) + if (NOT ${installdest} EQUAL "" ) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html + DESTINATION ${installdest}) + endif() + endforeach(file ${sourcefiles}) + + add_custom_target(${target} ALL DEPENDS ${commands}) +endfunction() + + +function(add_po4a type master po target deps) + add_custom_command(OUTPUT ${target} + COMMAND po4a-translate --keep 0 -f ${type} -m ${master} + -p ${po} -l ${target} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${deps} ${master} ${po}) +endfunction() + + +# Macro for XML man pages. +function(add_xml_manpages target manpages translations entities) + foreach(manpage ${manpages}) + string(LENGTH ${manpage} manpage_length) + math(EXPR manpage_length ${manpage_length}-1) + string(SUBSTRING ${manpage} ${manpage_length} 1 section) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${manpage} + COMMAND xsltproc --path ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/${CURRENT_VENDOR}/ + --path ${CMAKE_CURRENT_SOURCE_DIR}/ + ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl + ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.xml + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.xml + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl + ) + + + set(commands ${commands} ${CMAKE_CURRENT_BINARY_DIR}/${manpage}) + + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${manpage} + DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}) + + # Add the translations for the manpage. + foreach(translation ${translations}) + set(entities) + # transdir = shortcut to the output directory for translations. + set(transdir ${CMAKE_CURRENT_BINARY_DIR}/${translation}) + + add_po4a(docbook ${manpage}.xml po/${translation}.po + ${transdir}/${manpage}.xml "${ent_cmds}") + + + add_custom_command(OUTPUT ${transdir}/${manpage} + COMMAND xsltproc --path ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/${CURRENT_VENDOR}/ + --path ${CMAKE_CURRENT_SOURCE_DIR}/ + --stringparam l10n.gentext.default.language ${translation} + ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl + ${transdir}/${manpage}.xml + WORKING_DIRECTORY ${transdir} + DEPENDS ${transdir}/${manpage}.xml + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl) + + set(nls-cmd ${nls-cmd} ${transdir}/${manpage}) + install(FILES ${transdir}/${manpage} + DESTINATION ${CMAKE_INSTALL_MANDIR}/${translation}/man${section}) + + endforeach(translation ${translations}) + endforeach(manpage ${manpages}) + + add_custom_target(${target} ALL DEPENDS ${commands}) + # Sort the list of the translations. + list(SORT nls-cmd) + add_custom_target(nls-${target} ALL DEPENDS ${nls-cmd}) +endfunction() + + +function(add_manpages target manpages translations) + foreach(man ${manpages}) + string(LENGTH ${man} manpage_length) + math(EXPR manpage_length ${manpage_length}-1) + string(SUBSTRING ${man} ${manpage_length} 1 section) + install(FILES ${man} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}) + + if (USE_NLS) + foreach(translation ${translations}) + set(transdir ${CMAKE_CURRENT_BINARY_DIR}/${translation}) + add_po4a(man ${man} po/${translation}.po ${transdir}/${man} "") + install(FILES ${transdir}/${man} + DESTINATION ${CMAKE_INSTALL_MANDIR}/${translation}/man${section}) + set(files ${files} ${transdir}/${man}) + endforeach(translation ${translations}) + endif() + endforeach(man ${manpages}) + add_custom_target(${target} ALL DEPENDS ${files}) +endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index cba893227..defb4f111 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,7 @@ add_subdirectory(apt-pkg) add_subdirectory(apt-private) add_subdirectory(apt-inst) add_subdirectory(cmdline) +add_subdirectory(doc) add_subdirectory(dselect) add_subdirectory(ftparchive) add_subdirectory(methods) diff --git a/README.cmake b/README.cmake index d94a46f12..a993b2589 100644 --- a/README.cmake +++ b/README.cmake @@ -31,7 +31,6 @@ TODO The following features have not been implemented yet: - - documentation - Translated docbook guides - dselect translations - unit tests diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 000000000..bbf5fb046 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,21 @@ +include(Documentation) + +file(GLOB_RECURSE debiandoc-apt guide*.dbk offline*.dbk) +file(GLOB_RECURSE debiandoc-libapt cache*.dbk design*.dbk dpkg-tech*.dbk + files*.dbk method*.dbk) + + +set(manpages apt.8 apt-cache.8 apt-get.8 apt-cdrom.8 apt.conf.5 sources.list.5 + apt-config.8 apt_preferences.5 apt-sortpkgs.1 apt-ftparchive.1 + apt-extracttemplates.1 apt-key.8 apt-secure.8 apt-mark.8) + +if (WITH_DOC) +add_docbook(debiandoc-apt "${debiandoc-apt}" share/doc/apt-doc) +add_docbook(debiandoc-libapt "${debiandoc-libapt}" share/doc/libapt-pkg-doc) +endif() + +# Build the manpages, and add translations (ja only for now, others broken) +add_xml_manpages(doc-man "${manpages}" "de;es;fr;it;ja;nl;pl;pt_BR;pt" "apt.ent;apt-verbatim.ent") + + +add_subdirectory(examples) diff --git a/doc/examples/CMakeLists.txt b/doc/examples/CMakeLists.txt new file mode 100644 index 000000000..1998867db --- /dev/null +++ b/doc/examples/CMakeLists.txt @@ -0,0 +1,4 @@ +install(FILES apt.conf apt-https-method-example.conf configure-index preferences + DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) +install(FILES apt-ftparchive.conf ftp-archive.conf + DESTINATION ${CMAKE_INSTALL_DOCDIR}/../apt-utils/examples) -- cgit v1.2.3 From dfd863ea50c0fcf9b9ac4dfb5ae0e64c529bd767 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 21:32:36 +0200 Subject: CMake: Switch integration tests and travis over This early support seems a bit hacky, but it's a hard switch: The integration tests do not understand the old build system anymore afterwards. I don't really like that. --- .travis.yml | 10 ++++++++-- CMakeLists.txt | 1 + test/CMakeLists.txt | 1 + test/integration/framework | 17 +++++++++-------- test/integration/test-apt-helper-cat-file | 2 +- test/interactive-helper/CMakeLists.txt | 10 ++++++++++ 6 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 test/CMakeLists.txt create mode 100644 test/interactive-helper/CMakeLists.txt diff --git a/.travis.yml b/.travis.yml index a076d3e4c..755640831 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,15 +3,21 @@ sudo: required dist: trusty before_install: - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ wily main universe' -y + - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial main' -y - | sudo sh -c '/bin/echo -e "Package: *\nPin: release n=wily\nPin-Priority: 1" > /etc/apt/preferences.d/wily' + sudo sh -c '/bin/echo -e "Package: *\nPin: release n=xenial\nPin-Priority: 1" > /etc/apt/preferences.d/xenial' - sudo apt-get update -qq install: - sudo ./prepare-release travis-ci - sudo apt-get -qq -y -t wily install gettext liblz4-dev python3-apt - - make + - sudo apt-get -qq -y -t xenial install cmake +before_script: + - ( mkdir build && cd build && cmake .. ) + - make -C build -j4 script: - - make test - ./test/integration/run-tests -q - sudo adduser --force-badname --system --home /nonexistent --no-create-home --quiet _apt || true - sudo ./test/integration/run-tests -q + - make -C build install DESTDIR=$PWD/rootdir + - find rootdir -print0 | xargs -0 ls -ld diff --git a/CMakeLists.txt b/CMakeLists.txt index defb4f111..e01fdbed5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,3 +133,4 @@ add_subdirectory(dselect) add_subdirectory(ftparchive) add_subdirectory(methods) add_subdirectory(po) +add_subdirectory(test) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 000000000..599f62aff --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(interactive-helper) diff --git a/test/integration/framework b/test/integration/framework index 7a6b044aa..824bd46b6 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -180,7 +180,7 @@ aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } aptcdrom() { runapt apt-cdrom "$@"; } aptget() { runapt apt-get "$@"; } -aptftparchive() { runapt apt-ftparchive "$@"; } +aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } aptsortpkgs() { runapt apt-sortpkgs "$@"; } @@ -283,14 +283,15 @@ setupenvironment() { TESTDIRECTORY="$(readlink -f "$(dirname $0)")" # allow overriding the default BUILDDIR location SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" - BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}" - LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}" - METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" + BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/cmdline"}" + LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/../apt-pkg"}" + METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/../methods"}" APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}" - APTWEBSERVERBINDIR="${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}" - APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}" - APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}" - APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${BUILDDIRECTORY}/apt-internal-planner"}" + APTWEBSERVERBINDIR="${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}/../test/interactive-helper"}" + APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/../ftparchive"}" + APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/solvers/apt"}" + APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/solvers/dump"}" + APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${BUILDDIRECTORY}/planners/apt"}" test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" # ----- diff --git a/test/integration/test-apt-helper-cat-file b/test/integration/test-apt-helper-cat-file index 3f509189e..a53a6b4a3 100755 --- a/test/integration/test-apt-helper-cat-file +++ b/test/integration/test-apt-helper-cat-file @@ -5,7 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment -TESTTOOL="${BUILDDIRECTORY}/test_fileutl" +TESTTOOL="${BUILDDIRECTORY}/../test/interactive-helper/test_fileutl" msgtest 'Check if we have build the test tool' "$TESTTOOL" if [ -x "$TESTTOOL" ]; then msgpass diff --git a/test/interactive-helper/CMakeLists.txt b/test/interactive-helper/CMakeLists.txt new file mode 100644 index 000000000..fc08d6a8f --- /dev/null +++ b/test/interactive-helper/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(mthdcat mthdcat.cc) +target_link_libraries(mthdcat apt-pkg) +add_executable(testdeb testdeb.cc) +target_link_libraries(testdeb apt-pkg apt-inst) +add_executable(extract-control extract-control.cc) +target_link_libraries(extract-control apt-pkg apt-inst) +add_executable(aptwebserver aptwebserver.cc) +target_link_libraries(aptwebserver apt-pkg ${CMAKE_THREAD_LIBS_INIT}) +add_executable(test_fileutl test_fileutl.cc) +target_link_libraries(test_fileutl apt-pkg) -- cgit v1.2.3 From e825742bbbbe99b99d525a3b34832b25a7396c84 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 21:40:01 +0200 Subject: CMake: debian: Switch packaging over to CMake and dh 9 This new packaging is much easier to read, although the duplication in the install files is a bit annoying. We should probably also get rid of the movefiles for solvers, planners, and https method; but then we have to keep track of which methods exist in the apt package. Another disadvantage is that building only the documentation packages also requires building the code, as there's no way to turn off code building in the project. --- .gitignore | 7 - debian/apt-doc.install | 1 + debian/apt-transport-https.files | 1 + debian/apt-transport-https.install | 1 - debian/apt-utils.install | 19 ++ debian/apt.files | 2 + debian/apt.install | 39 ++++ debian/apt.install.in | 9 - debian/apt.systemd.daily | 0 debian/compat | 2 +- debian/control | 2 +- debian/copyright | 1 + debian/libapt-inst2.0.install | 2 + debian/libapt-inst2.0.install.in | 2 - debian/libapt-pkg-dev.install | 3 + debian/libapt-pkg-dev.install.in | 3 - debian/libapt-pkg-doc.docs | 6 +- debian/libapt-pkg-doc.install | 1 + debian/libapt-pkg5.0.install | 2 + debian/libapt-pkg5.0.install.in | 2 - debian/libapt-pkg5.0.symbols | 8 +- debian/rules | 364 +++---------------------------------- debian/tests/run-tests | 1 + 23 files changed, 102 insertions(+), 376 deletions(-) create mode 100644 debian/apt-doc.install create mode 100644 debian/apt-transport-https.files delete mode 100644 debian/apt-transport-https.install create mode 100644 debian/apt.files create mode 100644 debian/apt.install delete mode 100644 debian/apt.install.in mode change 100644 => 100755 debian/apt.systemd.daily create mode 120000 debian/copyright create mode 100644 debian/libapt-inst2.0.install delete mode 100644 debian/libapt-inst2.0.install.in create mode 100644 debian/libapt-pkg-dev.install delete mode 100644 debian/libapt-pkg-dev.install.in create mode 100644 debian/libapt-pkg-doc.install create mode 100644 debian/libapt-pkg5.0.install delete mode 100644 debian/libapt-pkg5.0.install.in diff --git a/.gitignore b/.gitignore index c96c33b29..14e8c596c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,6 @@ /buildlib/config.sub /configure -# copy of COPYING -/debian/copyright - # generated files in the process to build all # apt man pages and other documentation /doc/*/ @@ -36,10 +33,6 @@ /cmdline/apt-key /doc/apt-vendor.ent /doc/examples/sources.list -/debian/apt.install -/debian/libapt-pkg*.install -/debian/libapt-inst*.install -/debian/libapt-pkg-dev.install /vendor/current /vendor/*/sources.list /vendor/*/makefile.auto diff --git a/debian/apt-doc.install b/debian/apt-doc.install new file mode 100644 index 000000000..be5e87159 --- /dev/null +++ b/debian/apt-doc.install @@ -0,0 +1 @@ +usr/share/doc/apt-doc diff --git a/debian/apt-transport-https.files b/debian/apt-transport-https.files new file mode 100644 index 000000000..7b14886df --- /dev/null +++ b/debian/apt-transport-https.files @@ -0,0 +1 @@ +usr/lib/apt/methods/https diff --git a/debian/apt-transport-https.install b/debian/apt-transport-https.install deleted file mode 100644 index 848f10c78..000000000 --- a/debian/apt-transport-https.install +++ /dev/null @@ -1 +0,0 @@ -bin/methods/https usr/lib/apt/methods diff --git a/debian/apt-utils.install b/debian/apt-utils.install index cdbcb2f37..178b528b7 100644 --- a/debian/apt-utils.install +++ b/debian/apt-utils.install @@ -1 +1,20 @@ usr/share/locale/*/*/apt-utils.mo + +usr/bin/apt-ftparchive +usr/bin/apt-sortpkgs +usr/bin/apt-extracttemplates + +usr/share/man/*/apt-ftparchive.* +usr/share/man/*/*/apt-ftparchive.* + +usr/share/man/*/apt-sortpkgs.* +usr/share/man/*/*/apt-sortpkgs.* + +usr/share/man/*/apt-extracttemplates.* +usr/share/man/*/*/apt-extracttemplates.* + + +usr/lib/apt/solvers/ +usr/lib/apt/planners/ + +usr/share/doc/apt-utils diff --git a/debian/apt.files b/debian/apt.files new file mode 100644 index 000000000..572475192 --- /dev/null +++ b/debian/apt.files @@ -0,0 +1,2 @@ +usr/lib/apt/solvers/dump +usr/lib/apt/planners/dump diff --git a/debian/apt.install b/debian/apt.install new file mode 100644 index 000000000..82b9ec6f4 --- /dev/null +++ b/debian/apt.install @@ -0,0 +1,39 @@ +usr/bin/apt +usr/bin/apt-get +usr/bin/apt-cache +usr/bin/apt-cdrom +usr/bin/apt-config +usr/bin/apt-key +usr/bin/apt-mark +usr/lib/apt/methods/ +usr/lib/dpkg/methods/apt/ +usr/share/locale/*/*/apt.mo +usr/lib/*/libapt-private.so* +usr/share/man/*/apt.* +usr/share/man/*/apt-get.* +usr/share/man/*/apt-cache.* +usr/share/man/*/apt-cdrom.* +usr/share/man/*/apt-config.* +usr/share/man/*/apt-key.* +usr/share/man/*/apt-mark.* +usr/share/man/*/apt-secure.* +usr/share/man/*/sources.list.* +usr/share/man/*/apt_preferences.* +usr/share/man/*/*/apt.* +usr/share/man/*/*/apt-get.* +usr/share/man/*/*/apt-cache.* +usr/share/man/*/*/apt-cdrom.* +usr/share/man/*/*/apt-config.* +usr/share/man/*/*/apt-key.* +usr/share/man/*/*/apt-mark.* +usr/share/man/*/*/apt-secure.* +usr/share/man/*/*/sources.list.* +usr/share/man/*/*/apt_preferences.* +completions/bash/* /usr/share/bash-completion/completions/ +debian/*.service /lib/systemd/system/ +debian/*.timer /lib/systemd/system/ +usr/lib/apt/apt-helper + +usr/share/doc/apt + +debian/apt.systemd.daily usr/lib/apt diff --git a/debian/apt.install.in b/debian/apt.install.in deleted file mode 100644 index f390c87aa..000000000 --- a/debian/apt.install.in +++ /dev/null @@ -1,9 +0,0 @@ -bin/apt usr/bin/ -bin/apt-* usr/bin/ -bin/methods/* usr/lib/apt/methods/ -scripts/dselect/* usr/lib/dpkg/methods/apt/ -usr/share/locale/*/*/apt.mo -bin/libapt-private.so.* usr/lib/@DEB_HOST_MULTIARCH@/ -../completions/bash/* /usr/share/bash-completion/completions/ -../debian/*.service /lib/systemd/system/ -../debian/*.timer /lib/systemd/system/ \ No newline at end of file diff --git a/debian/apt.systemd.daily b/debian/apt.systemd.daily old mode 100644 new mode 100755 diff --git a/debian/compat b/debian/compat index 7f8f011eb..ec635144f 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index daaff0e2d..855b90d2d 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: dpkg-dev (>= 1.17.14), debhelper (>= 9.20141010), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~), zlib1g-dev, libbz2-dev, liblzma-dev, liblz4-dev (>= 0.0~r126), xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2), - autotools-dev, autoconf, automake, libgtest-dev , dh-systemd + cmake, libgtest-dev , dh-systemd Build-Depends-Indep: doxygen, w3m, graphviz Build-Conflicts: autoconf2.13, automake1.4 Vcs-Git: https://anonscm.debian.org/git/apt/apt.git diff --git a/debian/copyright b/debian/copyright new file mode 120000 index 000000000..012065c85 --- /dev/null +++ b/debian/copyright @@ -0,0 +1 @@ +../COPYING \ No newline at end of file diff --git a/debian/libapt-inst2.0.install b/debian/libapt-inst2.0.install new file mode 100644 index 000000000..a8ddd5e2d --- /dev/null +++ b/debian/libapt-inst2.0.install @@ -0,0 +1,2 @@ +usr/lib/*/libapt-inst*.so.* +usr/share/locale/*/*/libapt-inst*.mo diff --git a/debian/libapt-inst2.0.install.in b/debian/libapt-inst2.0.install.in deleted file mode 100644 index 8bcce2c28..000000000 --- a/debian/libapt-inst2.0.install.in +++ /dev/null @@ -1,2 +0,0 @@ -bin/libapt-inst*.so.* usr/lib/@DEB_HOST_MULTIARCH@/ -usr/share/locale/*/*/libapt-inst*.mo diff --git a/debian/libapt-pkg-dev.install b/debian/libapt-pkg-dev.install new file mode 100644 index 000000000..e85dc9934 --- /dev/null +++ b/debian/libapt-pkg-dev.install @@ -0,0 +1,3 @@ +usr/lib/*/libapt-pkg*.so +usr/lib/*/libapt-inst*.so +usr/include/apt-pkg/ diff --git a/debian/libapt-pkg-dev.install.in b/debian/libapt-pkg-dev.install.in deleted file mode 100644 index be8022107..000000000 --- a/debian/libapt-pkg-dev.install.in +++ /dev/null @@ -1,3 +0,0 @@ -bin/libapt-pkg*.so usr/lib/@DEB_HOST_MULTIARCH@/ -bin/libapt-inst*.so usr/lib/@DEB_HOST_MULTIARCH@/ -include/apt-pkg/*.h usr/include/apt-pkg/ diff --git a/debian/libapt-pkg-doc.docs b/debian/libapt-pkg-doc.docs index 1ad92a8bb..dcacac18b 100644 --- a/debian/libapt-pkg-doc.docs +++ b/debian/libapt-pkg-doc.docs @@ -1,7 +1,3 @@ -build/docs/design* -build/docs/dpkg-tech* -build/docs/files* -build/docs/method* doc/libapt-pkg2_to_3.txt doc/style.txt -build/doc/doxygen/html +#build/doc/doxygen/html diff --git a/debian/libapt-pkg-doc.install b/debian/libapt-pkg-doc.install new file mode 100644 index 000000000..2f233dd07 --- /dev/null +++ b/debian/libapt-pkg-doc.install @@ -0,0 +1 @@ +usr/share/doc/libapt-pkg-doc diff --git a/debian/libapt-pkg5.0.install b/debian/libapt-pkg5.0.install new file mode 100644 index 000000000..9ac53bc82 --- /dev/null +++ b/debian/libapt-pkg5.0.install @@ -0,0 +1,2 @@ +usr/lib/*/libapt-pkg*.so.* +usr/share/locale/*/*/libapt-pkg*.mo diff --git a/debian/libapt-pkg5.0.install.in b/debian/libapt-pkg5.0.install.in deleted file mode 100644 index 56bed39d3..000000000 --- a/debian/libapt-pkg5.0.install.in +++ /dev/null @@ -1,2 +0,0 @@ -bin/libapt-pkg*.so.* usr/lib/@DEB_HOST_MULTIARCH@/ -usr/share/locale/*/*/libapt-pkg*.mo diff --git a/debian/libapt-pkg5.0.symbols b/debian/libapt-pkg5.0.symbols index bec874911..e2db6bb12 100644 --- a/debian/libapt-pkg5.0.symbols +++ b/debian/libapt-pkg5.0.symbols @@ -1429,7 +1429,7 @@ libapt-pkg.so.5.0 libapt-pkg5.0 #MINVER# ### symbol versioning: APTPKG_5.0@APTPKG_5.0 1.1~exp9 ### gcc artifacts - (c++)"void std::vector >::emplace_back(APT::Configuration::Compressor&&)@APTPKG_5.0" 1.1~exp9 + (c++|optional=std)"void std::vector >::emplace_back(APT::Configuration::Compressor&&)@APTPKG_5.0" 1.1~exp9 (c++|optional=std)"void std::vector >::emplace_back(char const*&&)@APTPKG_5.0" 1.1~exp9 (c++|optional=std)"void std::vector >::emplace_back(pkgCache::GrpIterator*&&)@APTPKG_5.0" 1.1~exp9 (c++|optional=std)"void std::vector >::emplace_back(pkgCache::PkgIterator*&&)@APTPKG_5.0" 1.1~exp9 @@ -1477,6 +1477,6 @@ libapt-pkg.so.5.0 libapt-pkg5.0 #MINVER# (c++)"EDSP::WriteScenario(pkgDepCache&, FileFd&, OpProgress*)@APTPKG_5.0" 1.3~exp2 (c++)"EDSP::WriteSolutionStanza(FileFd&, char const*, pkgCache::VerIterator const&)@APTPKG_5.0" 1.3~exp2 (c++)"int __gnu_cxx::__stoa(long (*)(char const*, char**, int), char const*, char const*, unsigned long*, int)@APTPKG_5.0" 1.3~exp2 - (c++)"std::basic_istream >& std::operator>> >(std::basic_istream >&, std::_Get_time)@APTPKG_5.0" 1.3~exp2 - (c++)"std::basic_ostream >& std::operator<< >(std::basic_ostream >&, std::_Put_time)@APTPKG_5.0" 1.3~exp2 - (c++)"std::ctype::do_narrow(char, char) const@APTPKG_5.0" 1.3~exp2 + (c++|optional=std)"std::basic_istream >& std::operator>> >(std::basic_istream >&, std::_Get_time)@APTPKG_5.0" 1.3~exp2 + (c++|optional=std)"std::basic_ostream >& std::operator<< >(std::basic_ostream >&, std::_Put_time)@APTPKG_5.0" 1.3~exp2 + (c++|optional=std)"std::ctype::do_narrow(char, char) const@APTPKG_5.0" 1.3~exp2 diff --git a/debian/rules b/debian/rules index 18b3f34f3..c1dba72af 100755 --- a/debian/rules +++ b/debian/rules @@ -1,352 +1,34 @@ #!/usr/bin/make -f -# Made with the aid of dh_make, by Craig Small -# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -# Some lines taken from debmake, by Christoph Lameter. - -# build in verbose mode by default to make it easy to diangose issues -export NOISY=1 - -export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) -export PARALLEL = $(or $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))),1) - -# FOR AUTOCONF 2.52 AND NEWER ONLY -ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) - confflags += --build $(DEB_HOST_GNU_TYPE) -else - confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) -endif - -# Set the number of procs to be run in parallel from the options. -confflags += --with-procs=$(PARALLEL) - -# See below --include build/environment.mak - -ifneq (,$(shell which dpkg-buildflags)) - # make does not export to $(shell) so we need to workaround - # (http://savannah.gnu.org/bugs/?10593) - dpkg_buildflags = DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags - export CXXFLAGS = $(shell $(dpkg_buildflags) --get CXXFLAGS) - export LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS) - export CPPFLAGS = $(shell $(dpkg_buildflags) --get CPPFLAGS) -else - ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - export CXXFLAGS = -O0 -g -Wall - else - export CXXFLAGS = -O2 -g -Wall - endif -endif - -# Default rule -build: - -# Determine the build directory to use -override BASE := . -override BLD := $(BASE)/build - -# When building without , the header is available and thus the test is -# successful. When building with , the header is missing, but we still -# pretend it to be available, because configure would fail otherwise. -export ac_cv_header_gtest_gtest_h=yes - -# APT Programs in apt-utils -APT_UTILS=ftparchive sortpkgs extracttemplates - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -# Find the libapt-pkg major version for use in other control files -include buildlib/libversion.mak - -# Determine which library package names to use -LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR) -LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR) +# Copyright (C) 2009, 2016 Julian Andres Klode +# +# Free Software, licensed under the GPL-2 or (at your option) any later version. +export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed +export DEB_BUILD_MAINT_OPTIONS := hardening=+all # do not fail as we are just experimenting with symbol files for now export DPKG_GENSYMBOLS_CHECK_LEVEL=0 -build-binary: build/build-binary-stamp -build-docbook: build/build-docbook-stamp -build-manpages: build/build-manpages-stamp - -# Note that this is unconditionally done first as part of loading environment.mak -# The true is needed to force make to reload environment.mak after running -# configure-stamp. Otherwise we can get stale or invalid, or missing config data. -build/environment.mak: build/configure-stamp - @true - -configure: configure.ac -build/configure-stamp: configure buildlib/config.sub buildlib/config.guess - dh_testdir - mkdir -p build - cp COPYING debian/copyright - cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags) - touch $@ - -build/build-binary-stamp: build/configure-stamp - # Add here commands to compile the package. - $(MAKE) binary - # compat symlink for the locale split - mkdir -p build/usr/share - cd build/usr/share && ln -f -s ../../locale . - # compile and run tests -ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) - $(MAKE) test -else - @echo "Tests DISABLED" -endif - touch $@ - -build/build-docbook-stamp: build/configure-stamp - # Add here commands to compile the package. - $(MAKE) docbook - touch $@ - -build/build-manpages-stamp: build/configure-stamp - # Add here commands to compile the package. - $(MAKE) manpages - touch $@ - -clean: - dh_testdir - dh_clean - - [ ! -f Makefile ] || $(MAKE) clean distclean - rm -rf build - rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \ - debian/libapt-pkg-dev.install debian/apt.install - test ! -L buildlib/config.guess || rm -f buildlib/config.guess - test ! -L buildlib/config.sub || rm -f buildlib/config.sub - -debian/%.install: debian/%.install.in - sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@ - -# Build architecture-independent files here. -libapt-pkg-doc: build-docbook - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ - dh_installdirs -p$@ -# -# libapt-pkg-doc install -# - rm -f $(BLD)/doc/doxygen/html/*.map $(BLD)/doc/doxygen/html/*.md5 - dh_installdocs -p$@ - dh_installexamples -p$@ - dh_lintian -p$@ - dh_installchangelogs -p$@ - dh_strip -p$@ - dh_compress -p$@ -X.xhtml - dh_fixperms -p$@ - dh_installdeb -p$@ - dh_gencontrol -p$@ - dh_md5sums -p$@ - dh_builddeb -p$@ - -apt-doc: build-docbook - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ -# -# apt-doc install -# - # Copy the guides - dh_installdocs -p$@ - dh_installchangelogs -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_installdeb -p$@ - dh_gencontrol -p$@ - dh_md5sums -p$@ - dh_builddeb -p$@ - - - -# Build architecture-dependent files here. - -apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list -apt: build-binary build-manpages debian/apt.install - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ - dh_installdirs -p$@ -# -# apt install -# - cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove - cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal - chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal - # install vendor specific apt confs - find -L vendor/current -name 'apt.conf-*' | while read conf; do cp "$${conf}" "debian/$@/etc/apt/apt.conf.d/$${conf#*-}"; done - - # make rosetta happy and remove pot files in po/ (but leave stuff - # in po/domains/* untouched) and cp *.po into each domain dir - rm -f build/po/*.pot - rm -f po/*.pot - - dh_install -p$@ --sourcedir=$(BLD) - - # Remove the bits that are in apt-utils - rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver internal-planner) - cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump - ln -s ../solvers/dump debian/$@/usr/lib/apt/planners/dump - - # https has its own package - rm debian/$@/usr/lib/apt/methods/https - - # move the mirror failure script in place - #mv debian/$@/usr/bin/apt-report-mirror-failure \ - # debian/$@/usr/lib/apt/apt-report-mirror-failure \ - - # move the apt-helper in place - mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper - # install apt.systemd.daily helper in the right place - install -m755 debian/apt.systemd.daily debian/$@/usr/lib/apt/ - - dh_bugfiles -p$@ - dh_lintian -p$@ - dh_installexamples -p$@ - dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) - dh_installcron -p$@ --name=apt-compat - dh_systemd_enable -p$@ apt-daily.timer - dh_systemd_start -p$@ apt-daily.timer - dh_installdocs -p$@ - dh_installchangelogs -p$@ - dh_installlogrotate -p$@ - dh_strip -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_makeshlibs -p$@ - dh_installdeb -p$@ - dh_shlibdeps -p$@ - dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)" - dh_md5sums -p$@ - dh_builddeb -p$@ - -libapt-pkg-dev: build-binary debian/libapt-pkg-dev.install - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ - dh_installdirs -p$@ -# -# libapt-pkg-dev install -# - dh_install -p$@ --sourcedir=$(BLD) - dh_installdocs -p$@ - dh_installchangelogs -p$@ - dh_strip -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_installdeb -p$@ - dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST) - dh_md5sums -p$@ - dh_builddeb -p$@ - -apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates -apt-utils: build-binary build-manpages - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ - dh_installdirs -p$@ - - cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/ - cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt - cp $(BLD)/bin/apt-internal-planner debian/$@/usr/lib/apt/planners/apt - - dh_install -p$@ --sourcedir=$(BLD) - dh_link -p$@ - dh_installdocs -p$@ - dh_installexamples -p$@ - - # Install the man pages.. - dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES))) - - dh_installchangelogs -p$@ - dh_strip -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_makeshlibs -p$@ - dh_installdeb -p$@ - dh_shlibdeps -p$@ - dh_gencontrol -p$@ - dh_md5sums -p$@ - dh_builddeb -p$@ - -$(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ - dh_installdirs -p$@ - - dh_install -p$@ --sourcedir=$(BLD) - dh_installdocs -p$@ - dh_installchangelogs -p$@ - dh_strip -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_makeshlibs -p$@ - dh_installdeb -p$@ - dh_shlibdeps -p$@ - dh_gencontrol -p$@ - dh_md5sums -p$@ - dh_builddeb -p$@ - -$(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ - dh_installdirs -p$@ - - dh_install -p$@ --sourcedir=$(BLD) - dh_installdocs -p$@ - dh_installchangelogs -p$@ - dh_strip -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_makeshlibs -p$@ - dh_installdeb -p$@ - dh_shlibdeps -p$@ - dh_gencontrol -p$@ - dh_md5sums -p$@ - dh_builddeb -p$@ - -apt-transport-https: build-binary libapt-pkg-dev - dh_testdir -p$@ - dh_testroot -p$@ - dh_prep -p$@ - dh_installdirs -p$@ - - dh_install -p$@ --sourcedir=$(BLD) - dh_installdocs -p$@ - dh_installexamples -p$@ +%: + dh $@ --with systemd --parallel --buildsystem=cmake - # Install the man pages.. - dh_installman -p$@ +override_dh_install-indep: + dh_movefiles + dh_install --list-missing - dh_installchangelogs -p$@ - dh_strip -p$@ - dh_compress -p$@ - dh_fixperms -p$@ - dh_installdeb -p$@ - dh_shlibdeps -p$@ - dh_gencontrol -p$@ - dh_md5sums -p$@ - dh_builddeb -p$@ +override_dh_install-arch: + dh_movefiles + dh_install --fail-missing + install -m 644 debian/apt.conf.autoremove debian/apt/etc/apt/apt.conf.d/01autoremove + install -m 755 debian/apt.auto-removal.sh debian/apt/etc/kernel/postinst.d/apt-auto-removal -buildlib/config.guess buildlib/config.sub: - $(MAKE) "$@" +override_dh_gencontrol: + dh_gencontrol -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)" -configure: - $(MAKE) configure +override_dh_installcron: + dh_installcron --name=apt-compat -# translate targets to targets required by debian-policy -binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https -binary-indep: apt-doc libapt-pkg-doc -binary: binary-indep binary-arch -build-arch: build-binary -build-indep: build-manpages build-docbook -build: build-indep build-arch -.PHONY: build clean binary-indep binary-arch binary +override_dh_auto_configure-arch: flags=-DWITH_DOC=OFF +override_dh_auto_configure-indep: flags=-DWITH_DOC=ON +override_dh_auto_configure-arch override_dh_auto_configure-indep: + dh_auto_configure -- $(flags) diff --git a/debian/tests/run-tests b/debian/tests/run-tests index e33992b28..d2fa915b8 100644 --- a/debian/tests/run-tests +++ b/debian/tests/run-tests @@ -19,5 +19,6 @@ APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \ APT_INTEGRATION_TESTS_DUMP_SOLVER=/usr/lib/apt/solvers/dump \ APT_INTEGRATION_TESTS_INTERNAL_PLANNER=/usr/lib/apt/planners/apt \ APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \ +APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR=/usr/bin \ APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \ ./test/integration/run-tests -q -- cgit v1.2.3 From 7c0a660e184ded5b79e5294376c12c46698d42a8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 22:48:08 +0200 Subject: CMake: Adjust abicheck locations Look in build/apt-pkg and build/apt-inst instead of build/bin. Gbp-Dch: ignore --- abicheck/apt_build.xml.in | 3 ++- abicheck/run_abi_test | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/abicheck/apt_build.xml.in b/abicheck/apt_build.xml.in index f7d4c90cf..32886d931 100644 --- a/abicheck/apt_build.xml.in +++ b/abicheck/apt_build.xml.in @@ -7,5 +7,6 @@ - @build_path@/bin/ + @build_path@/apt-pkg/ + @build_path@/apt-inst/ diff --git a/abicheck/run_abi_test b/abicheck/run_abi_test index 6e6152a63..491616b30 100755 --- a/abicheck/run_abi_test +++ b/abicheck/run_abi_test @@ -8,7 +8,7 @@ if [ ! -d ../build ]; then exit 1 fi -if command -v abi-compliance-checker 2>/dev/null >&2; then +if ! command -v abi-compliance-checker 2>/dev/null >&2; then echo "Please install the 'abi-compliance-checker' package" exit 1 fi -- cgit v1.2.3 From 8970deacc29d826c8a5d5b297f0150b0ad194b73 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 22:49:28 +0200 Subject: releasing package apt version 1.3~pre3+cmake1 --- configure.ac | 2 +- debian/NEWS | 14 ++++++++++++++ debian/changelog | 15 +++++++++++++++ doc/apt-ftparchive.1.xml | 2 +- doc/apt-get.8.xml | 2 +- doc/apt-secure.8.xml | 2 +- doc/apt-verbatim.ent | 2 +- doc/apt.conf.5.xml | 2 +- doc/sources.list.5.xml | 2 +- 9 files changed, 36 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 376217d20..a6386f056 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) PACKAGE="apt" -PACKAGE_VERSION="1.3~pre3" +PACKAGE_VERSION="1.3~pre3+cmake1" PACKAGE_MAIL="APT Development Team " AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION") diff --git a/debian/NEWS b/debian/NEWS index 934391456..f82dedf41 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,3 +1,17 @@ +apt (1.3~pre3+cmake1) experimental; urgency=medium + + Early version of CMake based build system. Translations for the dselect + method and docbook guides are missing, just as the text docbook guides. + + This is mainly intended for checking building, reproducibility, and + cross-compiling. + + This is also the first release since 1999 that re-enabled a thread-local + _error. It was disabled by jgg back then due to glibc issues, but I really + hope those are fixed now. + + -- Julian Andres Klode Sat, 06 Aug 2016 21:56:19 +0200 + apt (1.2~exp1) experimental; urgency=medium [ Automatic removal of debs after install ] diff --git a/debian/changelog b/debian/changelog index cdb3c3345..7217ae21f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +apt (1.3~pre3+cmake1) experimental; urgency=medium + + [ Julian Andres Klode ] + * configure.ac: Re-enable pthread support for thread-local _error + * CMake: Add basic CMake build system + * CMake: Add support for building and installing .mo files + * CMake: Add initial support for documentation building + * CMake: Switch integration tests and travis over + * CMake: debian: Switch packaging over to CMake and dh 9 + + [ Jason Travis ] + * doc: update path to periodic options script + + -- Julian Andres Klode Sat, 06 Aug 2016 22:37:30 +0200 + apt (1.3~pre3) unstable; urgency=medium [ Julian Andres Klode ] diff --git a/doc/apt-ftparchive.1.xml b/doc/apt-ftparchive.1.xml index 7a1ca7fb4..8c424dbce 100644 --- a/doc/apt-ftparchive.1.xml +++ b/doc/apt-ftparchive.1.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; - 2016-07-08T00:00:00Z + 2016-08-04T00:00:00Z diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml index e9623a3ab..48811bba3 100644 --- a/doc/apt-get.8.xml +++ b/doc/apt-get.8.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; - 2016-07-08T00:00:00Z + 2016-08-04T00:00:00Z diff --git a/doc/apt-secure.8.xml b/doc/apt-secure.8.xml index a166853fe..1cc8a8f24 100644 --- a/doc/apt-secure.8.xml +++ b/doc/apt-secure.8.xml @@ -13,7 +13,7 @@ &apt-email; &apt-product; - 2016-07-08T00:00:00Z + 2016-08-04T00:00:00Z diff --git a/doc/apt-verbatim.ent b/doc/apt-verbatim.ent index fbdc8e168..9febadf9f 100644 --- a/doc/apt-verbatim.ent +++ b/doc/apt-verbatim.ent @@ -239,7 +239,7 @@ "> - + diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index b68e0ae44..bb0625f66 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -19,7 +19,7 @@ &apt-email; &apt-product; - 2016-07-08T00:00:00Z + 2016-08-05T00:00:00Z diff --git a/doc/sources.list.5.xml b/doc/sources.list.5.xml index a3181554b..3191cde17 100644 --- a/doc/sources.list.5.xml +++ b/doc/sources.list.5.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; - 2016-07-08T00:00:00Z + 2016-08-04T00:00:00Z -- cgit v1.2.3 From 8a76b2bdc2f9c87a16b259ecb4398d433551aa6d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 23:18:17 +0200 Subject: Build-depend on pkg-config --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 855b90d2d..2c2fc8085 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: dpkg-dev (>= 1.17.14), debhelper (>= 9.20141010), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~), zlib1g-dev, libbz2-dev, liblzma-dev, liblz4-dev (>= 0.0~r126), xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2), - cmake, libgtest-dev , dh-systemd + cmake, pkg-config, libgtest-dev , dh-systemd Build-Depends-Indep: doxygen, w3m, graphviz Build-Conflicts: autoconf2.13, automake1.4 Vcs-Git: https://anonscm.debian.org/git/apt/apt.git -- cgit v1.2.3 From 4b94063cc2df28baf2a60970e230b780f9951d8e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 23:18:46 +0200 Subject: releasing package apt version 1.3~pre3+cmake2 --- configure.ac | 2 +- debian/changelog | 6 ++++++ doc/apt-ftparchive.1.xml | 2 +- doc/apt-get.8.xml | 2 +- doc/apt-secure.8.xml | 2 +- doc/apt-verbatim.ent | 2 +- doc/apt.conf.5.xml | 2 +- doc/po/apt-doc.pot | 4 ++-- doc/po/de.po | 2 +- doc/po/es.po | 2 +- doc/po/fr.po | 2 +- doc/po/it.po | 2 +- doc/po/ja.po | 2 +- doc/po/nl.po | 2 +- doc/po/pl.po | 2 +- doc/po/pt.po | 2 +- doc/po/pt_BR.po | 2 +- doc/sources.list.5.xml | 2 +- 18 files changed, 24 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index a6386f056..c1e61da66 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) PACKAGE="apt" -PACKAGE_VERSION="1.3~pre3+cmake1" +PACKAGE_VERSION="1.3~pre3+cmake2" PACKAGE_MAIL="APT Development Team " AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION") diff --git a/debian/changelog b/debian/changelog index 7217ae21f..2c78c5a54 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +apt (1.3~pre3+cmake2) experimental; urgency=medium + + * Build-depend on pkg-config + + -- Julian Andres Klode Sat, 06 Aug 2016 23:18:37 +0200 + apt (1.3~pre3+cmake1) experimental; urgency=medium [ Julian Andres Klode ] diff --git a/doc/apt-ftparchive.1.xml b/doc/apt-ftparchive.1.xml index 8c424dbce..705f416eb 100644 --- a/doc/apt-ftparchive.1.xml +++ b/doc/apt-ftparchive.1.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; - 2016-08-04T00:00:00Z + 2016-08-06T00:00:00Z diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml index 48811bba3..20555b77e 100644 --- a/doc/apt-get.8.xml +++ b/doc/apt-get.8.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; - 2016-08-04T00:00:00Z + 2016-08-06T00:00:00Z diff --git a/doc/apt-secure.8.xml b/doc/apt-secure.8.xml index 1cc8a8f24..550308282 100644 --- a/doc/apt-secure.8.xml +++ b/doc/apt-secure.8.xml @@ -13,7 +13,7 @@ &apt-email; &apt-product; - 2016-08-04T00:00:00Z + 2016-08-06T00:00:00Z diff --git a/doc/apt-verbatim.ent b/doc/apt-verbatim.ent index 9febadf9f..5a34fbc34 100644 --- a/doc/apt-verbatim.ent +++ b/doc/apt-verbatim.ent @@ -239,7 +239,7 @@ "> - + diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index bb0625f66..09db5a0e0 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -19,7 +19,7 @@ &apt-email; &apt-product; - 2016-08-05T00:00:00Z + 2016-08-06T00:00:00Z diff --git a/doc/po/apt-doc.pot b/doc/po/apt-doc.pot index 5d256f4d1..b712e176b 100644 --- a/doc/po/apt-doc.pot +++ b/doc/po/apt-doc.pot @@ -5,9 +5,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: apt-doc 1.3~pre3\n" +"Project-Id-Version: apt-doc 1.3~pre3+cmake2\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/doc/po/de.po b/doc/po/de.po index d1ef79808..88047a569 100644 --- a/doc/po/de.po +++ b/doc/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.8\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2014-09-14 14:46+0200\n" "Last-Translator: Chris Leick \n" "Language-Team: German \n" diff --git a/doc/po/es.po b/doc/po/es.po index b14ff8af0..2aa105681 100644 --- a/doc/po/es.po +++ b/doc/po/es.po @@ -38,7 +38,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2014-07-04 01:31+0200\n" "Last-Translator: Omar Campagne \n" "Language-Team: Debian l10n Spanish \n" diff --git a/doc/po/fr.po b/doc/po/fr.po index b4affe730..7b6f6e3bf 100644 --- a/doc/po/fr.po +++ b/doc/po/fr.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2014-11-15 17:26+0100\n" "Last-Translator: Jean-Pierre Giraud \n" "Language-Team: French \n" diff --git a/doc/po/it.po b/doc/po/it.po index 1a6f662d7..f9ab374a0 100644 --- a/doc/po/it.po +++ b/doc/po/it.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2015-12-27 21:26+0200\n" "Last-Translator: Beatrice Torracca \n" "Language-Team: Italian \n" diff --git a/doc/po/ja.po b/doc/po/ja.po index 3085c2c9c..9626d974f 100644 --- a/doc/po/ja.po +++ b/doc/po/ja.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.6\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2016-03-23 09:39+0900\n" "Last-Translator: Takuma Yamada \n" "Language-Team: Japanese \n" diff --git a/doc/po/nl.po b/doc/po/nl.po index ebeccb410..a41dcb43f 100644 --- a/doc/po/nl.po +++ b/doc/po/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.1.10-nl\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2016-02-01 16:17+0100\n" "Last-Translator: Frans Spiesschaert \n" "Language-Team: Debian Dutch l10n Team \n" diff --git a/doc/po/pl.po b/doc/po/pl.po index aa08ef69f..cc5234480 100644 --- a/doc/po/pl.po +++ b/doc/po/pl.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2014-07-04 02:13+0200\n" "Last-Translator: Robert Luberda \n" "Language-Team: Polish \n" diff --git a/doc/po/pt.po b/doc/po/pt.po index 332c169ba..ef6d97e49 100644 --- a/doc/po/pt.po +++ b/doc/po/pt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.7\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2014-08-29 00:34+0100\n" "Last-Translator: Américo Monteiro \n" "Language-Team: Portuguese \n" diff --git a/doc/po/pt_BR.po b/doc/po/pt_BR.po index c3754fd37..d912d9723 100644 --- a/doc/po/pt_BR.po +++ b/doc/po/pt_BR.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team \n" -"POT-Creation-Date: 2016-08-06 22:20+0200\n" +"POT-Creation-Date: 2016-08-06 23:20+0200\n" "PO-Revision-Date: 2004-09-20 17:02+0000\n" "Last-Translator: André Luís Lopes \n" "Language-Team: \n" diff --git a/doc/sources.list.5.xml b/doc/sources.list.5.xml index 3191cde17..8fdc8eedb 100644 --- a/doc/sources.list.5.xml +++ b/doc/sources.list.5.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; - 2016-08-04T00:00:00Z + 2016-08-06T00:00:00Z -- cgit v1.2.3 From 1ed5f97952d3a7b722bd73992c92769ec0efc67c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 00:22:44 +0200 Subject: CMake: Use find_package() for curl instead of pkg_check_modules() No need to involve pkg-config when CMake has builtin support Gbp-Dch: ignore --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e01fdbed5..44b301cc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ endif() # apt-transport-https dependencies -pkg_check_modules(CURL libcurl REQUIRED) +find_package(CURL REQUIRED) if (CURL_FOUND) set(HAVE_CURL 1) endif() -- cgit v1.2.3 From 79635b696b1ca113d0527d4afe96908eada5cc48 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 03:32:12 +0200 Subject: vendor/getinfo: Accept --vendor VENDOR option This can be used to query a field for a specific vendor. It also speeds up things a lot if we can cache the current vendor in cmake and pass it to further getinfo invocations. Gbp-Dch: ignore --- vendor/getinfo | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vendor/getinfo b/vendor/getinfo index 504b086af..37e0c1480 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -36,7 +36,13 @@ getcurrent() { return 0 } -INFO="$(readlink -f "${BASEDIR}/$(getcurrent)/apt-vendor.ent")" +if [ "$1" = "--vendor" ]; then + CURRENT_VENDOR="$2" + shift 2 +else + CURRENT_VENDOR=$(getcurrent) +fi +INFO="$(readlink -f "${BASEDIR}/$CURRENT_VENDOR/apt-vendor.ent")" VERBATIM="${BASEDIR}/../doc/apt-verbatim.ent" if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then @@ -59,7 +65,7 @@ debian-stable-codename|debian-oldstable-codename|debian-testing-codename|ubuntu- getrawfield "$1" "$VERBATIM" ;; sourceslist-list-format|keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) - exec $0 'vendor' "$@" + exec $0 --vendor $CURRENT_VENDOR 'vendor' "$@" ;; vendor) getfield "$2" @@ -67,9 +73,8 @@ vendor) verbatim) getfield "$2" "$VERBATIM" ;; - current) - getcurrent + echo $CURRENT_VENDOR ;; *) echo >&2 "Unknown data field $1 requested" -- cgit v1.2.3 From 0fead28404498f42324dd86b4246d35af8905ed3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 03:33:11 +0200 Subject: CMake: Cache CURRENT_VENDOR and make it configurable Cache the current vendor, so we do not have to rerun getinfo when reconfiguring stuff. This also has the nice effect of making the vendor configurable, so you can manually specify it on a platform that might not have dpkg (not that building without dpkg works yet). Gbp-Dch: ignore --- vendor/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index 72aad49e1..8246c725a 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -1,9 +1,13 @@ # Determine the current vendor, export to CURRENT_VENDOR -execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current - OUTPUT_VARIABLE CURRENT_VENDOR OUTPUT_STRIP_TRAILING_WHITESPACE) -set(CURRENT_VENDOR ${CURRENT_VENDOR} PARENT_SCOPE) +if (NOT DEFINED CURRENT_VENDOR) + execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current + OUTPUT_VARIABLE CURRENT_VENDOR_OUT OUTPUT_STRIP_TRAILING_WHITESPACE) -message(STATUS "Detected vendor: ${CURRENT_VENDOR}") + set(CURRENT_VENDOR "${CURRENT_VENDOR_OUT}" CACHE STRING "Select the system vendor") + message(STATUS "Detected vendor: ${CURRENT_VENDOR_OUT}") +else() + message(STATUS "Detected vendor: ${CURRENT_VENDOR} (cached)") +endif() # Handle sources.list example add_vendor_file(OUTPUT sources.list -- cgit v1.2.3 From 7d33e7c79cd6c3f0f053d13532ca73ce3bf7c5ce Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 03:34:18 +0200 Subject: CMake: Improve handling of vendor files First of all, instead of creating the files at configure time, generate the files using normal target. This has the huge advantage that they are rebuilt if their input changes. While we are at it, also add dependencies on the vendor entity files. This also fixes the path to the vendor script, which was given relatively before, which obviously won't work when running from inside a deeper subdirectory. To speed things up, pass the --vendor option to getinfo, so we do not have to find out the current vendor in getinfo all over again. Gbp-Dch: ignore --- CMake/Misc.cmake | 30 ++++++++++++++++++++++-------- CMake/vendor_substitute.cmake | 8 ++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 CMake/vendor_substitute.cmake diff --git a/CMake/Misc.cmake b/CMake/Misc.cmake index 584a4da2a..3329fc20f 100644 --- a/CMake/Misc.cmake +++ b/CMake/Misc.cmake @@ -24,16 +24,30 @@ function(add_vendor_file) set(oneValueArgs OUTPUT INPUT MODE) set(multiValueArgs VARIABLES) cmake_parse_arguments(AVF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - message(STATUS "Configuring vendor file ${AVF_OUTPUT}") - FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/${AVF_INPUT} input) - foreach(variable ${AVF_VARIABLES}) - execute_process(COMMAND ../vendor/getinfo ${variable} OUTPUT_VARIABLE value OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "&${variable};" "${value}" input "${input}") - endforeach() - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${AVF_OUTPUT} "${input}") + set(in ${CMAKE_CURRENT_SOURCE_DIR}/${AVF_INPUT}) + set(out ${CMAKE_CURRENT_BINARY_DIR}/${AVF_OUTPUT}) + + add_custom_command( + OUTPUT ${out} + COMMAND ${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} + "-DVARS=${AVF_VARIABLES}" + -DCURRENT_VENDOR=${CURRENT_VENDOR} + -DIN=${in} + -DOUT=${out} + -P ${PROJECT_SOURCE_DIR}/CMake/vendor_substitute.cmake + COMMAND chmod ${AVF_MODE} ${out} + DEPENDS ${in} + ${PROJECT_SOURCE_DIR}/doc/apt-verbatim.ent + ${PROJECT_SOURCE_DIR}/vendor/${CURRENT_VENDOR}/apt-vendor.ent + ${PROJECT_SOURCE_DIR}/vendor/getinfo + ${PROJECT_SOURCE_DIR}/CMake/vendor_substitute.cmake + VERBATIM + ) - execute_process(COMMAND chmod ${AVF_MODE} ${CMAKE_CURRENT_BINARY_DIR}/${AVF_OUTPUT}) + # Woud like to use ${AVF_OUTPUT} as target name, but then ninja gets + # cycles. + add_custom_target(vendor-${AVF_OUTPUT} ALL DEPENDS ${out}) endfunction() # Add symbolic links to a file diff --git a/CMake/vendor_substitute.cmake b/CMake/vendor_substitute.cmake new file mode 100644 index 000000000..71449c9e8 --- /dev/null +++ b/CMake/vendor_substitute.cmake @@ -0,0 +1,8 @@ +file(READ ${IN} input) +foreach(variable ${VARS}) + execute_process(COMMAND ${PROJECT_SOURCE_DIR}/vendor/getinfo + --vendor ${CURRENT_VENDOR} ${variable} + OUTPUT_VARIABLE value OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "&${variable};" "${value}" input "${input}") +endforeach() +file(WRITE ${OUT} "${input}") -- cgit v1.2.3 From 427fc68b2bfcf8fbc37c0443581db6e000cadfee Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 14:24:14 +0200 Subject: CMake: po: Add mirror method I forgot this one, sorry --- po/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 0dd14839c..dc3622156 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -5,7 +5,9 @@ apt_add_translation_domain(apt # Domain apt-helper apt-mark apt-private # Methods - file copy store gpgv cdrom http https ftp rred rsh) + file copy store gpgv cdrom http https ftp rred rsh + mirror +) apt_add_translation_domain(apt-utils # Domain -- cgit v1.2.3 From 33ee08e4dae7851bc3bcbb932a0563c38c933ead Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 15:45:36 +0200 Subject: CMake: Set PACKAGE_MAIL variable This is needed in a lot of places. Also adjust config.h.in to use it instead of the bare email address. Gbp-Dch: ignore --- CMake/config.h.in | 2 +- CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMake/config.h.in b/CMake/config.h.in index 7515fc9a6..3afd9123c 100644 --- a/CMake/config.h.in +++ b/CMake/config.h.in @@ -44,7 +44,7 @@ #define PACKAGE_VERSION "${PACKAGE_VERSION}" /* The mail address to reach upstream */ -#define PACKAGE_MAIL "deity@lists.debian.org" +#define PACKAGE_MAIL "${PACKAGE_MAIL}" #define APT_8_CLEANER_HEADERS #define APT_9_CLEANER_HEADERS diff --git a/CMakeLists.txt b/CMakeLists.txt index 44b301cc2..6baa8f14f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,8 @@ if (CMAKE_USE_PTHREADS_INIT) endif() # Configure some variables like package, version and architecture. -set(PACKAGE "apt") +set(PACKAGE ${PROJECT_NAME}) +set(PACKAGE_MAIL "APT Development Team ") execute_process(COMMAND dpkg-parsechangelog -SVersion -l${PROJECT_SOURCE_DIR}/debian/changelog OUTPUT_VARIABLE PACKAGE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) -- cgit v1.2.3 From ba69ce6d3473debec4b95e02f12670f345c86673 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 13:36:11 +0200 Subject: CMake: Translations: Make po templates depend on input files I wondered why the template was not rebuilt after I changed a file, now I have the answer. Gbp-Dch: ignore --- CMake/Translations.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 2a1e03d4c..3a05d80b0 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -5,6 +5,7 @@ function(apt_add_translation_domain domain) set(targets ${ARGN}) # Build the list of source files of the target set(files "") + set(abs_files "") foreach(target ${targets}) get_target_property(source_dir ${target} SOURCE_DIR) get_target_property(sources ${target} SOURCES) @@ -18,6 +19,7 @@ function(apt_add_translation_domain domain) endif() file(RELATIVE_PATH relfile ${PROJECT_SOURCE_DIR} ${file}) set(files ${files} ${relfile}) + set(abs_files ${abs_files} ${file}) endforeach() target_compile_definitions(${target} PRIVATE -DAPT_DOMAIN="${domain}") @@ -27,6 +29,7 @@ function(apt_add_translation_domain domain) add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.pot COMMAND xgettext --add-comments --foreign -k_ -kN_ -o ${PROJECT_BINARY_DIR}/${domain}.pot ${files} + DEPENDS ${abs_files} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) -- cgit v1.2.3 From 672aa8d90ee1797d74aa3f8fcedc840f578f1d1b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 13:37:15 +0200 Subject: CMake: Translations: Pass some additional arguments to commands This gets rid of the line numbers, adds the plural keyword, and makes msgfmt print statistics, so we know how well translated we are. Gbp-Dch: ignore --- CMake/Translations.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 3a05d80b0..64f5886fb 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -28,6 +28,7 @@ function(apt_add_translation_domain domain) # Create the template for this specific sub-domain add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.pot COMMAND xgettext --add-comments --foreign -k_ -kN_ + --add-location=file --keyword=P_:1,2 -o ${PROJECT_BINARY_DIR}/${domain}.pot ${files} DEPENDS ${abs_files} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} @@ -43,7 +44,7 @@ function(apt_add_translation_domain domain) # Command to merge and compile the messages add_custom_command(OUTPUT ${outdir}/${domain}.mo COMMAND msgmerge -qo - ${file} ${PROJECT_BINARY_DIR}/${domain}.pot | - msgfmt -o ${outdir}/${domain}.mo - + msgfmt --statistics -o ${outdir}/${domain}.mo - DEPENDS ${file} ${PROJECT_BINARY_DIR}/${domain}.pot ) -- cgit v1.2.3 From a331fb701683779d4113c39243f39ffad28cb912 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 15:50:04 +0200 Subject: CMake: Translations: Write a .po file before writing a .mo file This makes debugging things easier. Gbp-Dch: ignore --- CMake/Translations.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 64f5886fb..a26bf1c17 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -42,11 +42,14 @@ function(apt_add_translation_domain domain) set(outdir ${PROJECT_BINARY_DIR}/locale/${langcode}/LC_MESSAGES) file(MAKE_DIRECTORY ${outdir}) # Command to merge and compile the messages - add_custom_command(OUTPUT ${outdir}/${domain}.mo - COMMAND msgmerge -qo - ${file} ${PROJECT_BINARY_DIR}/${domain}.pot | - msgfmt --statistics -o ${outdir}/${domain}.mo - + add_custom_command(OUTPUT ${outdir}/${domain}.po + COMMAND msgmerge -qo ${outdir}/${domain}.po ${file} ${PROJECT_BINARY_DIR}/${domain}.pot DEPENDS ${file} ${PROJECT_BINARY_DIR}/${domain}.pot ) + add_custom_command(OUTPUT ${outdir}/${domain}.mo + COMMAND msgfmt --statistics -o ${outdir}/${domain}.mo ${outdir}/${domain}.po + DEPENDS ${outdir}/${domain}.po + ) set(mofiles ${mofiles} ${outdir}/${domain}.mo) install(FILES ${outdir}/${domain}.mo -- cgit v1.2.3 From 6ff8727a0641b299ac32bc897d3ac1246b02061e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 15:52:59 +0200 Subject: CMake: Translations: Add support for shell scripts Rework the arguments to apt_add_translation_domain so a user can specify TARGETS and SCRIPTS, the latter being Shell scripts. For each language (TARGETS being C++, SCRIPTS being Shell), a separate template is generated via xgettext. Those templates are then merged together by using msgcomm. In case there are no Shell scripts in the translation domain, msgcomm will receive /dev/null instead of a shell translation template. This also reintroduces line numbers, as msgcomm would otherwise re-order the merged files not only by filename, but also by message string. It's unclear why it does that, it could just leave strings within a file alone. In contrast to the old build system, we use xgettext for shell scripts instead of bash --dump-strings, as it's just easier to use the same tool for everything. We also create valid headers. --- CMake/Translations.cmake | 54 ++++++++++++++++++++++++++++++++++++++++++------ README.cmake | 1 - po/CMakeLists.txt | 42 +++++++++++++++++++++---------------- 3 files changed, 72 insertions(+), 25 deletions(-) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index a26bf1c17..1b9781d69 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -1,11 +1,30 @@ # translations.cmake - Translations using APT's translation system. # Copyright (C) 2009, 2016 Julian Andres Klode -function(apt_add_translation_domain domain) - set(targets ${ARGN}) +function(apt_add_translation_domain) + set(options) + set(oneValueArgs DOMAIN) + set(multiValueArgs TARGETS SCRIPTS) + cmake_parse_arguments(NLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # Build the list of source files of the target set(files "") set(abs_files "") + set(scripts "") + set(abs_scripts "") + set(targets ${NLS_TARGETS}) + set(domain ${NLS_DOMAIN}) + foreach(source ${NLS_SCRIPTS}) + string(SUBSTRING ${source} 0 1 init_char) + string(COMPARE EQUAL ${init_char} "/" is_absolute) + if (${is_absolute}) + set(file "${source}") + else() + set(file "${CMAKE_CURRENT_SOURCE_DIR}/${source}") + endif() + file(RELATIVE_PATH relfile ${PROJECT_SOURCE_DIR} ${file}) + list(APPEND scripts ${relfile}) + list(APPEND abs_scripts ${file}) + endforeach() foreach(target ${targets}) get_target_property(source_dir ${target} SOURCE_DIR) get_target_property(sources ${target} SOURCES) @@ -25,15 +44,38 @@ function(apt_add_translation_domain domain) target_compile_definitions(${target} PRIVATE -DAPT_DOMAIN="${domain}") endforeach() - # Create the template for this specific sub-domain - add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.pot + if("${scripts}" STREQUAL "") + set(sh_pot "/dev/null") + else() + set(sh_pot ${PROJECT_BINARY_DIR}/${domain}.sh.pot) + # Create the template for this specific sub-domain + add_custom_command (OUTPUT ${sh_pot} + COMMAND xgettext --add-comments --foreign -L Shell + -o ${sh_pot} ${scripts} + DEPENDS ${abs_scripts} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) + endif() + + + add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.c.pot COMMAND xgettext --add-comments --foreign -k_ -kN_ - --add-location=file --keyword=P_:1,2 - -o ${PROJECT_BINARY_DIR}/${domain}.pot ${files} + --keyword=P_:1,2 + -o ${PROJECT_BINARY_DIR}/${domain}.c.pot ${files} DEPENDS ${abs_files} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) + add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.pot + COMMAND msgcomm --more-than=0 --sort-by-file + ${sh_pot} + ${PROJECT_BINARY_DIR}/${domain}.c.pot + --output=${PROJECT_BINARY_DIR}/${domain}.pot + DEPENDS ${sh_pot} + ${PROJECT_BINARY_DIR}/${domain}.c.pot + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) + # Build .mo files file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") list(SORT translations) diff --git a/README.cmake b/README.cmake index a993b2589..1a4d2a448 100644 --- a/README.cmake +++ b/README.cmake @@ -32,6 +32,5 @@ TODO The following features have not been implemented yet: - Translated docbook guides - - dselect translations - unit tests - update-po diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index dc3622156..c7dfcb0fb 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,22 +1,28 @@ -apt_add_translation_domain(libapt-pkg${APT_PKG_MAJOR} apt-pkg) - -apt_add_translation_domain(apt # Domain - apt apt-cache apt-get apt-config apt-cdrom - apt-helper apt-mark - apt-private - # Methods - file copy store gpgv cdrom http https ftp rred rsh - mirror +apt_add_translation_domain( + DOMAIN libapt-pkg${APT_PKG_MAJOR} + TARGETS apt-pkg ) +apt_add_translation_domain( + DOMAIN apt + TARGETS apt apt-cache apt-get apt-config apt-cdrom apt-helper apt-mark + apt-private + # Methods + file copy store gpgv cdrom http https ftp rred rsh mirror + SCRIPTS ../dselect/install ../dselect/update +) -apt_add_translation_domain(apt-utils # Domain - apt-sortpkgs - apt-extracttemplates - apt-internal-solver - apt-dump-solver - apt-internal-planner - apt-ftparchive) +apt_add_translation_domain( + DOMAIN apt-utils + TARGETS apt-sortpkgs + apt-extracttemplates + apt-internal-solver + apt-dump-solver + apt-internal-planner + apt-ftparchive +) -# Add the translations for libapt-inst, and set the translation domain. -apt_add_translation_domain(libapt-inst${APT_INST_MAJOR} apt-inst) +apt_add_translation_domain( + DOMAIN libapt-inst${APT_INST_MAJOR} + TARGETS apt-inst +) -- cgit v1.2.3 From 9a5537fcc6d3ea98909360636a45bd3cf3aba1d1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 16:01:18 +0200 Subject: CMake: Translations: Build apt-all.pot and update .po files Merge all the per-domain templates into one template file using msgcomm, stripping any line numbers in the input files, and sorting the output per file. This should create reasonably stable .pot and .po files that do not change just because files move around. It should also be resilient against some line changes, as long as one translated line is not moved before/after another translated line. Gbp-Dch: ignore --- CMake/Translations.cmake | 46 ++++++++++++++++++++++++++++++++++++++++++++-- README.cmake | 1 - po/CMakeLists.txt | 10 ++++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 1b9781d69..6a9862005 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -13,6 +13,13 @@ function(apt_add_translation_domain) set(abs_scripts "") set(targets ${NLS_TARGETS}) set(domain ${NLS_DOMAIN}) + set(xgettext_params + --add-comments + --foreign + --package-name=${PROJECT_NAME} + --package-version=${PACKAGE_VERSION} + --msgid-bugs-address=${PACKAGE_MAIL} + ) foreach(source ${NLS_SCRIPTS}) string(SUBSTRING ${source} 0 1 init_char) string(COMPARE EQUAL ${init_char} "/" is_absolute) @@ -50,19 +57,21 @@ function(apt_add_translation_domain) set(sh_pot ${PROJECT_BINARY_DIR}/${domain}.sh.pot) # Create the template for this specific sub-domain add_custom_command (OUTPUT ${sh_pot} - COMMAND xgettext --add-comments --foreign -L Shell + COMMAND xgettext ${xgettext_params} -L Shell -o ${sh_pot} ${scripts} DEPENDS ${abs_scripts} + VERBATIM WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) endif() add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.c.pot - COMMAND xgettext --add-comments --foreign -k_ -kN_ + COMMAND xgettext ${xgettext_params} -k_ -kN_ --keyword=P_:1,2 -o ${PROJECT_BINARY_DIR}/${domain}.c.pot ${files} DEPENDS ${abs_files} + VERBATIM WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) @@ -100,3 +109,36 @@ function(apt_add_translation_domain) add_custom_target(nls-${domain} ALL DEPENDS ${mofiles}) endfunction() + +# Usage: apt_add_update_po(output domain [domain ...]) +function(apt_add_update_po) + set(options) + set(oneValueArgs TEMPLATE) + set(multiValueArgs DOMAINS) + cmake_parse_arguments(NLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(output ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_TEMPLATE}.pot) + foreach(domain ${NLS_DOMAINS}) + list(APPEND potfiles ${PROJECT_BINARY_DIR}/${domain}.pot) + endforeach() + + get_filename_component(master_name ${output} NAME_WE) + add_custom_target(nls-${master_name} + COMMAND msgcomm --sort-by-file --add-location=file + --more-than=0 --output=${output} + ${potfiles} + DEPENDS ${potfiles}) + + file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") + if (NOT TARGET update-po) + add_custom_target(update-po) + endif() + foreach(translation ${translations}) + get_filename_component(langcode ${translation} NAME_WE) + add_custom_target(update-po-${langcode} + COMMAND msgmerge -q --update --backup=none ${translation} ${output} + DEPENDS nls-${master_name} + ) + add_dependencies(update-po update-po-${langcode}) + endforeach() + add_dependencies(update-po nls-${master_name}) +endfunction() diff --git a/README.cmake b/README.cmake index 1a4d2a448..0ffd08efc 100644 --- a/README.cmake +++ b/README.cmake @@ -33,4 +33,3 @@ The following features have not been implemented yet: - Translated docbook guides - unit tests - - update-po diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index c7dfcb0fb..4fdac3959 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -26,3 +26,13 @@ apt_add_translation_domain( DOMAIN libapt-inst${APT_INST_MAJOR} TARGETS apt-inst ) + +apt_add_update_po( + TEMPLATE + apt-all + DOMAINS + libapt-pkg${APT_PKG_MAJOR} + libapt-inst${APT_INST_MAJOR} + apt + apt-utils +) -- cgit v1.2.3 From ddf40a42f5a699086466990f85d86e6c4977524a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 11:58:28 +0200 Subject: CMake: Translations: Add a statistics target This is really useful stuff to have. Gbp-Dch: ignore --- CMake/Translations.cmake | 14 ++++++++++++++ po/CMakeLists.txt | 2 ++ 2 files changed, 16 insertions(+) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 6a9862005..8b657c20f 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -142,3 +142,17 @@ function(apt_add_update_po) endforeach() add_dependencies(update-po nls-${master_name}) endfunction() + +function(apt_add_po_statistics) + add_custom_target(statistics) + file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") + foreach(translation ${translations}) + get_filename_component(langcode ${translation} NAME_WE) + add_custom_command( + TARGET statistics PRE_BUILD + COMMAND printf "%-7s" "${langcode}:" + COMMAND msgfmt --statistics -o /dev/null ${translation} + VERBATIM + ) + endforeach() +endfunction() diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 4fdac3959..92ff39867 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -36,3 +36,5 @@ apt_add_update_po( apt apt-utils ) + +apt_add_po_statistics() -- cgit v1.2.3 From e164341c20625f62a44be16e6f3fbab66334f130 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 13:10:28 +0200 Subject: CMake: Translations: Avoid rebuilding .mo if .pot did not change Use the witness/byproducts approach to build the translations. A byproduct of a command is like an output, but may be older than the input. Here, we generate a normal template with headers in the normal way as a witness (and for Launchpad translations), but we also generate a .pot-tmp0 template file without a header that gets copied to a .pot-tmp byproduct only if it changed. This way, the .pot-tmp is only updated if an actual string translation changed. We also create a custom target for the .pot file that we'll depend on later in the overall target creating the mo files to ensure that the template is build before we try to build mo files. Then we make the msgmerge depend on the .pot-tmp instead of the .pot file, which means that msgmerge and msgfmt only get re-run if a string change occured. Gbp-Dch: ignore --- CMake/Translations.cmake | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 8b657c20f..584c5c5af 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -75,16 +75,32 @@ function(apt_add_translation_domain) WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) + # We are building a ${domain}.pot with a header for launchpad, but we also + # 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. add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.pot + BYPRODUCTS ${PROJECT_BINARY_DIR}/${domain}.pot-tmp COMMAND msgcomm --more-than=0 --sort-by-file ${sh_pot} ${PROJECT_BINARY_DIR}/${domain}.c.pot --output=${PROJECT_BINARY_DIR}/${domain}.pot + COMMAND msgcomm --more-than=0 --omit-header --sort-by-file + ${sh_pot} + ${PROJECT_BINARY_DIR}/${domain}.c.pot + --output=${PROJECT_BINARY_DIR}/${domain}.pot-tmp0 + COMMAND cmake -E copy_if_different + ${PROJECT_BINARY_DIR}/${domain}.pot-tmp0 + ${PROJECT_BINARY_DIR}/${domain}.pot-tmp DEPENDS ${sh_pot} ${PROJECT_BINARY_DIR}/${domain}.c.pot WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) + # We need a target to depend on otherwise, the msgmerge might not get called + # with the make generator + add_custom_target(nls-${domain}-template DEPENDS ${PROJECT_BINARY_DIR}/${domain}.pot) + # Build .mo files file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") list(SORT translations) @@ -92,10 +108,11 @@ function(apt_add_translation_domain) get_filename_component(langcode ${file} NAME_WE) set(outdir ${PROJECT_BINARY_DIR}/locale/${langcode}/LC_MESSAGES) file(MAKE_DIRECTORY ${outdir}) - # Command to merge and compile the messages + # Command to merge and compile the messages. As explained in the custom + # command for msgcomm, this depends on byproduct to avoid reruns add_custom_command(OUTPUT ${outdir}/${domain}.po - COMMAND msgmerge -qo ${outdir}/${domain}.po ${file} ${PROJECT_BINARY_DIR}/${domain}.pot - DEPENDS ${file} ${PROJECT_BINARY_DIR}/${domain}.pot + COMMAND msgmerge -qo ${outdir}/${domain}.po ${file} ${PROJECT_BINARY_DIR}/${domain}.pot-tmp + DEPENDS ${file} ${PROJECT_BINARY_DIR}/${domain}.pot-tmp ) add_custom_command(OUTPUT ${outdir}/${domain}.mo COMMAND msgfmt --statistics -o ${outdir}/${domain}.mo ${outdir}/${domain}.po @@ -107,7 +124,7 @@ function(apt_add_translation_domain) DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${langcode}/LC_MESSAGES") endforeach(file ${translations}) - add_custom_target(nls-${domain} ALL DEPENDS ${mofiles}) + add_custom_target(nls-${domain} ALL DEPENDS ${mofiles} nls-${domain}-template) endfunction() # Usage: apt_add_update_po(output domain [domain ...]) -- cgit v1.2.3 From 32a32d7501ace2859ba097ef8fb7ef665ca2f0ed Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 18:14:41 +0200 Subject: CMake: Translations: Allow excluding languages from translation This seems to be needed for the hebrew translations. Gbp-Dch: ignore --- CMake/Translations.cmake | 23 +++++++++++++++++++---- po/CMakeLists.txt | 12 +++++++++++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 584c5c5af..9880e68c7 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -4,7 +4,7 @@ function(apt_add_translation_domain) set(options) set(oneValueArgs DOMAIN) - set(multiValueArgs TARGETS SCRIPTS) + set(multiValueArgs TARGETS SCRIPTS EXCLUDE_LANGUAGES) cmake_parse_arguments(NLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) # Build the list of source files of the target set(files "") @@ -106,6 +106,9 @@ function(apt_add_translation_domain) list(SORT translations) foreach(file ${translations}) get_filename_component(langcode ${file} NAME_WE) + if ("${langcode}" IN_LIST NLS_EXCLUDE_LANGUAGES) + continue() + endif() set(outdir ${PROJECT_BINARY_DIR}/locale/${langcode}/LC_MESSAGES) file(MAKE_DIRECTORY ${outdir}) # Command to merge and compile the messages. As explained in the custom @@ -131,7 +134,7 @@ endfunction() function(apt_add_update_po) set(options) set(oneValueArgs TEMPLATE) - set(multiValueArgs DOMAINS) + set(multiValueArgs DOMAINS EXCLUDE_LANGUAGES) cmake_parse_arguments(NLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(output ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_TEMPLATE}.pot) foreach(domain ${NLS_DOMAINS}) @@ -151,6 +154,9 @@ function(apt_add_update_po) endif() foreach(translation ${translations}) get_filename_component(langcode ${translation} NAME_WE) + if ("${langcode}" IN_LIST NLS_EXCLUDE_LANGUAGES) + continue() + endif() add_custom_target(update-po-${langcode} COMMAND msgmerge -q --update --backup=none ${translation} ${output} DEPENDS nls-${master_name} @@ -160,14 +166,23 @@ function(apt_add_update_po) add_dependencies(update-po nls-${master_name}) endfunction() -function(apt_add_po_statistics) +function(apt_add_po_statistics excluded) add_custom_target(statistics) file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") foreach(translation ${translations}) get_filename_component(langcode ${translation} NAME_WE) + if ("${langcode}" IN_LIST excluded) + add_custom_command( + TARGET statistics PRE_BUILD + COMMAND printf "%-6s " "${langcode}:" + COMMAND echo "ignored" + VERBATIM + ) + continue() + endif() add_custom_command( TARGET statistics PRE_BUILD - COMMAND printf "%-7s" "${langcode}:" + COMMAND printf "%-6s " "${langcode}:" COMMAND msgfmt --statistics -o /dev/null ${translation} VERBATIM ) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index 92ff39867..174cc5d41 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,6 +1,11 @@ +set(languages_excluded + he ## disabled by translator request #313283 +) + apt_add_translation_domain( DOMAIN libapt-pkg${APT_PKG_MAJOR} TARGETS apt-pkg + EXCLUDE_LANGUAGES ${languages_excluded} ) apt_add_translation_domain( @@ -10,6 +15,7 @@ apt_add_translation_domain( # Methods file copy store gpgv cdrom http https ftp rred rsh mirror SCRIPTS ../dselect/install ../dselect/update + EXCLUDE_LANGUAGES ${languages_excluded} ) apt_add_translation_domain( @@ -20,11 +26,13 @@ apt_add_translation_domain( apt-dump-solver apt-internal-planner apt-ftparchive + EXCLUDE_LANGUAGES ${languages_excluded} ) apt_add_translation_domain( DOMAIN libapt-inst${APT_INST_MAJOR} TARGETS apt-inst + EXCLUDE_LANGUAGES ${languages_excluded} ) apt_add_update_po( @@ -35,6 +43,8 @@ apt_add_update_po( libapt-inst${APT_INST_MAJOR} apt apt-utils + EXCLUDE_LANGUAGES + ${languages_excluded} ) -apt_add_po_statistics() +apt_add_po_statistics("${languages_excluded}") -- cgit v1.2.3 From 173fa882cf3396ab6d2a9be53c6ea23eda225a1d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 21:52:08 +0200 Subject: CMake: Translations: Build .pot in po binary dir, not project one This was cluttering up things all over the place. Gbp-Dch: ignore --- CMake/Translations.cmake | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 9880e68c7..7bdcab6ab 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -54,7 +54,7 @@ function(apt_add_translation_domain) if("${scripts}" STREQUAL "") set(sh_pot "/dev/null") else() - set(sh_pot ${PROJECT_BINARY_DIR}/${domain}.sh.pot) + set(sh_pot ${CMAKE_CURRENT_BINARY_DIR}/${domain}.sh.pot) # Create the template for this specific sub-domain add_custom_command (OUTPUT ${sh_pot} COMMAND xgettext ${xgettext_params} -L Shell @@ -66,10 +66,10 @@ function(apt_add_translation_domain) endif() - add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.c.pot + add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot COMMAND xgettext ${xgettext_params} -k_ -kN_ --keyword=P_:1,2 - -o ${PROJECT_BINARY_DIR}/${domain}.c.pot ${files} + -o ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot ${files} DEPENDS ${abs_files} VERBATIM WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} @@ -79,27 +79,27 @@ 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. - add_custom_command (OUTPUT ${PROJECT_BINARY_DIR}/${domain}.pot - BYPRODUCTS ${PROJECT_BINARY_DIR}/${domain}.pot-tmp + 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} - ${PROJECT_BINARY_DIR}/${domain}.c.pot - --output=${PROJECT_BINARY_DIR}/${domain}.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 ${sh_pot} - ${PROJECT_BINARY_DIR}/${domain}.c.pot - --output=${PROJECT_BINARY_DIR}/${domain}.pot-tmp0 + ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot + --output=${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp0 COMMAND cmake -E copy_if_different - ${PROJECT_BINARY_DIR}/${domain}.pot-tmp0 - ${PROJECT_BINARY_DIR}/${domain}.pot-tmp + ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp0 + ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp DEPENDS ${sh_pot} - ${PROJECT_BINARY_DIR}/${domain}.c.pot + ${CMAKE_CURRENT_BINARY_DIR}/${domain}.c.pot WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) # We need a target to depend on otherwise, the msgmerge might not get called # with the make generator - add_custom_target(nls-${domain}-template DEPENDS ${PROJECT_BINARY_DIR}/${domain}.pot) + add_custom_target(nls-${domain}-template DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot) # Build .mo files file(GLOB translations "${PROJECT_SOURCE_DIR}/po/*.po") @@ -109,13 +109,13 @@ function(apt_add_translation_domain) if ("${langcode}" IN_LIST NLS_EXCLUDE_LANGUAGES) continue() endif() - set(outdir ${PROJECT_BINARY_DIR}/locale/${langcode}/LC_MESSAGES) + set(outdir ${CMAKE_CURRENT_BINARY_DIR}/locale/${langcode}/LC_MESSAGES) file(MAKE_DIRECTORY ${outdir}) # Command to merge and compile the messages. As explained in the custom # command for msgcomm, this depends on byproduct to avoid reruns add_custom_command(OUTPUT ${outdir}/${domain}.po - COMMAND msgmerge -qo ${outdir}/${domain}.po ${file} ${PROJECT_BINARY_DIR}/${domain}.pot-tmp - DEPENDS ${file} ${PROJECT_BINARY_DIR}/${domain}.pot-tmp + COMMAND msgmerge -qo ${outdir}/${domain}.po ${file} ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp + DEPENDS ${file} ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot-tmp ) add_custom_command(OUTPUT ${outdir}/${domain}.mo COMMAND msgfmt --statistics -o ${outdir}/${domain}.mo ${outdir}/${domain}.po @@ -138,7 +138,7 @@ function(apt_add_update_po) cmake_parse_arguments(NLS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) set(output ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_TEMPLATE}.pot) foreach(domain ${NLS_DOMAINS}) - list(APPEND potfiles ${PROJECT_BINARY_DIR}/${domain}.pot) + list(APPEND potfiles ${CMAKE_CURRENT_BINARY_DIR}/${domain}.pot) endforeach() get_filename_component(master_name ${output} NAME_WE) -- cgit v1.2.3 From 06c2b40b9b9094f4f6391bd1d17cfc3725313070 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 18:22:14 +0200 Subject: CMake: Add unit tests Add support for our GTest based unit tests. By default, CMake will look in /usr/src/gtest for the external GTest project, but this can be overriden by defining GTEST_ROOT when invoking cmake. Gbp-Dch: ignore --- .travis.yml | 1 + CMakeLists.txt | 2 ++ README.cmake | 1 - test/CMakeLists.txt | 1 + test/libapt/CMakeLists.txt | 22 ++++++++++++++++++++++ test/libapt/fileutl_test.cc | 2 +- test/libapt/hashsums_test.cc | 14 +++++++------- 7 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 test/libapt/CMakeLists.txt diff --git a/.travis.yml b/.travis.yml index 755640831..3c4b59319 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ before_script: - ( mkdir build && cd build && cmake .. ) - make -C build -j4 script: + - make -C build test - ./test/integration/run-tests -q - sudo adduser --force-badname --system --home /nonexistent --no-create-home --quiet _apt || true - sudo ./test/integration/run-tests -q diff --git a/CMakeLists.txt b/CMakeLists.txt index 6baa8f14f..9e85e7b84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ project(apt) cmake_minimum_required(VERSION 3.3.0) +enable_testing() + option(WITH_DOC "Build documentation." OFF) option(USE_NLS "Localisation support." ON) diff --git a/README.cmake b/README.cmake index 0ffd08efc..5afe0449f 100644 --- a/README.cmake +++ b/README.cmake @@ -32,4 +32,3 @@ TODO The following features have not been implemented yet: - Translated docbook guides - - unit tests diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 599f62aff..2f47b5c32 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1 +1,2 @@ +add_subdirectory(libapt) add_subdirectory(interactive-helper) diff --git a/test/libapt/CMakeLists.txt b/test/libapt/CMakeLists.txt new file mode 100644 index 000000000..7f9990526 --- /dev/null +++ b/test/libapt/CMakeLists.txt @@ -0,0 +1,22 @@ +include(ExternalProject) + +set(GTEST_ROOT "/usr/src/gtest" CACHE FILEPATH "Path to GTest CMake project") + +message(STATUS "Found GTest at ${GTEST_ROOT}") + +if (EXISTS ${GTEST_ROOT}) + +ExternalProject_Add(gtest PREFIX ./gtest + SOURCE_DIR ${GTEST_ROOT} + INSTALL_COMMAND true) + +link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build) +FILE(GLOB files gtest_runner.cc *-helpers.cc *_test.cc) +add_executable(libapt_test ${files}) +target_link_libraries(libapt_test -lgtest ${CMAKE_THREAD_LIBS_INIT} apt-private apt-inst) +add_dependencies(libapt_test gtest) +add_test(NAME AptTests + COMMAND libapt_test + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + +endif() diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index 0a299b51a..67bd850a1 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -216,7 +216,7 @@ TEST(FileUtlTest, Glob) { std::vector files; // normal match - files = Glob("*akefile"); + files = Glob("*MakeLists.txt"); EXPECT_EQ(1, files.size()); // not there diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index 705c0297d..fb9a25643 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -119,7 +119,7 @@ static void getSummationString(char const * const type, std::string &sum) FileFd fd; ASSERT_TRUE(fd.Open(tempfile, FileFd::WriteOnly | FileFd::Empty, compress)); ASSERT_TRUE(fd.IsOpen()); - FileFd input(__FILE__, FileFd::ReadOnly); + FileFd input("/etc/os-release", FileFd::ReadOnly); ASSERT_TRUE(input.IsOpen()); ASSERT_NE(0, input.FileSize()); ASSERT_TRUE(CopyFile(input, fd)); @@ -161,7 +161,7 @@ TEST(HashSumsTest, FileBased) SHA512SumValue sha512(summation); EXPECT_EQ(sha512.Value(), summation); - FileFd fd(__FILE__, FileFd::ReadOnly); + FileFd fd("/etc/os-release", FileFd::ReadOnly); EXPECT_TRUE(fd.IsOpen()); std::string FileSize; strprintf(FileSize, "%llu", fd.FileSize()); @@ -243,18 +243,18 @@ TEST(HashSumsTest, FileBased) fd.Close(); HashString sha2file("SHA512", sha512.Value()); - EXPECT_TRUE(sha2file.VerifyFile(__FILE__)); + EXPECT_TRUE(sha2file.VerifyFile("/etc/os-release")); HashString sha2wrong("SHA512", "00000000000"); - EXPECT_FALSE(sha2wrong.VerifyFile(__FILE__)); + EXPECT_FALSE(sha2wrong.VerifyFile("/etc/os-release")); EXPECT_EQ(sha2file, sha2file); EXPECT_TRUE(sha2file == sha2file); EXPECT_NE(sha2file, sha2wrong); EXPECT_TRUE(sha2file != sha2wrong); HashString sha2big("SHA256", sha256.Value()); - EXPECT_TRUE(sha2big.VerifyFile(__FILE__)); + EXPECT_TRUE(sha2big.VerifyFile("/etc/os-release")); HashString sha2small("sha256:" + sha256.Value()); - EXPECT_TRUE(sha2small.VerifyFile(__FILE__)); + EXPECT_TRUE(sha2small.VerifyFile("/etc/os-release")); EXPECT_EQ(sha2big, sha2small); EXPECT_TRUE(sha2big == sha2small); EXPECT_FALSE(sha2big != sha2small); @@ -283,7 +283,7 @@ TEST(HashSumsTest, FileBased) EXPECT_EQ(2, hashes.size()); EXPECT_FALSE(hashes.push_back(sha2wrong)); EXPECT_EQ(2, hashes.size()); - EXPECT_TRUE(hashes.VerifyFile(__FILE__)); + EXPECT_TRUE(hashes.VerifyFile("/etc/os-release")); EXPECT_EQ(similar, hashes); EXPECT_TRUE(similar == hashes); -- cgit v1.2.3 From 7c317e9e90ccbaaab88550f69b902e88e379055c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 11:31:06 +0200 Subject: debian: make autopkgtest run with CMake build dir --- debian/tests/run-tests | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/debian/tests/run-tests b/debian/tests/run-tests index d2fa915b8..277594108 100644 --- a/debian/tests/run-tests +++ b/debian/tests/run-tests @@ -2,17 +2,18 @@ set -e -# we need the buildin webserver for the tests -if [ ! -e environment.mak ]; then - make startup +if [ ! -e build/CMakeCache.txt ]; then + mkdir build || true + ( cd build && cmake .. ) fi -make -C test/interactive-helper/ + +make -C build/test/interactive-helper # run tests against the installed apt, use "env -i" to ensure # the host env does not pollute our environment env -i \ APT_INTEGRATION_TESTS_SOURCE_DIR=$(pwd) \ -APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \ +APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/test/interactive-helper \ APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \ APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \ APT_INTEGRATION_TESTS_INTERNAL_SOLVER=/usr/lib/apt/solvers/apt \ -- cgit v1.2.3 From 4924e4686cd9f4839993620e1726995f732216e8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 14:16:36 +0200 Subject: CMake: Bump minimum required version to 3.4.0 The SOURCE_DIR property is used for the translation building and was introduced in cmake 3.4 --- CMakeLists.txt | 2 +- debian/control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e85e7b84..9082118fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # set minimum version project(apt) -cmake_minimum_required(VERSION 3.3.0) +cmake_minimum_required(VERSION 3.4.0) enable_testing() diff --git a/debian/control b/debian/control index 2c2fc8085..bc118b52d 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Build-Depends: dpkg-dev (>= 1.17.14), debhelper (>= 9.20141010), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.4~), zlib1g-dev, libbz2-dev, liblzma-dev, liblz4-dev (>= 0.0~r126), xsltproc, docbook-xsl, docbook-xml, po4a (>= 0.34-2), - cmake, pkg-config, libgtest-dev , dh-systemd + cmake (>= 3.4), pkg-config, libgtest-dev , dh-systemd Build-Depends-Indep: doxygen, w3m, graphviz Build-Conflicts: autoconf2.13, automake1.4 Vcs-Git: https://anonscm.debian.org/git/apt/apt.git -- cgit v1.2.3 From 3093c60f4995c4b37ace3901951b9f244b6d416c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 14:35:09 +0200 Subject: CMake: Allow building without dpkg It's not entirely clear if that is useful, but it cannot hurt. We need to check what is missing to build on foreign systems without dpkg. Gbp-Dch: ignore --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9082118fe..254e34869 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,10 +113,14 @@ endif() set(PACKAGE ${PROJECT_NAME}) set(PACKAGE_MAIL "APT Development Team ") -execute_process(COMMAND dpkg-parsechangelog -SVersion -l${PROJECT_SOURCE_DIR}/debian/changelog - OUTPUT_VARIABLE PACKAGE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) -execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH - OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) +if (NOT DEFINED PACKAGE_VERSION) + execute_process(COMMAND dpkg-parsechangelog -SVersion -l${PROJECT_SOURCE_DIR}/debian/changelog + OUTPUT_VARIABLE PACKAGE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() +if (NOT DEFINED COMMON_ARCH) + execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH + OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() # Configure our configuration headers (config.h and apti18n.h) configure_file(CMake/config.h.in ${PROJECT_BINARY_DIR}/include/config.h) -- cgit v1.2.3 From 8c1dbbef35bea4082eacfe4e626e7726b9e84349 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 14:56:53 +0200 Subject: CMake: Check for ptsname_r() again This was dropped in autotools as I found no use of the HAVE_PTSNAME_R macro. Turns out it was typoed as HAVE_PTS_NAME_R. Fix the #ifdef and add checks to CMake for it. Closes: #833674 --- CMake/config.h.in | 3 +++ CMakeLists.txt | 1 + apt-pkg/deb/dpkgpm.cc | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMake/config.h.in b/CMake/config.h.in index 3afd9123c..e929646fa 100644 --- a/CMake/config.h.in +++ b/CMake/config.h.in @@ -34,6 +34,9 @@ #cmakedefine HAVE_SETRESUID #cmakedefine HAVE_SETRESGID +/* Check for ptsname_r() */ +#cmakedefine HAVE_PTSNAME_R + /* Define the arch name string */ #define COMMON_ARCH "${COMMON_ARCH}" diff --git a/CMakeLists.txt b/CMakeLists.txt index 254e34869..7e432bca3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,7 @@ check_function_exists(getresuid HAVE_GETRESUID) check_function_exists(getresgid HAVE_GETRESGID) check_function_exists(setresuid HAVE_SETRESUID) check_function_exists(setresgid HAVE_SETRESGID) +check_function_exists(ptsname_r HAVE_PTSNAME_R) check_function_exists(timegm HAVE_TIMEGM) test_big_endian(WORDS_BIGENDIAN) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index c1b9a28f4..ccfc77d6a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1086,7 +1086,7 @@ void pkgDPkgPM::StartPtyMagic() /*{{{*/ _error->Errno("unlockpt", "Unlocking the slave of master fd %d failed!", d->master); else { -#ifdef HAVE_PTS_NAME_R +#ifdef HAVE_PTSNAME_R char slave_name[64]; // 64 is used by bionic if (ptsname_r(d->master, slave_name, sizeof(slave_name)) != 0) #else -- cgit v1.2.3 From 0d04a4987feb9ec45ddfa03270e20f76cae02a84 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 21:53:05 +0200 Subject: CMake: Misc: Extract command path_join() from Translations This abstracts the joining of paths a bit better than having basically the same code twice in the Translations module. Gbp-Dch: ignore --- CMake/Misc.cmake | 9 +++++++++ CMake/Translations.cmake | 16 ++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/CMake/Misc.cmake b/CMake/Misc.cmake index 3329fc20f..79587b068 100644 --- a/CMake/Misc.cmake +++ b/CMake/Misc.cmake @@ -77,3 +77,12 @@ function(add_version_script target) target_link_libraries(${target} PRIVATE -Wl,-version-script="${script}") add_dependencies(${target} ${target}-versionscript) endfunction() + +function(path_join out path1 path2) + string(SUBSTRING ${path2} 0 1 init_char) + if ("${init_char}" STREQUAL "/") + set(${out} "${path2}" PARENT_SCOPE) + else() + set(${out} "${path1}/${path2}" PARENT_SCOPE) + endif() +endfunction() diff --git a/CMake/Translations.cmake b/CMake/Translations.cmake index 7bdcab6ab..509e4e378 100644 --- a/CMake/Translations.cmake +++ b/CMake/Translations.cmake @@ -21,13 +21,7 @@ function(apt_add_translation_domain) --msgid-bugs-address=${PACKAGE_MAIL} ) foreach(source ${NLS_SCRIPTS}) - string(SUBSTRING ${source} 0 1 init_char) - string(COMPARE EQUAL ${init_char} "/" is_absolute) - if (${is_absolute}) - set(file "${source}") - else() - set(file "${CMAKE_CURRENT_SOURCE_DIR}/${source}") - endif() + path_join(file "${CMAKE_CURRENT_SOURCE_DIR}" "${source}") file(RELATIVE_PATH relfile ${PROJECT_SOURCE_DIR} ${file}) list(APPEND scripts ${relfile}) list(APPEND abs_scripts ${file}) @@ -36,13 +30,7 @@ function(apt_add_translation_domain) get_target_property(source_dir ${target} SOURCE_DIR) get_target_property(sources ${target} SOURCES) foreach(source ${sources}) - string(SUBSTRING ${source} 0 1 init_char) - string(COMPARE EQUAL ${init_char} "/" is_absolute) - if (${is_absolute}) - set(file "${source}") - else() - set(file "${source_dir}/${source}") - endif() + path_join(file "${source_dir}" "${source}") file(RELATIVE_PATH relfile ${PROJECT_SOURCE_DIR} ${file}) set(files ${files} ${relfile}) set(abs_files ${abs_files} ${file}) -- cgit v1.2.3 From 10ec2d23f14cf5d3e4835d9bcb57d0937f803e6a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 21:53:46 +0200 Subject: CMake: Rewrite existing Documentation support and add doxygen This can now build all documentation. It should also be fairly reusable for other projects, as long as they follow the same naming scheme for the po4a output files and set the PACKAGE_* variables used here. We could have done all translations in a single call to po4a like the makefile based buildsystem does. While that would have made the output slightly nicer, this solution offers a huge performance gain because it can translate the documents in parallel, which also means that the xsltproc stage does not have to wait for all translations to be done first. You might think that the add_custom_command() should list the actual output files as BYPRODUCTS. This is not true however: Because the files are not always generated, Ninja will think missing byproducts mean that the target is out of date - which is not what we want. Finally, also add the missing doxygen support. Note that the packaging script cleans up some md5 and map files created by doxygen, otherwise it is fairly boring. --- CMake/Documentation.cmake | 335 +++++++++++++++++++++++++++++++++------------- CMake/run_if_exists.sh | 16 +++ CMakeLists.txt | 5 +- README.cmake | 7 - debian/rules | 2 + doc/CMakeLists.txt | 86 ++++++++++-- doc/Doxyfile.in | 12 +- 7 files changed, 346 insertions(+), 117 deletions(-) create mode 100755 CMake/run_if_exists.sh diff --git a/CMake/Documentation.cmake b/CMake/Documentation.cmake index 98e07176b..9e7135ea4 100644 --- a/CMake/Documentation.cmake +++ b/CMake/Documentation.cmake @@ -1,4 +1,7 @@ -# Copyright (C) 2009, 2016 Julian Andres Klode . +# po4a/docbook documentation support for CMake +# - see documentation of add_docbook() +# +# 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 @@ -20,115 +23,263 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -function(add_docbook target sourcefiles installdest) - foreach(file ${sourcefiles}) - get_filename_component(relfile ${file} NAME) - string(REPLACE ".dbk" "" manual ${relfile}) - get_filename_component(absolute ${file} ABSOLUTE) - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html/ - COMMAND xsltproc --nonet --novalid --xinclude - --stringparam base.dir ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html/ - --path ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/${CURRENT_VENDOR}/ - --path ${CMAKE_CURRENT_SOURCE_DIR}/ - ${CMAKE_CURRENT_SOURCE_DIR}/docbook-html-style.xsl - ${absolute} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${file} - ) - set(commands ${commands} ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html) - if (NOT ${installdest} EQUAL "" ) - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${manual}.html - DESTINATION ${installdest}) - endif() - endforeach(file ${sourcefiles}) - add_custom_target(${target} ALL DEPENDS ${commands}) +# 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 +# a two char language code like de, or a 5 char code of the form de_DE. +function(po4a_components doc lang sec ext translated_full_document) + get_filename_component(name ${translated_full_document} NAME) + string(REPLACE "." ";" name "${name}") # Make it a list + + list(GET name 0 _doc) # First element is always the document + list(GET name 1 _lang) # Second *might* be a language + list(GET name -2 _sec) # Second-last *might* be a section + list(GET name -1 _ext) # Last element is always the file type + + # If the language code is neither a file type, nor a section, nor a language + # assume it is part of the file name and use the next component as the lang. + if(_lang AND NOT _lang MATCHES "^(xml|dbk|[0-9]|[a-z][a-z]|[a-z][a-z]_[A-Z][A-Z])$") + set(_doc "${_doc}.${_lang}") + list(GET name 2 _lang) + endif() + # If no language is present, we get a section; both not present => type + if(_lang MATCHES "xml|dbk|[0-9]") + set(_lang "") + endif() + if(NOT _sec MATCHES "^[0-9]$") # A (manpage) section must be a number + set(_sec "") + endif() + + set(${doc} ${_doc} PARENT_SCOPE) + set(${lang} ${_lang} PARENT_SCOPE) + set(${sec} ${_sec} PARENT_SCOPE) + set(${ext} ${_ext} PARENT_SCOPE) endfunction() -function(add_po4a type master po target deps) - add_custom_command(OUTPUT ${target} - COMMAND po4a-translate --keep 0 -f ${type} -m ${master} - -p ${po} -l ${target} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${deps} ${master} ${po}) +# Process one document +function(po4a_one stamp_out out full_document language deps) + path_join(full_path "${CMAKE_CURRENT_SOURCE_DIR}" "${full_document}") + po4a_components(document _ section ext "${full_document}") + + # Calculate target file name + set(dest "${language}/${document}.${language}") + if(section) + set(dest "${dest}.${section}") + endif() + + # po4a might drop files not translated enough, so build a stamp file + set(stamp ${CMAKE_CURRENT_BINARY_DIR}/${dest}.po4a-stamp) + add_custom_command( + OUTPUT ${stamp} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${language} + COMMAND po4a --previous --no-backups + --package-name='${PROJECT}-doc' + --package-version='${PACKAGE_VERSION}' + --msgid-bugs-address='${PACKAGE_MAIL}' + --translate-only ${dest}.${ext} + --srcdir ${CMAKE_CURRENT_SOURCE_DIR} + --destdir ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/po4a.conf + COMMAND ${CMAKE_COMMAND} -E touch ${stamp} + COMMENT "Generating ${dest}.${ext} (or dropping it)" + DEPENDS ${full_document} ${deps} po/${language}.po + ) + # Return result + set(${stamp_out} ${stamp} PARENT_SCOPE) + set(${out} ${CMAKE_CURRENT_BINARY_DIR}/${dest}.${ext} PARENT_SCOPE) endfunction() +function(xsltproc_one) + set(generated "") + set(options HTML TEXT MANPAGE) + set(oneValueArgs STAMP STAMP_OUT FULL_DOCUMENT) + set(multiValueArgs INSTALL DEPENDS) + cmake_parse_arguments(DOC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) -# Macro for XML man pages. -function(add_xml_manpages target manpages translations entities) - foreach(manpage ${manpages}) - string(LENGTH ${manpage} manpage_length) - math(EXPR manpage_length ${manpage_length}-1) - string(SUBSTRING ${manpage} ${manpage_length} 1 section) - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${manpage} - COMMAND xsltproc --path ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/${CURRENT_VENDOR}/ - --path ${CMAKE_CURRENT_SOURCE_DIR}/ - ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl - ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.xml - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.xml - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl - ) + po4a_components(document language section ext "${DOC_FULL_DOCUMENT}") + + # Default parameters + set(params + --nonet + --xinclude + --stringparam chunk.quietly yes + --stringparam man.output.quietly yes + --path ${PROJECT_SOURCE_DIR}/vendor/${CURRENT_VENDOR}/ + --path ${CMAKE_CURRENT_SOURCE_DIR}/ + ) + + # Parameters if localized + if(language) + list(APPEND params -stringparam l10n.gentext.default.language ${language}) + endif() + + path_join(full_input_path ${CMAKE_CURRENT_SOURCE_DIR} ${DOC_FULL_DOCUMENT}) + + if (DOC_MANPAGE) + if (language) + set(manpage_output "${CMAKE_CURRENT_BINARY_DIR}/${language}/${document}.${section}") + else() + set(manpage_output "${CMAKE_CURRENT_BINARY_DIR}/${document}.${section}") + endif() + set(manpage_stylesheet "${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl") + + install(FILES ${manpage_output} + DESTINATION ${CMAKE_INSTALL_MANDIR}/${language}/man${section} + OPTIONAL) + endif() + if (DOC_HTML) + if (language) + set(html_output "${CMAKE_CURRENT_BINARY_DIR}/${language}/${document}.${language}.html") + else() + 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") + install(DIRECTORY ${html_output} + DESTINATION ${DOC_INSTALL} + OPTIONAL) + endif() + if (DOC_TEXT) + if (language) + set(text_output "${CMAKE_CURRENT_BINARY_DIR}/${language}/${document}.${language}.text") + else() + 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(commands ${commands} ${CMAKE_CURRENT_BINARY_DIR}/${manpage}) + file(RELATIVE_PATH text_output_relative ${CMAKE_CURRENT_BINARY_DIR} ${text_output}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${manpage} - DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}) + add_custom_command(OUTPUT ${text_output}.w3m-stamp + COMMAND ${PROJECT_SOURCE_DIR}/CMake/run_if_exists.sh + --stdout ${text_output} + ${text_output}.html + env LC_ALL=C.UTF-8 w3m -cols 78 -dump + -o display_charset=UTF-8 + -no-graph -T text/html ${text_output}.html + COMMAND ${CMAKE_COMMAND} -E touch ${text_output}.w3m-stamp + COMMENT "Generating ${text_output_relative} (if not dropped by po4a)" + DEPENDS "${text_output}.html.xsltproc-stamp" + ) + list(APPEND generated ${text_output}.w3m-stamp) - # Add the translations for the manpage. - foreach(translation ${translations}) - set(entities) - # transdir = shortcut to the output directory for translations. - set(transdir ${CMAKE_CURRENT_BINARY_DIR}/${translation}) + install(FILES ${text_output} + DESTINATION ${DOC_INSTALL} + OPTIONAL) + set(text_output "${text_output}.html") + endif() - add_po4a(docbook ${manpage}.xml po/${translation}.po - ${transdir}/${manpage}.xml "${ent_cmds}") + foreach(type in manpage html text) + if (NOT ${type}_output) + continue() + endif() + set(output ${${type}_output}) + set(stylesheet ${${type}_stylesheet}) + set(type_params ${${type}_params}) + file(RELATIVE_PATH output_relative ${CMAKE_CURRENT_BINARY_DIR} ${output}) - add_custom_command(OUTPUT ${transdir}/${manpage} - COMMAND xsltproc --path ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/${CURRENT_VENDOR}/ - --path ${CMAKE_CURRENT_SOURCE_DIR}/ - --stringparam l10n.gentext.default.language ${translation} - ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl - ${transdir}/${manpage}.xml - WORKING_DIRECTORY ${transdir} - DEPENDS ${transdir}/${manpage}.xml - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/manpage-style.xsl) + add_custom_command(OUTPUT ${output}.xsltproc-stamp + COMMAND ${PROJECT_SOURCE_DIR}/CMake/run_if_exists.sh + ${full_input_path} + xsltproc ${params} ${type_params} -o ${output} + ${stylesheet} + ${full_input_path} + COMMAND ${CMAKE_COMMAND} -E touch ${output}.xsltproc-stamp + COMMENT "Generating ${output_relative} (if not dropped by po4a)" + DEPENDS ${DOC_STAMP} ${DOC_DEPENDS}) - set(nls-cmd ${nls-cmd} ${transdir}/${manpage}) - install(FILES ${transdir}/${manpage} - DESTINATION ${CMAKE_INSTALL_MANDIR}/${translation}/man${section}) + list(APPEND generated ${output}.xsltproc-stamp) + endforeach() + + set(${DOC_STAMP_OUT} ${generated} PARENT_SCOPE) +endfunction() - endforeach(translation ${translations}) - endforeach(manpage ${manpages}) - add_custom_target(${target} ALL DEPENDS ${commands}) - # Sort the list of the translations. - list(SORT nls-cmd) - add_custom_target(nls-${target} ALL DEPENDS ${nls-cmd}) +# add_docbook(Name [ALL] [HTML] [TEXT] [MANPAGE] +# [INSTALL install dir] +# [DEPENDS depend ...] +# [DOCUMENTS documents ...] +# [LINGUAS lingua ...]) +# +# Generate a target called name with all the documents being converted to +# the chosen output formats and translated to the chosen languages using po4a. +# +# For the translation support, the po4a.conf must be written so that +# translations for a document guide.xml are written to LANG/guide.LANG.xml, +# and for a manual page man.5.xml to a file called LANG/man.LANG.5.xml. +# +# The guide and manual page names may also contain a second component separated +# by a dot, it must however not be a valid language code. +# +# Note that po4a might chose not to generate a translated manual page for a +# given language if the translation rate is not high enough. We deal with this +# by creating stamp files. +function(add_docbook target) + set(generated "") + set(options HTML TEXT MANPAGE ALL) + set(multiValueArgs INSTALL DOCUMENTS LINGUAS DEPENDS) + cmake_parse_arguments(DOC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (DOC_HTML) + list(APPEND formats HTML) + endif() + if (DOC_TEXT) + list(APPEND formats TEXT) + endif() + if (DOC_MANPAGE) + list(APPEND formats MANPAGE) + endif() + + foreach(document ${DOC_DOCUMENTS}) + foreach(lang ${DOC_LINGUAS}) + po4a_one(po4a_stamp po4a_out ${document} "${lang}" "${DOC_DEPENDS}") + xsltproc_one(STAMP_OUT xslt_stamp + STAMP ${po4a_stamp} + FULL_DOCUMENT ${po4a_out} + INSTALL ${DOC_INSTALL} + ${formats}) + + list(APPEND stamps ${xslt_stamp}) + endforeach() + xsltproc_one(STAMP_OUT xslt_stamp + STAMP ${document} + FULL_DOCUMENT ${document} + INSTALL ${DOC_INSTALL} + ${formats}) + + list(APPEND stamps ${xslt_stamp}) + endforeach() + + if (DOC_ALL) + add_custom_target(${target} ALL DEPENDS ${stamps}) + else() + add_custom_target(${target} DEPENDS ${stamps}) + endif() endfunction() +# Add an update-po4a target +function(add_update_po4a target pot header) + set(WRITE_HEADER "") -function(add_manpages target manpages translations) - foreach(man ${manpages}) - string(LENGTH ${man} manpage_length) - math(EXPR manpage_length ${manpage_length}-1) - string(SUBSTRING ${man} ${manpage_length} 1 section) - install(FILES ${man} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section}) - - if (USE_NLS) - foreach(translation ${translations}) - set(transdir ${CMAKE_CURRENT_BINARY_DIR}/${translation}) - add_po4a(man ${man} po/${translation}.po ${transdir}/${man} "") - install(FILES ${transdir}/${man} - DESTINATION ${CMAKE_INSTALL_MANDIR}/${translation}/man${section}) - set(files ${files} ${transdir}/${man}) - endforeach(translation ${translations}) - endif() - endforeach(man ${manpages}) - add_custom_target(${target} ALL DEPENDS ${files}) + if (header) + set(WRITE_HEADER + COMMAND sed -n "/^\#$/,$p" ${pot} > ${pot}.headerfree + COMMAND cat ${header} ${pot}.headerfree > ${pot} + COMMAND rm ${pot}.headerfree + ) + endif() + add_custom_target(${target} + COMMAND po4a --previous --no-backups --force --no-translations + --msgmerge-opt --add-location=file + --porefs noline,wrap + --package-name=${PROJECT_NAME}-doc --package-version=${PACKAGE_VERSION} + --msgid-bugs-address=${PACKAGE_MAIL} po4a.conf + ${WRITE_HEADER} + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) endfunction() diff --git a/CMake/run_if_exists.sh b/CMake/run_if_exists.sh new file mode 100755 index 000000000..97edd4c1a --- /dev/null +++ b/CMake/run_if_exists.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Small helper for running a command +out="" +if [ "$1" = "--stdout" ]; then + out="$2" + shift 2 +fi + +if [ -e "$1" ]; then + shift + if [ "$out" ]; then + exec "$@" > $out + else + exec "$@" + fi +fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e432bca3..aed0b506d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.4.0) enable_testing() -option(WITH_DOC "Build documentation." OFF) +option(WITH_DOC "Build documentation." ON) option(USE_NLS "Localisation support." ON) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake") @@ -142,3 +142,6 @@ add_subdirectory(ftparchive) add_subdirectory(methods) add_subdirectory(po) add_subdirectory(test) + +# Link update-po4a into the update-po target +add_dependencies(update-po update-po4a) diff --git a/README.cmake b/README.cmake index 5afe0449f..06db22c96 100644 --- a/README.cmake +++ b/README.cmake @@ -25,10 +25,3 @@ To build a subdirectory; for example, apt-pkg, use one of: Ninja automatically parallelizes, make needs an explicit -j switch. The travis system uses the make generator, the packaging as well. - -TODO ----- - -The following features have not been implemented yet: - - - Translated docbook guides diff --git a/debian/rules b/debian/rules index c1dba72af..9537ecd93 100755 --- a/debian/rules +++ b/debian/rules @@ -15,6 +15,8 @@ override_dh_install-indep: dh_movefiles dh_install --list-missing + find debian/libapt-pkg-doc/usr/share/doc/libapt-pkg-doc/html \( -name '*.md5' -o -name '*.map' \) -delete + override_dh_install-arch: dh_movefiles dh_install --fail-missing diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index bbf5fb046..d54303deb 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,21 +1,85 @@ include(Documentation) -file(GLOB_RECURSE debiandoc-apt guide*.dbk offline*.dbk) -file(GLOB_RECURSE debiandoc-libapt cache*.dbk design*.dbk dpkg-tech*.dbk - files*.dbk method*.dbk) +set(LINGUAS + de + es + fr + it + ja + nl + pl + pt_BR + pt +) +set(ENTITIES + apt.ent + apt-verbatim.ent + ../vendor/${CURRENT_VENDOR}/apt-vendor.ent +) -set(manpages apt.8 apt-cache.8 apt-get.8 apt-cdrom.8 apt.conf.5 sources.list.5 - apt-config.8 apt_preferences.5 apt-sortpkgs.1 apt-ftparchive.1 - apt-extracttemplates.1 apt-key.8 apt-secure.8 apt-mark.8) +if(WITH_DOC) +add_docbook(apt-doc HTML TEXT ALL + DOCUMENTS + guide.dbk + offline.dbk + INSTALL ${CMAKE_INSTALL_DOCDIR}/../apt-doc + LINGUAS ${LINGUAS} + DEPENDS ${ENTITIES} +) + +add_docbook(libapt-pkg-doc HTML TEXT ALL + DOCUMENTS + design.dbk + dpkg-tech.dbk + files.dbk + method.dbk + INSTALL ${CMAKE_INSTALL_DOCDIR}/../libapt-pkg-doc + LINGUAS ${LINGUAS} + DEPENDS ${ENTITIES} +) + +find_package(Doxygen) + +file(GLOB_RECURSE apt_pkg "../apt-pkg/*.h" "../apt-pkg/*.cc") +configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp + COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp + DEPENDS ${apt_pkg} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile +) + +add_custom_target(apt-doxygen ALL + DEPENDS ${PROJECT_BINARY_DIR}/doc/doxygen.stamp +) + +install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/doxygen/html + DESTINATION ${CMAKE_INSTALL_DOCDIR}/../libapt-pkg-doc) -if (WITH_DOC) -add_docbook(debiandoc-apt "${debiandoc-apt}" share/doc/apt-doc) -add_docbook(debiandoc-libapt "${debiandoc-libapt}" share/doc/libapt-pkg-doc) endif() -# Build the manpages, and add translations (ja only for now, others broken) -add_xml_manpages(doc-man "${manpages}" "de;es;fr;it;ja;nl;pl;pt_BR;pt" "apt.ent;apt-verbatim.ent") +add_docbook(apt-man MANPAGE ALL + DOCUMENTS + apt.8.xml + apt-cache.8.xml + apt-cdrom.8.xml + apt.conf.5.xml + apt-config.8.xml + apt-extracttemplates.1.xml + apt-ftparchive.1.xml + apt-get.8.xml + apt-key.8.xml + apt-mark.8.xml + apt_preferences.5.xml + apt-secure.8.xml + apt-sortpkgs.1.xml + sources.list.5.xml + DEPENDS ${ENTITIES} + LINGUAS ${LINGUAS} +) +add_update_po4a(update-po4a po/${PROJECT_NAME}-doc.pot "po/header.pot.txt") add_subdirectory(examples) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index ab3fc0a7c..b6521feb8 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ../build/doc/doxygen +OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/doc/doxygen # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = @top_srcdir@ +STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -161,7 +161,7 @@ STRIP_FROM_PATH = @top_srcdir@ # specify the list of include paths that are normally passed to the compiler # using the -I flag. -STRIP_FROM_INC_PATH = @top_srcdir@ +STRIP_FROM_INC_PATH = @PROJECT_SOURCE_DIR@ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't @@ -754,7 +754,7 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = ../apt-pkg +INPUT = ${PROJECT_SOURCE_DIR}/apt-pkg # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -2057,7 +2057,7 @@ HIDE_UNDOC_RELATIONS = YES # set to NO # The default value is: YES. -HAVE_DOT = @HAVE_DOT@ +HAVE_DOT = @DOXYGEN_DOT_FOUND@ # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of @@ -2231,7 +2231,7 @@ INTERACTIVE_SVG = YES # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = @DOTDIR@ +DOT_PATH = @DOXYGEN_DOT_PATH@ # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile -- cgit v1.2.3 From 66eae02467da6304025d7becc878306a0cd92011 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 22:12:16 +0200 Subject: prepare-release: Switch over to CMake, set version in CMakeLists.txt Teach the prepare-release script about the version new locations and also set the version in CMakeLists, as that is better than reading it from the changelog: CMake would not rerun automatically otherwise if the version changed. Gbp-Dch: ignore --- CMakeLists.txt | 5 +---- prepare-release | 18 +++++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aed0b506d..1f9ca02b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,11 +113,8 @@ endif() # Configure some variables like package, version and architecture. set(PACKAGE ${PROJECT_NAME}) set(PACKAGE_MAIL "APT Development Team ") +set(PACKAGE_VERSION "1.3~pre3+cmake2") -if (NOT DEFINED PACKAGE_VERSION) - execute_process(COMMAND dpkg-parsechangelog -SVersion -l${PROJECT_SOURCE_DIR}/debian/changelog - OUTPUT_VARIABLE PACKAGE_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() if (NOT DEFINED COMMON_ARCH) execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/prepare-release b/prepare-release index 77d8580d9..df1b0a2cf 100755 --- a/prepare-release +++ b/prepare-release @@ -11,7 +11,7 @@ VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p') DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p') LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')" -LIBAPTINSTVERSION="$(grep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)" +LIBAPTINSTVERSION="$(sed -nr 's/set\(MAJOR ([^)]*)\)/\1/p' apt-inst/CMakeLists.txt)" librarysymbolsfromfile() { local MISSING="$(grep '^+#MISSING' "$1")" @@ -53,7 +53,7 @@ if [ "$1" = 'pre-export' ]; then VERSION="$VERSION~$(date +%Y%m%d)" fi - sed -i -e "s/^PACKAGE_VERSION=\".*\"$/PACKAGE_VERSION=\"${VERSION}\"/" configure.ac + sed -i -e "s/^set(PACKAGE_VERSION \".*\")$/set(PACKAGE_VERSION \"${VERSION}\")/" CMakeLists.txt sed -i -e "s/^$//" doc/apt-verbatim.ent # update the last-modification field of manpages based on git changes @@ -68,15 +68,17 @@ Git-Dch: Ignore' "$file")" '+%Y-%m-%dT00:00:00Z')" if [ "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' po/apt-all.pot | cut -d' ' -f 2)" -o \ "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' doc/po/apt-doc.pot | cut -d' ' -f 2)" ]; then echo >&2 'POT files are not up-to-date. Execute »make update-po« for you…' - make update-po + [ -e build ] || mkdir build + ( cd build && cmake .. ) + cmake --build build --target update-po -- -j 4 fi elif [ "$1" = 'pre-build' ]; then if [ "$DISTRIBUTION" = "UNRELEASED" ]; then echo 'BUILDING AN UNRELEASED VERSION' else - CONFVERSION="$(sed -ne "s/^PACKAGE_VERSION=\"\(.*\)\"$/\1/p" configure.ac)" + CONFVERSION="$(sed -ne "s/^set(PACKAGE_VERSION \"\(.*\)\")$/\1/p" CMakeLists.txt)" if [ "$VERSION" != "$CONFVERSION" ]; then - echo "changelog (${VERSION}) and configure (${CONFVERSION}) talk about different versions!" + echo "changelog (${VERSION}) and CMakeLists.txt (${CONFVERSION}) talk about different versions!" echo "You probably want to run »./prepare-release pre-export« to fix this." exit 1 fi @@ -115,9 +117,11 @@ elif [ "$1" = 'post-build' ]; then fi done # lets assume we will always have a german manpage translation - if [ -e 'doc/de/' ]; then + if [ -e */doc/de/ -o -e doc/de ]; then # … but check the translations only with one vendor for translation-specific errors - if ! xmllint --nonet --valid --noout $(find doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then + if ! xmllint --path /vendor/$(./vendor/getinfo current)/ \ + --path doc/ \ + --nonet --valid --noout $(find doc/ */doc/ -mindepth 2 -maxdepth 2 -name '*.xml'); then echo >&2 "WARNING: translated docbook manpages have errors!" fi else -- cgit v1.2.3 From c3dae8787fc803367de6ace5f71f98fc5f1d5b02 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 8 Aug 2016 23:52:14 +0200 Subject: apt-private: Do not include apti18n.h in headers This causes build failures when turning translations off. --- apt-private/private-cachefile.h | 2 -- apt-private/private-cacheset.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 27642e025..77e8b61d9 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -9,8 +9,6 @@ #include #include -#include - // class CacheFile - Cover class for some dependency cache functions /*{{{*/ class APT_PUBLIC CacheFile : public pkgCacheFile { diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index 4a43155fe..37c921081 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -11,8 +11,6 @@ #include #include -#include - class OpProgress; class VerIteratorWithCaching -- cgit v1.2.3 From fb0f82b2fe402cc8e8cb811413ea5d3f87ed9802 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 17:49:46 +0200 Subject: Merge README.cmake into README.md Gbp-Dch: ignore --- README.cmake | 27 --------------------------- README.md | 25 +++++++++++++++---------- 2 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 README.cmake diff --git a/README.cmake b/README.cmake deleted file mode 100644 index 06db22c96..000000000 --- a/README.cmake +++ /dev/null @@ -1,27 +0,0 @@ -The Make System -================ - -To compile this program using cmake you require cmake 3.3 or newer. - -Building --------- -The recommended way is to generate a build directory and build in it, e.g. - - mkdir build - cd build - cmake .. OR cmake -G Ninja .. - make -j4 OR ninja - -You can use either the make or the ninja generator; the ninja stuff is faster, -though. You can also build in-tree: - - cmake -G Ninja - ninja - -To build a subdirectory; for example, apt-pkg, use one of: - - ninja apt-pkg/all - make -C apt-pkg -j4 (or cd apt-pkg && make -j4) - -Ninja automatically parallelizes, make needs an explicit -j switch. The travis -system uses the make generator, the packaging as well. diff --git a/README.md b/README.md index 2f86d79a3..9020a3d6a 100644 --- a/README.md +++ b/README.md @@ -45,12 +45,21 @@ are encouraged to do as well. ### Coding -APT uses its own autoconf based build system, see [README.make](http://anonscm.debian.org/gitweb/?p=apt/apt.git;a=blob;f=README.make) -for the glory details, but to get started, just run: +APT uses cmake. To start building, you need to run - $ make + cmake -from a fresh git checkout. +from a build directory. For example, if you want to build in the source tree, +run: + + cmake . + +Then you can use make as you normally would (pass -j to perform +jobs in parallel). + +You can also use the Ninja generator of cmake, to do that pass + -G Ninja +to the cmake invocation, and then use ninja instead of make. The source code uses in most parts a relatively uncommon indent convention, namely 3 spaces with 8 space tab (see [doc/style.txt](http://anonscm.debian.org/gitweb/?p=apt/apt.git;a=blob;f=doc/style.txt) for more on this). @@ -86,12 +95,8 @@ Testing ### Manual execution -When you make changes and want to run them manually, make sure your -`$LD_LIBRARY_PATH` points to the libraries you have built, e.g. via: - - $ export LD_LIBRARY_PATH=$(pwd)/build/bin - $ ./build/bin/apt-get moo - +When you make changes and want to run them manually, you can just do so. CMake +automatically inserts an rpath so the binaries find the correct libraries. ### Integration tests -- cgit v1.2.3 From fa1b5d86bf5ba20047774014b422e7c30ee13a9c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 17:39:25 +0200 Subject: Add statvfs.h.in to CMake directory Gbp-Dch: ignore --- CMake/statvfs.h.in | 13 +++++++++++++ CMakeLists.txt | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 CMake/statvfs.h.in diff --git a/CMake/statvfs.h.in b/CMake/statvfs.h.in new file mode 100644 index 000000000..d0ec238ad --- /dev/null +++ b/CMake/statvfs.h.in @@ -0,0 +1,13 @@ +/* Compatibility for systems with out Single Unix Spec statvfs */ +#include + +#ifdef HAVE_VFS_H +#include +#endif + +#ifdef HAVE_MOUNT_H +#include +#include +#endif + +#define statvfs statfs diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f9ca02b8..80b9c380c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,7 +92,7 @@ if (NOT HAVE_STATVFS) if (NOT HAVE_VFS_H AND NOT HAVE_MOUNT_H) message(FATAL_ERROR "Can find neither statvfs() nor statfs()") endif() - configure_file(buildlib/statvfs.h.in ${PROJECT_BINARY_DIR}/include/statvfs.h @ONLY) + configure_file(CMake/statvfs.h.in ${PROJECT_BINARY_DIR}/include/statvfs.h @ONLY) endif() CHECK_STRUCT_HAS_MEMBER("struct statfs" f_type sys/vfs.h HAVE_STRUCT_STATFS_F_TYPE) -- cgit v1.2.3 From c85c4bed0a4b32ee2dcbd86ea819e39f3d8beb84 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 17:40:01 +0200 Subject: Get rid of the old buildsystem Bye, bye, old friend. --- COMPILING | 84 ------------- Makefile | 53 --------- README.make | 112 ------------------ apt-inst/makefile | 26 ---- apt-pkg/makefile | 37 ------ apt-private/makefile | 21 ---- buildlib/apti18n.h.in | 30 ----- buildlib/config.h.in | 60 ---------- buildlib/configure.mak | 62 ---------- buildlib/copy.mak | 31 ----- buildlib/defaults.mak | 185 ----------------------------- buildlib/docbook.mak | 75 ------------ buildlib/environment.mak.in | 85 ------------- buildlib/fail.mak | 20 ---- buildlib/install-sh | 250 --------------------------------------- buildlib/library.mak | 77 ------------ buildlib/libversion.mak | 14 --- buildlib/makefile.in | 46 ------- buildlib/manpage.mak | 30 ----- buildlib/netdb.h.in | 6 - buildlib/po4a_manpage.mak | 74 ------------ buildlib/podomain.mak | 27 ----- buildlib/program.mak | 60 ---------- buildlib/python.mak | 68 ----------- buildlib/staticlibrary.mak | 60 ---------- buildlib/statvfs.h.in | 13 -- buildlib/tools.m4 | 110 ----------------- cmdline/makefile | 119 ------------------- configure.ac | 218 ---------------------------------- doc/en/makefile | 37 ------ doc/lang.makefile | 11 -- doc/makefile | 113 ------------------ dselect/makefile | 17 --- ftparchive/makefile | 21 ---- methods/makefile | 110 ----------------- po/LINGUAS | 7 -- po/makefile | 114 ------------------ test/Makefile | 16 --- test/integration/makefile | 10 -- test/interactive-helper/makefile | 53 --------- test/libapt/makefile | 84 ------------- vendor/makefile | 58 --------- vendor/vendor.makefile | 28 ----- 43 files changed, 2732 deletions(-) delete mode 100644 COMPILING delete mode 100644 Makefile delete mode 100644 README.make delete mode 100644 apt-inst/makefile delete mode 100644 apt-pkg/makefile delete mode 100644 apt-private/makefile delete mode 100644 buildlib/apti18n.h.in delete mode 100644 buildlib/config.h.in delete mode 100644 buildlib/configure.mak delete mode 100644 buildlib/copy.mak delete mode 100644 buildlib/defaults.mak delete mode 100644 buildlib/docbook.mak delete mode 100644 buildlib/environment.mak.in delete mode 100644 buildlib/fail.mak delete mode 100644 buildlib/install-sh delete mode 100644 buildlib/library.mak delete mode 100644 buildlib/libversion.mak delete mode 100644 buildlib/makefile.in delete mode 100644 buildlib/manpage.mak delete mode 100644 buildlib/netdb.h.in delete mode 100644 buildlib/po4a_manpage.mak delete mode 100644 buildlib/podomain.mak delete mode 100644 buildlib/program.mak delete mode 100644 buildlib/python.mak delete mode 100644 buildlib/staticlibrary.mak delete mode 100644 buildlib/statvfs.h.in delete mode 100644 buildlib/tools.m4 delete mode 100644 cmdline/makefile delete mode 100644 configure.ac delete mode 100644 doc/en/makefile delete mode 100644 doc/lang.makefile delete mode 100644 doc/makefile delete mode 100644 dselect/makefile delete mode 100644 ftparchive/makefile delete mode 100644 methods/makefile delete mode 100644 po/LINGUAS delete mode 100644 po/makefile delete mode 100644 test/Makefile delete mode 100644 test/integration/makefile delete mode 100644 test/interactive-helper/makefile delete mode 100644 test/libapt/makefile delete mode 100644 vendor/makefile delete mode 100644 vendor/vendor.makefile diff --git a/COMPILING b/COMPILING deleted file mode 100644 index 93e628037..000000000 --- a/COMPILING +++ /dev/null @@ -1,84 +0,0 @@ -General Information -~~~~~~~~~~~~~~~~~~~ -To compile this you need a couple things - - A working POSIX system with working POSIX gcc, g++, make (GNU), - ar, sh, awk and sed in the path - - GNU Make 3.74 or so, -- normal UNIX make will NOT work - * Note 3.77 is broken. - - A working ANSI C++ compiler, this is not g++ 2.7.* - g++ 2.8 works OK and newer egcs work well also. Nobody has tried it - on other compilers :< You will need a properly working STL as well. - - A C library with the usual POSIX functions and a BSD socket layer. - If your OS conforms to the Single Unix Spec then you are fine: - http://www.opengroup.org/onlinepubs/7908799/index.html - - Refer to the Build-Depends information in debian/control for - additional requirements (some of which are Debian-specific) - -** NOTICE ** -The C++ global constructors do not link correctly when using non-shared -libraries. This is probably the correct behavior of the linker, but I have -not yet had time to devise a work around for it. The correct thing to -do is add a reference to debSystem in apt-pkg/init.cc, -assert(&debSystem == 0) would be fine for instance. - -Guidelines -~~~~~~~~~~ -I am not interested in making 'ultra portable code'. I will accept patches -to make the code that already exists conform more to SUS or POSIX, but -I don't really care if your not-SUS OS doesn't work. It is simply too -much work to maintain patches for dysfunctional OSs. I highly suggest you -contact your vendor and express interest in a conforming C library. - -That said, there are lots of finicky problems that must be dealt with even -between the supported OS's. Primarily the path I choose to take is to put -a shim header file in build/include that transparently adds the required -functionality. Patches to make autoconf detect these cases and generate the -required shims are OK. - -Current shims: - * sys/statvfs.h to convert from BSD/old-glibc statfs to SUS statvfs - * rfc2553 hostname resolution (methods/rfc*), shims to normal gethostbyname. - The more adventurous could steal the KAME IPv6 enabled resolvers for those - OS's with IPv6 support but no rfc2553 (why?) - * define _XOPEN_EXTENDED_SOURCE to bring in h_errno on HP-UX - * socklen_t shim in netdb.h if the OS does not have socklen_t - -The only completely non-shimmed OS is Linux with glibc2.1, glibc2.0 requires -the first three shims. - -Platform Notes -~~~~~~~~~~~~~~ -Debian GNU Linux 2.1 'slink' -Debian GNU Linux 'potato' -Debian GNU Linux 'woody' - * All Archs - - Works flawlessly - - You will want to have docbook-xml and docbook2man installed to get - best results. - - No IPv6 Support in glibc's < 2.1. - -Sun Solaris - SunOS cab101 5.7 Generic_106541-04 sun4u sparc - SunOS csu201 5.8 Generic_108528-04 sun4u sparc - - Works fine - - Note, no IPv6 Support, OS lacks RFC 2553 hostname resolution - -OpenBSD - OpenBSD gsb086 2.5 CMPUT#0 i386 unknown - OpenBSD csu101 2.7 CMPUT#1 i386 unknown - - OS needs 'ranlib' to generate the symbol table after 'ar'.. (not using - GNU ar with the gnu tool chain :<) - - '2.5' does not have RFC 2553 hostname resolution, but '2.7' does - - Testing on '2.7' suggests the OS has a bug in its handling of - ftruncate on files that have been written via mmap. It fills the page - that crosses the truncation boundary with 0's. - -HP-UX - HP-UX nyquist B.10.20 C 9000/780 2016574337 32-user license - - Evil OS, does not conform very well to SUS - 1) snprintf exists but is not prototyped, ignore spurious warnings - 2) No socklen_t - 3) Requires -D_XOPEN_SOURCE_EXTENDED for h_errno - configure should fix the last two (see above) - - Note, no IPv6 Support, OS lacks RFC 2553 hostname resolution - diff --git a/Makefile b/Makefile deleted file mode 100644 index 7680f0842..000000000 --- a/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -*- make -*- - -# This is the top level make file for APT, it recurses to each lower -# level make file and runs it with the proper target -ifndef NOISY -.SILENT: -endif - -.PHONY: default -default: startup all - -.PHONY: fast headers library clean veryclean all binary program doc test update-po -all headers library clean veryclean binary program doc manpages docbook test update-po startup dirs: - $(MAKE) -C vendor $@ - $(MAKE) -C apt-pkg $@ - $(MAKE) -C apt-inst $@ - $(MAKE) -C apt-private $@ - $(MAKE) -C methods $@ - $(MAKE) -C cmdline $@ - $(MAKE) -C ftparchive $@ - $(MAKE) -C dselect $@ - $(MAKE) -C doc $@ - $(MAKE) -C po $@ - # FIXME: -C test has issue swith parallel builds, investigate! - -$(MAKE) -C test $@ - -fast: - $(MAKE) -C vendor all - $(MAKE) -C apt-pkg all - $(MAKE) -C apt-inst all - $(MAKE) -C apt-private all - $(MAKE) -C methods all - $(MAKE) -C cmdline all - $(MAKE) -C ftparchive all - $(MAKE) -C test all - -all headers library clean veryclean binary program doc manpages docbook test update-po: startup dirs - -dirs: startup - -# Some very common aliases -.PHONY: maintainer-clean dist-clean distclean pristine sanity -maintainer-clean dist-clean distclean pristine sanity: veryclean -veryclean: clean - -# The startup target builds the necessary configure scripts. It should -# be used after a CVS checkout. -CONVERTED=environment.mak include/config.h include/apti18n.h build/doc/Doxyfile makefile -include buildlib/configure.mak -$(BUILDDIR)/include/config.h: buildlib/config.h.in -$(BUILDDIR)/include/apti18n.h: buildlib/apti18n.h.in -$(BUILDDIR)/environment.mak: buildlib/environment.mak.in -$(BUILDDIR)/makefile: buildlib/makefile.in diff --git a/README.make b/README.make deleted file mode 100644 index db5f36e94..000000000 --- a/README.make +++ /dev/null @@ -1,112 +0,0 @@ -The Make System -~~~ ~~~~ ~~~~~~ -To compile this program you require GNU Make. In fact you probably need -GNU Make 3.76.1 or newer. The makefiles contained make use of many -GNU Make specific features and will not run on other makes. - -The make system has a number of interesting properties that are not found -in other systems such as automake or the GNU makefile standards. In -general some semblance of expectedness is kept so as not to be too -surprising. Basically the following will work as expected: - - ./configure - make - or - cd build - ../configure - make - -There are a number of other things that are possible that may make software -development and software packaging simpler. The first of these is the -environment.mak file. When configure is run it creates an environment.mak -file in the build directory. This contains -all- configurable parameters -for all of the make files in all of the subdirectories. Changing one -of these parameters will have an immediate effect. The use of makefile.in -and configure substitutions across build makefiles is not used at all. - -Furthermore, the make system runs with a current directory equal to the -source directory regardless of the destination directory. This means -#include "" and #include <> work as expected and more importantly -running 'make' in the source directory will work as expected. The -environment variable or make parameter 'BUILD' sets the build directory. -It may be an absolute path or a path relative to the top level directory. -By default build-arch/ then build/ will be used with a fall back to ./ This -means you can get all the advantages of a build directory without having to -cd into it to edit your source code! - -The make system also performs dependency generation on the fly as the -compiler runs. This is extremely fast and accurate. There is however -one failure condition that occurs when a header file is erased. In -this case you should run make clean to purge the .o and .d files to -rebuild. - -The final significant deviation from normal make practices is -in how the build directory is managed. It is not nearly a mirror of -the source directory but is logically divided in the following manner - bin/ - methods/ - doc/ - examples/ - include/ - apt-pkg/ - obj/ - apt-pkg/ - cmdline/ - [...] -Only .o and .d files are placed in the obj/ subdirectory. The final compiled -binaries are placed in bin, published headers for inter-component linking -are placed in include/ and documentation is generated into doc/. This means -all runnable programs are within the bin/ directory, a huge benefit for -debugging inter-program relationships. The .so files are also placed in -bin/ for simplicity. - -By default make is put into silent mode. During operation there should be -no shell or compiler messages only status messages from the makefiles, -if any pop up that indicates there may be a problem with your environment. -For debugging you can disable this by setting NOISY=1, ala - make NOISY=1 - -Using the makefiles -~~~~~ ~~~ ~~~~~~~~~ -The makefiles for the components are really simple. The complexity is hidden -within the buildlib/ directory. Each makefile defines a set of make variables -for the bit it is going to make then includes a makefile fragment from -the buildlib/. This fragment generates the necessary rules based on the -originally defined variables. This process can be repeated as many times as -necessary for as many programs or libraries as are in the directory. - -Many of the make fragments have some useful properties involving sub -directories and other interesting features. They are more completely -described in the fragment code in buildlib. Some tips on writing fragments -are included in buildlib/defaults.mak - -The fragments are NEVER processed by configure, so if you make changes to -them they will have an immediate effect. - -Autoconf -~~~~~~~~ -Straight out of CVS you have to initialize autoconf. This requires -automake (I really don't know why) and autoconf and requires doing - aclocal -I buildlib - autoconf -[Alternatively you can run make startup in the top level build dir] - -Autoconf is configured to do some basic system probes for optional and -required functionality and generate an environment.mak and include/config.h -from it's findings. It will then write a 'makefile' and run make dirs to -create the output directory tree. - -It is not my belief that autoconf should be used to generate substantial -source code markup to escape OS problems. If an OS problem does crop up -it can likely be corrected by installing the correct files into the -build include/ dir and perhaps writing some replacement code and -linking it in. To the fullest extent possible the source code should conform -to standards and not cater to broken systems. - -Autoconf will also write a makefile into the top level of the build dir, -this simply acts as a wrapper to the main top level make in the source tree. -There is one big warning, you can't use both this make file and the -ones in the top level tree. Make is not able to resolve rules that -go to the same file through different paths and this will confuse the -depends mechanism. I recommend always using the makefiles in the -source directory and exporting BUILD. diff --git a/apt-inst/makefile b/apt-inst/makefile deleted file mode 100644 index 5601cd9e6..000000000 --- a/apt-inst/makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=apt-inst - -# Header location -SUBDIRS = contrib deb -HEADER_TARGETDIRS = apt-pkg - -# Bring in the default rules -include ../buildlib/defaults.mak - -# The library name and version (indirectly used from init.h) -include ../buildlib/libversion.mak - -# The library name -LIBRARY=apt-inst -MAJOR=2.0 -MINOR=0 -SLIBS=$(PTHREADLIB) -lapt-pkg -APT_DOMAIN:=libapt-inst$(MAJOR) -LIBRARYDEPENDS=$(LIB)/libapt-pkg.so - -SOURCE = $(sort $(wildcard *.cc */*.cc)) -HEADERS = $(addprefix apt-pkg/,$(notdir $(sort $(wildcard *.h */*.h)))) - -include $(LIBRARY_H) diff --git a/apt-pkg/makefile b/apt-pkg/makefile deleted file mode 100644 index 789d3f2fd..000000000 --- a/apt-pkg/makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=apt-pkg - -# Header location -SUBDIRS = deb edsp contrib -HEADER_TARGETDIRS = apt-pkg - -# Bring in the default rules -include ../buildlib/defaults.mak - -# The library name and version (indirectly used from init.h) -include ../buildlib/libversion.mak - -CPPFLAGS+=-DAPT_PKG_EXPOSE_STRING_VIEW -LIBRARY=apt-pkg -MAJOR=$(LIBAPTPKG_MAJOR) -MINOR=$(LIBAPTPKG_RELEASE) -SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil -ldl -lresolv -ifeq ($(HAVE_ZLIB),yes) -SLIBS+= -lz -endif -ifeq ($(HAVE_BZ2),yes) -SLIBS+= -lbz2 -endif -ifeq ($(HAVE_LZMA),yes) -SLIBS+= -llzma -endif -ifeq ($(HAVE_LZ4),yes) -SLIBS+= -llz4 -endif -APT_DOMAIN:=libapt-pkg$(LIBAPTPKG_MAJOR) - -SOURCE = $(sort $(wildcard *.cc */*.cc)) -HEADERS = $(addprefix apt-pkg/,$(notdir $(sort $(wildcard *.h */*.h)))) - -include $(LIBRARY_H) diff --git a/apt-private/makefile b/apt-private/makefile deleted file mode 100644 index 1934db160..000000000 --- a/apt-private/makefile +++ /dev/null @@ -1,21 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=apt-private - -# Header location -HEADER_TARGETDIRS = apt-private - -# Bring in the default rules -include ../buildlib/defaults.mak - -# The library name -LIBRARY=apt-private -MAJOR=0.0 -MINOR=0 -SLIBS=$(PTHREADLIB) -lapt-pkg -CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden - -SOURCE = $(sort $(wildcard *.cc)) -HEADERS = $(addprefix apt-private/,$(sort $(wildcard *.h))) - -include $(LIBRARY_H) diff --git a/buildlib/apti18n.h.in b/buildlib/apti18n.h.in deleted file mode 100644 index 2202c5b19..000000000 --- a/buildlib/apti18n.h.in +++ /dev/null @@ -1,30 +0,0 @@ -// -*- mode: cpp; mode: fold -*- -// $Id: apti18n.h.in,v 1.6 2003/01/11 07:18:18 jgg Exp $ -/* Internationalization macros for apt. This header should be included last - in each C file. */ - -// Set by autoconf -#undef USE_NLS - -#ifdef USE_NLS -// apt will use the gettext implementation of the C library -#include -#include -# ifdef APT_DOMAIN -# define _(x) dgettext(APT_DOMAIN,x) -# define P_(msg,plural,n) dngettext(APT_DOMAIN,msg,plural,n) -# else -# define _(x) gettext(x) -# define P_(msg,plural,n) ngettext(msg,plural,n) -# endif -# define N_(x) x -#else -// apt will not use any gettext -# define setlocale(a, b) -# define textdomain(a) -# define bindtextdomain(a, b) -# define _(x) x -# define P_(msg,plural,n) (n == 1 ? msg : plural) -# define N_(x) x -# define dgettext(d, m) m -#endif diff --git a/buildlib/config.h.in b/buildlib/config.h.in deleted file mode 100644 index 71c05c1cd..000000000 --- a/buildlib/config.h.in +++ /dev/null @@ -1,60 +0,0 @@ -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define if we have the timegm() function */ -#undef HAVE_TIMEGM - -/* Define if we have the zlib library for gzip */ -#undef HAVE_ZLIB - -/* Define if we have the bz2 library for bzip2 */ -#undef HAVE_BZ2 - -/* Define if we have the lzma library for lzma/xz */ -#undef HAVE_LZMA - -/* Define if we have the lz4 library for lz4 */ -#undef HAVE_LZ4 - -/* These two are used by the statvfs shim for glibc2.0 and bsd */ -/* Define if we have sys/vfs.h */ -#undef HAVE_VFS_H -#undef HAVE_STRUCT_STATFS_F_TYPE - -/* Define if we have sys/mount.h */ -#undef HAVE_MOUNT_H - -/* Define if we have enabled pthread support */ -#undef HAVE_PTHREAD - -/* If there is no socklen_t, define this for the netdb shim */ -#undef NEED_SOCKLEN_T_DEFINE - -/* Check for getresuid() function and similar ones */ -#undef HAVE_GETRESUID -#undef HAVE_GETRESGID -#undef HAVE_SETRESUID -#undef HAVE_SETRESGID - -/* Define to the size of the filesize containing structures */ -#undef _FILE_OFFSET_BITS - -/* Define the arch name string */ -#undef COMMON_ARCH - -/* The package name string */ -#undef PACKAGE - -/* The version number string */ -#undef PACKAGE_VERSION - -/* The mail address to reach upstream */ -#undef PACKAGE_MAIL - -#define APT_8_CLEANER_HEADERS -#define APT_9_CLEANER_HEADERS -#define APT_10_CLEANER_HEADERS - -/* unrolling is faster combined with an optimizing compiler */ -#define SHA2_UNROLL_TRANSFORM diff --git a/buildlib/configure.mak b/buildlib/configure.mak deleted file mode 100644 index e1a511544..000000000 --- a/buildlib/configure.mak +++ /dev/null @@ -1,62 +0,0 @@ -# -*- make -*- - -# This make fragment is included by the toplevel make to handle configure -# and setup. It defines a target called startup that when run will init -# the build directory, generate configure from configure.ac, create aclocal -# and has rules to run config.status should one of the .in files change. - -# Input -# BUILDDIR - The build directory -# CONVERTED - List of files output by configure $(BUILD) is prepended -# The caller must provide depends for these files -# It would be a fairly good idea to run this after a cvs checkout. -BUILDDIR=build - -.PHONY: startup missing-config-files -startup: $(BUILDDIR)/configure-stamp $(addprefix $(BUILDDIR)/,$(CONVERTED)) - -# use the files provided from the system instead of carry around -# and use (most of the time outdated) copycats -ifeq (file-okay,$(shell test -r buildlib/config.sub && echo 'file-okay')) -buildlib/config.sub: -else - ifeq (file-okay,$(shell test -r /usr/share/misc/config.sub && echo 'file-okay')) -buildlib/config.sub: - ln -sf /usr/share/misc/config.sub buildlib/config.sub - else -buildlib/config.sub: missing-config-files - endif -endif - -ifeq (file-okay,$(shell test -r buildlib/config.guess && echo 'file-okay')) -buildlib/config.guess: -else - ifeq (file-okay,$(shell test -r /usr/share/misc/config.guess && echo 'file-okay')) -buildlib/config.guess: - ln -sf /usr/share/misc/config.guess buildlib/config.guess - else -buildlib/config.guess: missing-config-files - endif -endif - -missing-config-files: - @echo "APT needs 'config.guess' and 'config.sub' in buildlib/ for configuration." - @echo "On Debian systems these are available in the 'autotools-dev' package." - @echo - @echo "The latest versions can be acquired from the upstream git repository:" - @echo "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" - @echo "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" - exit 100 - -configure: aclocal.m4 configure.ac - autoconf - -aclocal.m4: $(wildcard buildlib/*.m4) - aclocal -I buildlib - -$(BUILDDIR)/configure-stamp: configure buildlib/config.guess buildlib/config.sub - /usr/bin/test -e '$(BUILDDIR)' || mkdir '$(BUILDDIR)' - (HERE="`pwd`"; cd '$(BUILDDIR)' && "$$HERE/configure") - touch '$(BUILDDIR)/configure-stamp' - -$(addprefix $(BUILDDIR)/,$(CONVERTED)): $(BUILDDIR)/configure-stamp diff --git a/buildlib/copy.mak b/buildlib/copy.mak deleted file mode 100644 index 3ae11a7eb..000000000 --- a/buildlib/copy.mak +++ /dev/null @@ -1,31 +0,0 @@ -# -*- make -*- - -# This installs arbitrary files into a directory - -# Input -# $(SOURCE) - The documents to use -# $(TO) - The directory to put them in -# $(TARGET) - The global target to add the local target as a dependency -# to. -# All output is writtin to files in the build/$(TO) directory - -# See defaults.mak for information about LOCAL - -# Some local definitions -LOCAL := copy-$(firstword $(SOURCE)) -$(LOCAL)-LIST := $(addprefix $(TO)/,$(SOURCE)) - -# Install generation hooks -$(TARGET): $($(LOCAL)-LIST) -veryclean: veryclean/$(LOCAL) - -MKDIRS += $(dir $($(LOCAL)-LIST)) - -$($(LOCAL)-LIST) : $(TO)/% : % - echo Installing $< to $(@D) - cp $< $(@D) - -# Clean rule -.PHONY: veryclean/$(LOCAL) -veryclean/$(LOCAL): - -rm -rf $($(@F)-LIST) diff --git a/buildlib/defaults.mak b/buildlib/defaults.mak deleted file mode 100644 index 783cc11b0..000000000 --- a/buildlib/defaults.mak +++ /dev/null @@ -1,185 +0,0 @@ -# -*- make -*- - -# This file configures the default environment for the make system -# The way it works is fairly simple, each module is defined in it's -# own *.mak file. It expects a set of variables to be set to values -# for it to operate as expected. When included the module generates -# the requested rules based on the contents of its control variables. - -# This works out very well and allows a good degree of flexibility. -# To accommodate some of the features we introduce the concept of -# local variables. To do this we use the 'Computed Names' feature of -# gmake. Each module declares a LOCAL scope and access it with, -# $($(LOCAL)-VAR) -# This works very well but it is important to remember that within -# a rule the LOCAL var is unavailable, it will have to be constructed -# from the information in the rule invocation. For stock rules like -# clean this is simple, we use a local clean rule called clean/$(LOCAL) -# and then within the rule $(@F) gets back $(LOCAL)! Other rules will -# have to use some other mechanism (filter perhaps?) The reason such -# lengths are used is so that each directory can contain several 'instances' -# of any given module. I notice that the very latest gmake has the concept -# of local variables for rules. It is possible this feature in conjunction -# with the generated names will provide a very powerful solution indeed! - -# A build directory is used by default, all generated items get put into -# there. However unlike automake this is not done with a VPATH build -# (vpath builds break the distinction between #include "" and #include <>) -# but by explicitly setting the BUILD variable. Make is invoked from -# within the source itself which is much more compatible with compilation -# environments. -ifndef NOISY -.SILENT: -endif - -# Search for the build directory -ifdef BUILD -BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD) -else -BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname -m) $(BASE)/build -endif - -BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*)) - -ifeq ($(words $(BUILDX)),0) - -# Check for a busted wildcard function. We use this function in several -# places, it must work. -ifeq ($(words $(wildcard *)),0) -error-all/environment.mak: - echo You have a broken version of GNU Make - upgrade. - error-out-and-die -else -error-all/environment.mak: - echo Can not find the build directory in $(BUILD_POSSIBLE) -- use BUILD= - error-out-and-die -endif - -# Force include below to come to the error target -BUILDX := error-all -else -BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX)))) -endif - -override BUILD := $(BUILDX) - -# Base definitions -INCLUDE := $(BUILD)/include -BIN := $(BUILD)/bin -LIB := $(BIN) -OBJ := $(BUILD)/obj/$(SUBDIR) -DEP := $(OBJ) -DOC := $(BUILD)/docs -PO := $(BUILD)/po -LOCALE := $(BUILD)/locale -PO_DOMAINS := $(BUILD)/po/domains - -# Module types -LIBRARY_H = $(BASE)/buildlib/library.mak -DOCBOOK_H = $(BASE)/buildlib/docbook.mak -MANPAGE_H = $(BASE)/buildlib/manpage.mak -PROGRAM_H = $(BASE)/buildlib/program.mak -PYTHON_H = $(BASE)/buildlib/python.mak -COPY_H = $(BASE)/buildlib/copy.mak -PO4A_MANPAGE_H = $(BASE)/buildlib/po4a_manpage.mak -FAIL_H = $(BASE)/buildlib/fail.mak -PODOMAIN_H = $(BASE)/buildlib/podomain.mak - -include $(BUILD)/environment.mak - -ifdef STATICLIBS -LIBRARY_H += $(BASE)/buildlib/staticlibrary.mak -endif - -ifdef ONLYSTATICLIBS -LIBRARY_H = $(BASE)/buildlib/staticlibrary.mak -endif - -# Source location control -# SUBDIRS specifies sub components of the module that -# may be located in subdirectories of the source dir. -# This should be declared before including this file -SUBDIRS+= - -# Header file control. -# TARGETDIRS indicates all of the locations that public headers -# will be published to. -# This should be declared before including this file -HEADER_TARGETDIRS+= - -# Options -CPPFLAGS+= -I$(INCLUDE) -LDFLAGS+= -L$(LIB) - -# Directors to create -MKDIRS := $(BIN) - -# Phony rules. Other things hook these by appending to the dependency -# list -.PHONY: headers library clean veryclean all binary program doc dirs -.PHONY: maintainer-clean dist-clean distclean pristine sanity -all: dirs binary doc -binary: library program -maintainer-clean dist-clean distclean pristine sanity: veryclean -startup headers library clean veryclean program test update-po manpages docbook: - -veryclean: - echo Very Clean done for $(SUBDIR) -clean: - echo Clean done for $(SUBDIR) -dirs: - mkdir -p $(patsubst %/,%,$(sort $(MKDIRS))) - -# Header file control. We want all published interface headers to go -# into the build directory from their source dirs. We setup some -# search paths here -vpath %.h $(SUBDIRS) -$(INCLUDE)/%.h $(addprefix $(INCLUDE)/,$(addsuffix /%.h,$(HEADER_TARGETDIRS))) : %.h - cp $< $@ - -# Dependency generation. We want to generate a .d file using gnu cpp. -# For GNU systems the compiler can spit out a .d file while it is compiling, -# this is specified with the INLINEDEPFLAG. Other systems might have a -# makedep program that can be called after compiling, that's illustrated -# by the DEPFLAG case. -# Compile rules are expected to call this macro after calling the compiler -ifdef GCC3DEP -DFILE = $(DEP)/$(basename $(@F)).d -else -DFILE = $(basename $(@F)).d -endif -ifdef INLINEDEPFLAG - define DoDep - sed -e "1s/.*:/$(subst /,\\/,$@):/" $(DFILE) > $(DEP)/$(@F).d - #sed -e "1s/.*:/$(subst /,\\/,$@):/" $(DEP)/$(basename $(@F)).d > $(DEP)/$(@F).d - -rm -f $(basename $(@F)).d - endef -else - ifdef DEPFLAG - define DoDep - $(CXX) $(DEPFLAG) $(CPPFLAGS) -o $@ $< - sed -e "1s/.*:/$(subst /,\\/,$@):/" $(basename $(@F)).d > $(DEP)/$(@F).d - -rm -f $(basename $(@F)).d - endef - else - define DoDep - endef - endif -endif - -# Automatic -j support -ifeq ($(NUM_PROCS),1) - PARALLEL_RUN=no -endif - -ifndef PARALLEL_RUN - PARALLEL_RUN=yes - export PARALLEL_RUN - # handle recursion - ifneq ($(NUM_PROCS),) - MAKEFLAGS += -j $(NUM_PROCS) - endif -endif - -# This makes sorting predictable -export LC_COLLATE=C.UTF-8 diff --git a/buildlib/docbook.mak b/buildlib/docbook.mak deleted file mode 100644 index 6aa3ca0d2..000000000 --- a/buildlib/docbook.mak +++ /dev/null @@ -1,75 +0,0 @@ -# -*- make -*- - -# This processes DocBook XML to produce html and plain text output - -# Input -# $(SOURCE) - The documents to use - -# All output is written to files in the build doc directory - -# See defaults.mak for information about LOCAL - -# Some local definitions -LOCAL := docbook-$(firstword $(SOURCE)) -$(LOCAL)-HTML := $(addsuffix .html,$(addprefix $(DOC)/,$(basename $(SOURCE)))) -$(LOCAL)-TEXT := $(addsuffix .text,$(addprefix $(DOC)/,$(basename $(SOURCE)))) -INCLUDES = apt.ent apt-verbatim.ent apt-vendor.ent - -docbook: - - -#--------- - -# Rules to build HTML documentations -ifdef XSLTPROC - -DOCBOOK_HTML_STYLESHEET := docbook-html-style.xsl - -# Install generation hooks -docbook: $($(LOCAL)-HTML) -veryclean: veryclean/html/$(LOCAL) - -vpath %.dbk $(SUBDIRS) -vpath $(DOCBOOK_HTML_STYLESHEET) $(SUBDIRS) -$(DOC)/%.html: %.dbk $(DOCBOOK_HTML_STYLESHEET) $(INCLUDES) - echo Creating html for $< to $@ - -rm -rf $@ - mkdir -p $@ - $(DOCBOOK) \ - --stringparam base.dir $@/ \ - --stringparam l10n.gentext.default.language $(LC) \ - $( $@ || exit 198 - -# Clean rule -.PHONY: veryclean/text/$(LOCAL) -veryclean/text/$(LOCAL): - -rm -rf $($(@F)-TEXT) - -endif diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in deleted file mode 100644 index 2ac3d6847..000000000 --- a/buildlib/environment.mak.in +++ /dev/null @@ -1,85 +0,0 @@ -# This file contains everything that autoconf guessed for your system. -# if you want you can edit it, just don't re-run configure. - -PACKAGE = @PACKAGE@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PACKAGE_MAIL = @PACKAGE_MAIL@ - -# C++ compiler options -CC = @CC@ -CPPFLAGS+= @CPPFLAGS@ @DEFS@ -D_REENTRANT -D_FORTIFY_SOURCE=2 -CXX = @CXX@ -CXXSTD = -std=c++11 -CXXFLAGS+= @CXXFLAGS@ -Wall -Wextra -CXXFLAGS+= -Wcast-align -Wlogical-op -Wredundant-decls -Wmissing-declarations -Wunsafe-loop-optimizations -CXXFLAGS+= -Wctor-dtor-privacy -Wdisabled-optimization -Winit-self -Wmissing-include-dirs -Wnoexcept -Wsign-promo -Wundef -# suggests methods which already have such an attribute -#CXXFLAGS+= -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -# sanitize options to be enabled for testing -#CXXFLAGS+= -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -# a bit too pedantic to be run by default -#CXXFLAGS+= -Wpedantic -Wno-long-long -Wno-vla -Wno-variadic-macros -# hide inlines -CXXFLAGS+= -fvisibility-inlines-hidden -NUM_PROCS = @NUM_PROCS@ - -# Linker stuff -PICFLAGS+= -fPIC -DPIC -LFLAGS+= @LDFLAGS@ -LEFLAGS+= -SOCKETLIBS:= @SOCKETLIBS@ -AR:=@AR@ -RANLIB:=@RANLIB@ - -# Dep generation - this only works for gnu stuff -GCC3DEP = @GCC3DEP@ -INLINEDEPFLAG = -MD - -DOXYGEN = @DOXYGEN@ -W3M = @W3M@ - -# xsltproc for the man pages and documentation -XSLTPROC := @XSLTPROC@ - -# DocBook XML -DOCBOOK = $(XSLTPROC) --nonet --novalid --xinclude -DOCBOOK2TEXT = $(W3M) -o display_charset=UTF-8 -no-graph -T text/html \ - -cols 78 -dump - -# po4a for the man pages -PO4A := @PO4A@ - -# Gettext settings -GMSGFMT = @GMSGFMT@ -XGETTEXT = @XGETTEXT@ -MSGCOMM:=$(dir $(XGETTEXT))/msgcomm -MSGMERGE:=$(dir $(XGETTEXT))/msgmerge -BASH = @BASH@ - -# Various library checks -PTHREADLIB = @PTHREADLIB@ -PYTHONLIB = @PYTHONLIB@ -PYTHONVER = @PYTHONVER@ -PYTHONPREFIX = @PYTHONPREFIX@ -PYTHONEXECPREFIX = @PYTHONEXECPREFIX@ -PYTHONINCLUDE = @PYTHONINCLUDE@ -BDBLIB = @BDBLIB@ -INTLLIBS = @INTLLIBS@ - -# Shim Headerfile control -HAVE_STATVFS = @HAVE_STATVFS@ -HAVE_ZLIB = @HAVE_ZLIB@ -HAVE_BZ2 = @HAVE_BZ2@ -HAVE_LZMA = @HAVE_LZMA@ -HAVE_LZ4 = @HAVE_LZ4@ -NEED_SOCKLEN_T_DEFINE = @NEED_SOCKLEN_T_DEFINE@ - -# Shared library things -HOST_OS = @host_os@ -ifneq ($(words $(filter gnu% linux-gnu% kfreebsd-gnu% %-gnu,$(HOST_OS))),0) - SONAME_MAGIC=-Wl,-soname -Wl, - LFLAGS_SO= -else - # Do not know how to create shared libraries here. - ONLYSTATICLIBS = yes -endif diff --git a/buildlib/fail.mak b/buildlib/fail.mak deleted file mode 100644 index fc187766d..000000000 --- a/buildlib/fail.mak +++ /dev/null @@ -1,20 +0,0 @@ -# -*- make -*- - -# This prints a failure message but does not abort the make - -# Input -# $(MESSAGE) - The message to show -# $(PROGRAM) - The program/library/whatever. - -# See defaults.mak for information about LOCAL - -LOCAL := $(PROGRAM) -$(LOCAL)-MSG := $(MESSAGE) - -# Install hooks -program: $(PROGRAM) - -.PHONY: $(PROGRAM) -$(PROGRAM) : - echo $($@-MSG) - diff --git a/buildlib/install-sh b/buildlib/install-sh deleted file mode 100644 index ebc66913e..000000000 --- a/buildlib/install-sh +++ /dev/null @@ -1,250 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/buildlib/library.mak b/buildlib/library.mak deleted file mode 100644 index 7b12384c4..000000000 --- a/buildlib/library.mak +++ /dev/null @@ -1,77 +0,0 @@ -# -*- make -*- - -# This creates a shared library. - -# Input -# $(SOURCE) - The source code to use -# $(HEADERS) - Exported header files and private header files -# $(LIBRARY) - The name of the library without lib or .so -# $(MAJOR) - The major version number of this library -# $(MINOR) - The minor version number of this library -# $(APT_DOMAIN) - The text domain for this library - -# All output is writtin to .opic files in the build directory to -# signify the PIC output. - -# See defaults.mak for information about LOCAL - -# Some local definitions -LOCAL := lib$(LIBRARY).so.$(MAJOR).$(MINOR) -$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS)) -$(LOCAL)-SONAME := lib$(LIBRARY).so.$(MAJOR) -$(LOCAL)-VERSIONSCRIPT := $(LIB)/lib$(LIBRARY)-$(MAJOR)-$(MINOR).symver -$(LOCAL)-SLIBS := $(SLIBS) -$(LOCAL)-LIBRARY := $(LIBRARY) - -TYPE = src -include $(PODOMAIN_H) - -# Install the command hooks -headers: $($(LOCAL)-HEADERS) -library: $(LIB)/lib$(LIBRARY).so $(LIB)/lib$(LIBRARY).so.$(MAJOR) -clean: clean/$(LOCAL) -veryclean: veryclean/$(LOCAL) - -# Make Directories -MKDIRS += $(OBJ) $(DEP) $(LIB) $(dir $($(LOCAL)-HEADERS)) - -# The clean rules -.PHONY: clean/$(LOCAL) veryclean/$(LOCAL) -clean/$(LOCAL): - -rm -f $($(@F)-OBJS) $($(@F)-DEP) $($(@F)-VERSIONSCRIPT) -veryclean/$(LOCAL): clean/$(LOCAL) - -rm -f $($(@F)-HEADERS) $(LIB)/lib$($(@F)-LIBRARY)*.so* - -# Build rules for the two symlinks -.PHONY: $(LIB)/lib$(LIBRARY).so.$(MAJOR) $(LIB)/lib$(LIBRARY).so -$(LIB)/lib$(LIBRARY).so.$(MAJOR): $(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR) - ln -sf $( $@ - -# The binary build rule -$(LIB)/lib$(LIBRARY).so.$(MAJOR).$(MINOR): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS) $(LIBRARYDEPENDS) $($(LOCAL)-VERSIONSCRIPT) - -rm -f $(LIB)/lib$($(@F)-LIBRARY)*.so* 2> /dev/null - echo Building shared library $@ - $(CXX) $(CXXSTD) $(CXXFLAGS) $(LDFLAGS) -Wl,--version-script=$($(@F)-VERSIONSCRIPT) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\ - -o $@ $(SONAME_MAGIC)$($(@F)-SONAME) -shared \ - $(filter %.opic,$^) \ - $($(@F)-SLIBS) - -# Compilation rules -vpath %.cc $(SUBDIRS) -$(OBJ)/%.opic: %.cc $(LIBRARYDEPENDS) - echo Compiling $< to $@ - $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXSTD) $(CXXFLAGS) $(PICFLAGS) -o $@ '$(abspath $<)' - $(DoDep) - -# Include the dependencies that are available -The_DFiles = $(wildcard $($(LOCAL)-DEP)) -ifneq ($(words $(The_DFiles)),0) -include $(The_DFiles) -endif diff --git a/buildlib/libversion.mak b/buildlib/libversion.mak deleted file mode 100644 index 1b1855be3..000000000 --- a/buildlib/libversion.mak +++ /dev/null @@ -1,14 +0,0 @@ -# -*- make -*- -# Version number of libapt-pkg. -# Please increase MAJOR with each ABI break, -# with each non-ABI break to the lib, please increase RELEASE. -# The versionnumber is extracted from apt-pkg/macros.h - see also there. -LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/contrib/macros.h | sed 's/\.$$//') -LIBAPTPKG_RELEASE=$(shell grep '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/contrib/macros.h | cut -d ' ' -f 3) - -# Version number of libapt-inst -# Please increase MAJOR with each ABI break, -# with each non-ABI break to the lib, please increase MINOR. -# The versionnumber is extracted from apt-inst/makefile - see also there. -LIBAPTINST_MAJOR=$(shell grep '^MAJOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2) -LIBAPTINST_MINOR=$(shell grep '^MINOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2) diff --git a/buildlib/makefile.in b/buildlib/makefile.in deleted file mode 100644 index 66144cfc6..000000000 --- a/buildlib/makefile.in +++ /dev/null @@ -1,46 +0,0 @@ -# -*- make -*- - -# This is the build directory make file, it sets the build directory -# and runs the src makefile. -ifndef NOISY -.SILENT: -endif -include environment.mak - -SRCDIR=@top_srcdir@ -BUILD:=$(shell pwd) -export BUILD - -# Chain to the parent make to do the actual building -.PHONY: headers library clean veryclean all binary program doc \ - veryclean/local -all headers library clean veryclean binary program doc: - $(MAKE) -C $(SRCDIR) -f Makefile $@ - -# Purge everything. -.PHONY: maintainer-clean dist-clean pristine sanity distclean -maintainer-clean dist-clean pristine sanity distclean: - -rm -rf $(DIRS) - -rm -f config.cache config.log config.status environment.mak makefile - -# Create the required directories and build the shims -# The configure script fills in below, and then we do the right things.. -# This cannot go in the configure script since the directories have not yet -# been created.. In any event I like the idea that you can change environment.mak -# and run make dirs and have the shims updated. -.PHONY: dirs -dirs: - $(MAKE) -C $(SRCDIR) -f Makefile $@ -ifeq ($(HAVE_STATVFS),yes) - @rm -f include/statvfs.h > /dev/null 2>&1 -else - @cp -p $(SRCDIR)/buildlib/statvfs.h.in include/statvfs.h - ln -sf . include/sys -endif -ifeq ($(NEED_SOCKLEN_T_DEFINE),yes) - @cp -p $(SRCDIR)/buildlib/netdb.h.in include/netdb.h -else - @rm -f include/netdb.h > /dev/null 2>&1 -endif - rm -f include/python - ln -sf $(PYTHONINCLUDE) include/python diff --git a/buildlib/manpage.mak b/buildlib/manpage.mak deleted file mode 100644 index 063841d86..000000000 --- a/buildlib/manpage.mak +++ /dev/null @@ -1,30 +0,0 @@ -# -*- make -*- - -# This installs man pages into the doc directory - -# Input -# $(SOURCE) - The documents to use - -# All output is written to files in the build doc directory - -# See defaults.mak for information about LOCAL - -# Some local definitions -LOCAL := manpage-$(firstword $(SOURCE)) -$(LOCAL)-LIST := $(addprefix $(DOC)/,$(SOURCE)) - -# Install generation hooks -doc: manpages -manpages: $($(LOCAL)-LIST) -veryclean: veryclean/$(LOCAL) - -MKDIRS += $(DOC) - -$($(LOCAL)-LIST) : $(DOC)/% : % - echo Installing man page $< to $(@D) - cp $< $(@D) - -# Clean rule -.PHONY: veryclean/$(LOCAL) -veryclean/$(LOCAL): - -rm -rf $($(@F)-LIST) diff --git a/buildlib/netdb.h.in b/buildlib/netdb.h.in deleted file mode 100644 index 0fa60e157..000000000 --- a/buildlib/netdb.h.in +++ /dev/null @@ -1,6 +0,0 @@ -/* Fix broken unixen. */ -#include -#ifdef NEED_SOCKLEN_T_DEFINE - #define socklen_t size_t -#endif -#include_next diff --git a/buildlib/po4a_manpage.mak b/buildlib/po4a_manpage.mak deleted file mode 100644 index df12e115c..000000000 --- a/buildlib/po4a_manpage.mak +++ /dev/null @@ -1,74 +0,0 @@ -# -*- make -*- - -# This handles man pages with po4a. We convert to the respective -# output in the source directory then copy over to the final dest. This -# means po4a is only needed if compiling from bzr - -# Input -# $(LC) - The language code of the translation - -# See defaults.mak for information about LOCAL - -# generate a list of accepted man page translations -SOURCE = $(patsubst %.xml,%,$(wildcard *.$(LC).?.xml)) -INCLUDES = apt.ent apt-verbatim.ent apt-vendor.ent - -manpages: - -%.xsl: ../%.xsl - cp -a $< . - -# Do not use XMLTO, build the manpages directly with XSLTPROC -ifdef XSLTPROC - -STYLESHEET=manpage-style.xsl - -LOCAL := po4a-manpage-$(firstword $(SOURCE)) -$(LOCAL)-LIST := $(SOURCE) - -# Install generation hooks -manpages: $($(LOCAL)-LIST) -clean: clean/$(LOCAL) -veryclean: veryclean/$(LOCAL) - -apt-verbatim.ent: ../apt-verbatim.ent - cp -a ../apt-verbatim.ent . - -apt-vendor.ent: ../apt-vendor.ent - cp -a ../apt-vendor.ent . - -$($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES) - echo Creating man page $@ - $(XSLTPROC) \ - --stringparam l10n.gentext.default.language $(LC) \ - -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here??? - test -f $(subst .$(LC),,$@) || echo 'FIXME: xsltproc respects the -o flag now, workaround can be removed' - mv -f $(subst .$(LC),,$@) $@ - -# Clean rule -.PHONY: clean/$(LOCAL) veryclean/$(LOCAL) -clean/$(LOCAL): - rm -f $($(@F)-LIST) apt.ent apt-verbatim.ent -veryclean/$(LOCAL): - # we are nuking the directory we are working in as it is auto-generated - rm -rf '$(abspath .)' - -HAVE_PO4A=yes -endif - -# take care of the rest -INCLUDES := - -ifndef HAVE_PO4A -# Strip from the source list any man pages we don't have compiled already -SOURCE := $(wildcard $(SOURCE)) -endif - -# Chain to the manpage rule -ifneq ($(words $(SOURCE)),0) -include $(MANPAGE_H) -endif - -# DocBook XML Documents -SOURCE := $(wildcard *.$(LC).dbk) -include $(DOCBOOK_H) diff --git a/buildlib/podomain.mak b/buildlib/podomain.mak deleted file mode 100644 index 265359abc..000000000 --- a/buildlib/podomain.mak +++ /dev/null @@ -1,27 +0,0 @@ -# -*- make -*- - -# This creates the file listing used by xgettext and friends based on the -# declared domain of the make file. It also arranges to set the DOMAIN -# CPPFLAG for the compilation. - -ifneq ($(APT_DOMAIN),none) - -MY_DOMAIN := $(PACKAGE) -ifdef APT_DOMAIN -$($(LOCAL)-OBJS): CPPFLAGS := $(CPPFLAGS) -DAPT_DOMAIN='"$(APT_DOMAIN)"' -MY_DOMAIN := $(APT_DOMAIN) -endif - -MKDIRS += $(PO_DOMAINS)/$(MY_DOMAIN) -$(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list: SRC := $(addprefix $(SUBDIR)/,$(SOURCE)) -$(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list: makefile dirs - (echo $(SRC) | xargs -n1 echo) > $@.tmp - cmp --silent $@.tmp $@ || mv $@.tmp $@ -startup binary program clean update-po: $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list - -veryclean: veryclean/$(LOCAL) -veryclean/po/$(LOCAL): LIST := $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list -veryclean/po/$(LOCAL): - rm -f $(LIST) - -endif diff --git a/buildlib/program.mak b/buildlib/program.mak deleted file mode 100644 index 1b4a5719a..000000000 --- a/buildlib/program.mak +++ /dev/null @@ -1,60 +0,0 @@ -# -*- make -*- - -# This creates a program - -# Input -# $(SOURCE) - The source code to use -# $(PROGRAM) - The name of the program -# $(SLIBS) - Shared libs to link against -# $(LIB_MAKES) - Shared library make files to depend on - to ensure we get -# remade when the shared library version increases. - -# See defaults.mak for information about LOCAL - -# Some local definitions -LOCAL := $(PROGRAM) -$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .o.d,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-BIN := $(BIN)/$(PROGRAM) -$(LOCAL)-SLIBS := $(SLIBS) -$(LOCAL)-MKS := $(addprefix $(BASE)/,$(LIB_MAKES)) - -# Install the command hooks -program: $(BIN)/$(PROGRAM) -clean: clean/$(LOCAL) -veryclean: veryclean/$(LOCAL) - -TYPE = src -include $(PODOMAIN_H) - -# Make Directories -MKDIRS += $(OBJ) $(DEP) $(BIN) - -# The clean rules -.PHONY: clean/$(LOCAL) veryclean/$(LOCAL) -clean/$(LOCAL): - -rm -f $($(@F)-OBJS) $($(@F)-DEP) -veryclean/$(LOCAL): clean/$(LOCAL) - -rm -f $($(@F)-BIN) - -# The convience binary build rule -.PHONY: $(PROGRAM) -$(PROGRAM): $($(LOCAL)-BIN) - -# The binary build rule -$($(LOCAL)-BIN): $($(LOCAL)-OBJS) $($(LOCAL)-MKS) - echo Building program $@ - $(CXX) $(CXXSTD) $(CXXFLAGS) $(LDFLAGS) $(LFLAGS) -o $@ $(filter %.o,$^) $($(@F)-SLIBS) $(LEFLAGS) - -# Compilation rules -vpath %.cc $(SUBDIRS) -$(OBJ)/%.o: %.cc - echo Compiling $< to $@ - $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXSTD) $(CXXFLAGS) -o $@ '$(abspath $<)' - $(DoDep) - -# Include the dependencies that are available -The_DFiles = $(wildcard $($(LOCAL)-DEP)) -ifneq ($(words $(The_DFiles)),0) -include $(The_DFiles) -endif diff --git a/buildlib/python.mak b/buildlib/python.mak deleted file mode 100644 index 25349daa0..000000000 --- a/buildlib/python.mak +++ /dev/null @@ -1,68 +0,0 @@ -# -*- make -*- - -# This creates a python shared module. - -# Input -# $(SOURCE) - The source code to use -# $(MODULE) - The name of the module without module or .so - -# All output is writtin to .opic files in the build directory to -# signify the PIC output. - -# See defaults.mak for information about LOCAL - -# Some local definitions -LOCAL := $(MODULE)module.so -$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .opic,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .opic.d,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-SLIBS := $(SLIBS) -$(LOCAL)-MODULE := $(MODULE) - -# Install the command hooks -library: $(LIB)/$(MODULE)module.so -clean: clean/$(LOCAL) -veryclean: veryclean/$(LOCAL) - -# Make Directories -MKDIRS += $(OBJ) $(DEP) $(LIB) - -# The clean rules -.PHONY: clean/$(LOCAL) veryclean/$(LOCAL) -clean/$(LOCAL): - -rm -f $($(@F)-OBJS) $($(@F)-DEP) -veryclean/$(LOCAL): clean/$(LOCAL) - -rm -f $($(@F)-HEADERS) $(LIB)/$($(@F)-MODULE)module.so* - -# The binary build rule. -ifdef PYTHONLIB -ifndef ONLYSTATICLIBS -$(LIB)/$(MODULE)module.so: $($(LOCAL)-OBJS) - -rm -f $(LIB)/$($(@F)-MODULE)module.so* 2> /dev/null - echo Building shared Python module $@ - $(CXX) $(CXXSTD) $(CXXFLAGS) $(LDFLAGS) $(PICFLAGS) $(LFLAGS) $(LFLAGS_SO)\ - -o $@ -shared \ - $(filter %.opic,$^) \ - $($(@F)-SLIBS) $(PYTHONLIB) -else -.PHONY: $(LIB)/$(MODULE)module.so -$(LIB)/$(MODULE)module.so: - echo Don't know how to make a python module here, not building $@ -endif # ifndef ONLYSTATICLIBS -else -.PHONY: $(LIB)/$(MODULE)module.so -$(LIB)/$(MODULE)module.so: - echo No python support, not building $@ -endif # ifdef PYTHONLIB - -# Compilation rules -vpath %.cc $(SUBDIRS) -$(OBJ)/%.opic: %.cc - echo Compiling $< to $@ - $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXSTD) $(CXXFLAGS) $(PICFLAGS) -o $@ '$(abspath $<)' - $(DoDep) - -# Include the dependencies that are available -The_DFiles = $(wildcard $($(LOCAL)-DEP)) -ifneq ($(words $(The_DFiles)),0) -include $(The_DFiles) -endif diff --git a/buildlib/staticlibrary.mak b/buildlib/staticlibrary.mak deleted file mode 100644 index e81770e8a..000000000 --- a/buildlib/staticlibrary.mak +++ /dev/null @@ -1,60 +0,0 @@ -# -*- make -*- - -# This creates a static library. - -# Input -# $(SOURCE) - The source code to use -# $(HEADERS) - Exported header files and private header files -# $(LIBRARY) - The name of the library without lib or .so - -# All output is writtin to .o files in the build directory - -# See defaults.mak for information about LOCAL - -# Some local definitions -LOCAL := lib$(LIBRARY).a -$(LOCAL)-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-DEP := $(addprefix $(DEP)/,$(addsuffix .o.d,$(notdir $(basename $(SOURCE))))) -$(LOCAL)-HEADERS := $(addprefix $(INCLUDE)/,$(HEADERS)) -$(LOCAL)-LIB := $(LIB)/lib$(LIBRARY).a - -# Install the command hooks -headers: $($(LOCAL)-HEADERS) -library: $($(LOCAL)-LIB) -clean: clean/$(LOCAL) -veryclean: veryclean/$(LOCAL) - -# Make Directories -MKDIRS += $(OBJ) $(DEP) $(LIB) $(dir $($(LOCAL)-HEADERS)) - -# The clean rules -.PHONY: clean/$(LOCAL) veryclean/$(LOCAL) -clean/$(LOCAL): - -rm -f $($(@F)-OBJS) $($(@F)-DEP) -veryclean/$(LOCAL): clean/$(LOCAL) - -rm -f $($(@F)-HEADERS) $($(@F)-LIB) - -# Build rules for the two symlinks -.PHONY: $($(LOCAL)-LIB) - -# The binary build rule -$($(LOCAL)-LIB): $($(LOCAL)-HEADERS) $($(LOCAL)-OBJS) - echo Building library $@ - -rm $@ > /dev/null 2>&1 - $(AR) cq $@ $(filter %.o,$^) -ifneq ($(words $(RANLIB)),0) - $(RANLIB) $@ -endif - -# Compilation rules -vpath %.cc $(SUBDIRS) -$(OBJ)/%.o: %.cc - echo Compiling $< to $@ - $(CXX) -c $(INLINEDEPFLAG) $(CPPFLAGS) $(CXXSTD) $(CXXFLAGS) -o $@ '$(abspath $<)' - $(DoDep) - -# Include the dependencies that are available -The_DFiles = $(wildcard $($(LOCAL)-DEP)) -ifneq ($(words $(The_DFiles)),0) -include $(The_DFiles) -endif diff --git a/buildlib/statvfs.h.in b/buildlib/statvfs.h.in deleted file mode 100644 index d0ec238ad..000000000 --- a/buildlib/statvfs.h.in +++ /dev/null @@ -1,13 +0,0 @@ -/* Compatibility for systems with out Single Unix Spec statvfs */ -#include - -#ifdef HAVE_VFS_H -#include -#endif - -#ifdef HAVE_MOUNT_H -#include -#include -#endif - -#define statvfs statfs diff --git a/buildlib/tools.m4 b/buildlib/tools.m4 deleted file mode 100644 index 433d5ca32..000000000 --- a/buildlib/tools.m4 +++ /dev/null @@ -1,110 +0,0 @@ -AC_DEFUN([ah_HAVE_GETCONF], - [AC_ARG_WITH(getconf, - [ --with-getconf Enable automagical buildtime configuration], - [if test "$withval" = "yes"; then - AC_PATH_PROG(GETCONF, getconf) - elif test ! "$withval" = "no";then - AC_MSG_CHECKING([getconf]) - AC_MSG_RESULT([$withval]) - GETCONF=$withval - fi], - [AC_PATH_PROG(GETCONF, getconf)] - ) - AC_SUBST(GETCONF) -]) - -dnl ah_GET_CONF(variable, value ..., [default]) -AC_DEFUN([ah_GET_GETCONF], - [AC_REQUIRE([ah_HAVE_GETCONF]) - if test ! -z "$GETCONF";then - old_args="[$]@" - set -- $2 - while eval test -z \"\$$1\" -a ! -z \"[$]1\";do - eval $1=`$GETCONF "[$]1" 2>/dev/null` - shift - done - fi - if eval test -z \"\$$1\" -o \"\$$1\" = "-1";then - eval $1="$3" - fi -]) -AC_DEFUN([ah_NUM_CPUS], - [AC_MSG_CHECKING([number of cpus]) - AC_ARG_WITH(cpus, - [ --with-cpus The number of cpus to be used for building(see --with-procs, default 1)], - [ - if test "$withval" = "yes"; then - ah_GET_GETCONF(NUM_CPUS, SC_NPROCESSORS_ONLN _NPROCESSORS_ONLN, 1) - elif test ! "$withval" = "no";then - NUM_CPUS=$withval - elif test "$withval" = "no";then - NUM_CPUS=1 - fi], - [ah_GET_GETCONF(NUM_CPUS, SC_NPROCESSORS_ONLN _NPROCESSORS_ONLN, 1)] - ) - ah_NUM_CPUS_msg="$NUM_CPUS" - if test "$NUM_CPUS" = "0"; then - # broken getconf, time to bitch. - ah_NUM_CPUS_msg="found 0 cpus. Has someone done a lobotomy?" - NUM_CPUS=1 - fi - if test $NUM_CPUS = 1 ;then - default_PROC_MULTIPLY=1 - else - default_PROC_MULTIPLY=2 - fi - AC_MSG_RESULT([$ah_NUM_CPUS_msg]) - AC_SUBST(NUM_CPUS) -]) -AC_DEFUN([ah_PROC_MULTIPLY], - [AC_REQUIRE([ah_NUM_CPUS]) - AC_MSG_CHECKING([processor multiplier]) - AC_ARG_WITH(proc-multiply, - [ --with-proc-multiply Multiply this * number of cpus for parallel making(default 2).], - [if test "$withval" = "yes"; then - PROC_MULTIPLY=$default_PROC_MULTIPLY - elif test ! "$withval" = "no";then - PROC_MULTIPLY=$withval - fi], - [PROC_MULTIPLY=$default_PROC_MULTIPLY] - ) - AC_MSG_RESULT([$PROC_MULTIPLY]) - AC_SUBST(PROC_MULTIPLY) -]) - -AC_DEFUN([ah_NUM_PROCS], - [AC_REQUIRE([ah_PROC_MULTIPLY]) - AC_REQUIRE([ah_NUM_CPUS]) - AC_MSG_CHECKING([number of processes to run during make]) - AC_ARG_WITH(procs, - [ --with-procs The number of processes to run in parallel during make(num_cpus * multiplier).], - [if test "$withval" = "yes"; then - NUM_PROCS=`expr $NUM_CPUS \* $PROC_MULTIPLY` - elif test ! "$withval" = "no";then - NUM_PROCS=$withval - fi], - [NUM_PROCS=`expr $NUM_CPUS \* $PROC_MULTIPLY`] - ) - AC_MSG_RESULT([$NUM_PROCS]) - AC_SUBST(NUM_PROCS) -]) - -AC_DEFUN([ah_GCC3DEP],[ - AC_MSG_CHECKING(if $CXX -MD works) - touch gcc3dep.cc - ${CXX-c++} -MD -o gcc3dep_test.o -c gcc3dep.cc - rm -f gcc3dep.cc gcc3dep_test.o - if test -e gcc3dep.d; then - rm -f gcc3dep.d - GCC_MD=input - GCC3DEP= - elif test -e gcc3dep_test.d; then - rm -f gcc3dep_test.d - GCC_MD=output - GCC3DEP=yes - else - AC_MSG_ERROR(no) - fi - AC_MSG_RESULT([yes, for $GCC_MD]) - AC_SUBST(GCC3DEP) -]) diff --git a/cmdline/makefile b/cmdline/makefile deleted file mode 100644 index 8b79ce05f..000000000 --- a/cmdline/makefile +++ /dev/null @@ -1,119 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=cmdline - -# Bring in the default rules -include ../buildlib/defaults.mak - -# The apt program -PROGRAM=apt -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt.cc -include $(PROGRAM_H) - -# The apt-cache program -PROGRAM=apt-cache -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-cache.cc -include $(PROGRAM_H) - -# The apt-get program -PROGRAM=apt-get -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-get.cc -include $(PROGRAM_H) - -# The apt-config program -PROGRAM=apt-config -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-config.cc -include $(PROGRAM_H) - -# The apt-cdrom program -PROGRAM=apt-cdrom -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-cdrom.cc -include $(PROGRAM_H) - -# The apt-mark program -PROGRAM=apt-mark -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-mark.cc -include $(PROGRAM_H) - -# The apt-helper -PROGRAM=apt-helper -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -lresolv -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-helper.cc -include $(PROGRAM_H) - -# The apt-report-mirror-failure program -#SOURCE=apt-report-mirror-failure -#TO=$(BIN) -#TARGET=program -#include $(COPY_H) - -# -# the following programs are shipped in apt-utils -# -APT_DOMAIN:=apt-utils - -# The apt-sortpkgs program -PROGRAM=apt-sortpkgs -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-sortpkgs.cc -include $(PROGRAM_H) - -# The apt-extracttemplates program -PROGRAM=apt-extracttemplates -SLIBS = -lapt-pkg -lapt-inst -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-inst/makefile apt-private/makefile -SOURCE = apt-extracttemplates.cc -include $(PROGRAM_H) - -# The internal solver/planner acting as an external -PROGRAM=apt-internal-solver -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-internal-solver.cc -include $(PROGRAM_H) - -PROGRAM=apt-internal-planner -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-internal-planner.cc -include $(PROGRAM_H) - -# This just dumps out the state -PROGRAM=apt-dump-solver -SLIBS = -lapt-pkg -lapt-private $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-private/makefile -SOURCE = apt-dump-solver.cc -include $(PROGRAM_H) - -# The apt-key program -apt-key: apt-key.in - sed -e "s#&keyring-filename;#$(shell ../vendor/getinfo keyring-filename)#" \ - -e "s#&keyring-removed-filename;#$(shell ../vendor/getinfo keyring-removed-filename)#" \ - -e "s#&keyring-master-filename;#$(shell ../vendor/getinfo keyring-master-filename)#" \ - -e "s#&keyring-uri;#$(shell ../vendor/getinfo keyring-uri)#" \ - -e "s#&keyring-package;#$(shell ../vendor/getinfo keyring-package)#" $< > $@ - chmod 755 $@ - -SOURCE=apt-key -TO=$(BIN) -TARGET=program -include $(COPY_H) - -clean: clean/apt-key - -clean/apt-key: - rm -f apt-key diff --git a/configure.ac b/configure.ac deleted file mode 100644 index c1e61da66..000000000 --- a/configure.ac +++ /dev/null @@ -1,218 +0,0 @@ -ad -dnl Process this file with autoconf to produce a configure script. -dnl The ONLY thing this is used for is to configure for different -dnl linux architectures and configurations, it is not used to make the -dnl code more portable - -dnl You MUST have an environment that has all the POSIX functions and -dnl some of the more popular bsd/sysv ones (like select). You'll also -dnl need a C++ compiler that is semi-standard conformant, exceptions are -dnl not used but STL is. - -dnl 'make -f Makefile startup' will generate the configure file from -dnl configure.ac correctly and can be run at any time - -AC_PREREQ([2.68]) -AC_INIT -AC_CONFIG_SRCDIR([configure.ac]) -AC_CONFIG_AUX_DIR(buildlib) -AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) - -PACKAGE="apt" -PACKAGE_VERSION="1.3~pre3+cmake2" -PACKAGE_MAIL="APT Development Team " -AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") -AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION") -AC_DEFINE_UNQUOTED(PACKAGE_MAIL,"$PACKAGE_MAIL") -AC_SUBST(PACKAGE) -AC_SUBST(PACKAGE_VERSION) -AC_SUBST(PACKAGE_MAIL) - -dnl Check the archs, we want the target type. -AC_CANONICAL_TARGET - -dnl Check our C compiler - -AC_PROG_CC -AC_SEARCH_LIBS([strerror],[cposix]) - -dnl check for large file support and enable it if possible -dnl do this early as other stuff might depend on it -AC_SYS_LARGEFILE - -dnl Check for other programs -AC_PROG_CXX -AC_PROG_CPP -AC_PROG_RANLIB -AC_CHECK_TOOL(AR,ar,"ar") - -dnl Checks for sockets -SAVE_LIBS="$LIBS" -LIBS="" -AC_SEARCH_LIBS(gethostbyname,nsl) -AC_SEARCH_LIBS(connect,socket) -SOCKETLIBS="$LIBS" -AC_SUBST(SOCKETLIBS) -LIBS="$SAVE_LIBS" - -dnl Checks for pthread -AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"]) -AC_SUBST(PTHREADLIB) -if test "$PTHREADLIB" != "-lpthread"; then - AC_MSG_ERROR(failed: I need posix threads, pthread) -fi - -dnl Check for BDB -saveLIBS="$LIBS" -LIBS="$LIBS -ldb" - -AC_CHECK_HEADER(db.h, - [AC_MSG_CHECKING(if we can link against BerkeleyDB) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [int r, s, t; db_version(&r, &s, &t);] - )], - [AC_DEFINE(HAVE_BDB) - BDBLIB="-ldb" - AC_MSG_RESULT(yes)], - [BDBLIB="" - AC_MSG_RESULT(no)] - )] -) - -LIBS="$saveLIBS" - -AC_CHECK_LIB(curl, curl_easy_init, - [AC_CHECK_HEADER(curl/curl.h, - curl_ok=yes, - curl_ok=no)], - AC_MSG_ERROR([failed: I need CURL due https support]), -) - -AC_LANG_PUSH([C++]) -AC_CHECK_HEADER(gtest/gtest.h,, - AC_MSG_WARN([failed: I need gtest (packaged as libgtest-dev) for unit testing]), -) -AC_LANG_POP([C++]) - - -AC_SUBST(BDBLIB) - -HAVE_ZLIB=no -AC_CHECK_LIB(z, gzopen, - [AC_CHECK_HEADER(zlib.h, [HAVE_ZLIB=yes], AC_MSG_ERROR([failed: zlib.h not found]))], - AC_MSG_ERROR([failed: Need libz])) -AC_SUBST(HAVE_ZLIB) -if test "x$HAVE_ZLIB" = "xyes"; then - AC_DEFINE(HAVE_ZLIB) -fi - -HAVE_LZ4=no -AC_CHECK_LIB(lz4, LZ4F_createCompressionContext,[AC_CHECK_HEADER(lz4frame.h, [HAVE_LZ4=yes], [])], []) -AC_SUBST(HAVE_LZ4) -if test "x$HAVE_LZ4" = "xyes"; then - AC_DEFINE(HAVE_LZ4) -fi - -HAVE_BZ2=no -AC_CHECK_LIB(bz2, BZ2_bzopen,[AC_CHECK_HEADER(bzlib.h, [HAVE_BZ2=yes], [])], []) -AC_SUBST(HAVE_BZ2) -if test "x$HAVE_BZ2" = "xyes"; then - AC_DEFINE(HAVE_BZ2) -fi - -HAVE_LZMA=no -AC_CHECK_LIB(lzma, lzma_easy_encoder,[AC_CHECK_HEADER(lzma.h, [HAVE_LZMA=yes], [])], []) -AC_SUBST(HAVE_LZMA) -if test "x$HAVE_LZMA" = "xyes"; then - AC_DEFINE(HAVE_LZMA) -fi - -dnl Converts the ARCH to be something singular for this general CPU family -dnl This is often the dpkg architecture string. -dnl First check against the full canonical canoncial-system-type in $target -dnl and if that fails, just look for the cpu -AC_MSG_CHECKING(debian architecture) -archset="`dpkg-architecture -qDEB_HOST_ARCH`" -if test "x$archset" = "x"; then - AC_MSG_ERROR([failed: use --host= or output from dpkg-architecture]) -fi -AC_MSG_RESULT($archset) -AC_DEFINE_UNQUOTED(COMMON_ARCH,"$archset") - -dnl Single Unix Spec statvfs -AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes]) -AC_SUBST(HAVE_STATVFS) - -dnl Arg, linux and bsd put their statfs function in different places -if test x"$HAVE_STATVFS" != x"yes"; then - AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[ - AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)]) - ]) -fi - -AC_CHECK_MEMBERS([struct statfs.f_type],,, - [$ac_includes_default - #include ]) - -dnl We should use the real timegm function if we have it. -AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM)) -AC_SUBST(HAVE_TIMEGM) - -dnl Check the architecture -AC_C_BIGENDIAN - -dnl HP-UX sux.. -AC_MSG_CHECKING(for missing socklen_t) -AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[ - AC_DEFINE(NEED_SOCKLEN_T_DEFINE) - NEED_SOCKLEN_T_DEFINE=yes - AC_MSG_RESULT(missing.)]) -AC_SUBST(NEED_SOCKLEN_T_DEFINE) - -dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno -AC_MSG_CHECKING(for h_errno) -AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)], - [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" - AC_EGREP_HEADER(h_errno, netdb.h, - [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)], - [AC_MSG_ERROR("not found.")]) - ]) - - -dnl check for setuid checking function -AC_CHECK_FUNCS(getresuid getresgid setresuid setresgid) -AC_SUBST(HAVE_GETRESUID) -AC_SUBST(HAVE_GETRESGID) -AC_SUBST(HAVE_SETRESUID) -AC_SUBST(HAVE_SETRESGID) - -dnl Check for doxygen -AC_PATH_PROG(DOXYGEN, doxygen) - -dnl Check for the XSLTProc tool needed to build man pages together with po4a -AC_PATH_PROG(XSLTPROC,xsltproc) -AC_PATH_PROG(W3M, w3m) - -dnl Check for the po4a tool needed to build man pages -AC_PATH_PROG(PO4A,po4a) - -dnl Check for graphviz -AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO]) -AC_PATH_PROG([DOT], [dot], []) -DOTDIR=$(dirname $DOT) -AC_SUBST(DOTDIR) - -ah_NUM_PROCS -ah_GCC3DEP - -AM_GNU_GETTEXT(external) -if test x"$USE_NLS" = "xyes"; then - AC_DEFINE(USE_NLS) -fi -AC_SUBST(USE_NLS) -AC_PATH_PROG(BASH, bash) - -AC_CONFIG_FILES([environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile:doc/Doxyfile.in]) -AC_OUTPUT diff --git a/doc/en/makefile b/doc/en/makefile deleted file mode 100644 index 8659de6f6..000000000 --- a/doc/en/makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=doc/en - -# Bring in the default rules -include ../../buildlib/defaults.mak - -# Do not use XMLTO, build the manpages directly with XSLTPROC -ifdef XSLTPROC -# generate a list of accepted man page translations -SOURCE = $(patsubst ../%.xml,%,$(wildcard ../*.?.xml)) -INCLUDES = ../apt.ent ../apt-verbatim.ent apt-vendor.ent -STYLESHEET=../manpage-style.xsl - -LOCAL := manpage-$(firstword $(SOURCE)) -$(LOCAL)-LIST := $(SOURCE) - -apt-vendor.ent: ../../vendor/current/apt-vendor.ent - ln -sf '$(abspath $^)' $@ - -# Install generation hooks -manpages: $($(LOCAL)-LIST) - -$($(LOCAL)-LIST) :: % : ../%.xml $(STYLESHEET) $(INCLUDES) - echo Creating man page $@ - $(XSLTPROC) -o $@ $(STYLESHEET) $< - -# Clean rule -.PHONY: clean/$(LOCAL) -veryclean: clean/$(LOCAL) -clean: clean/$(LOCAL) -clean/$(LOCAL): - -rm -rf $($(@F)-LIST) apt-vendor.ent -endif - -# Chain to the manpage rule -include $(MANPAGE_H) diff --git a/doc/lang.makefile b/doc/lang.makefile deleted file mode 100644 index 9fdc6ea70..000000000 --- a/doc/lang.makefile +++ /dev/null @@ -1,11 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=doc/@@LANG@@ - -# Bring in the default rules -include ../../buildlib/defaults.mak - -# Language Code of this translation -LC=@@LANG@@ - -include $(PO4A_MANPAGE_H) diff --git a/doc/makefile b/doc/makefile deleted file mode 100644 index 785c0b125..000000000 --- a/doc/makefile +++ /dev/null @@ -1,113 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=doc - -# Bring in the default rules -include ../buildlib/defaults.mak - -# DocBook XML Documents -SOURCE = $(wildcard *.dbk) -LC = en -include $(DOCBOOK_H) - -doc: manpages docbook - -examples/sources.list: ../vendor/current/sources.list - ln -sf '$(abspath $^)' $@ - -apt-vendor.ent: ../vendor/current/apt-vendor.ent - ln -sf '$(abspath $^)' $@ - -# Examples -SOURCE = examples/apt.conf examples/sources.list examples/configure-index examples/apt-https-method-example.conf -TO = $(DOC) -TARGET = binary -include $(COPY_H) - -.PHONY: clean clean/subdirs veryclean veryclean/subdirs manpages/subdirs docbook/subdirs all binary doc stats - -clean: clean/subdirs clean/examples -veryclean: veryclean/subdirs clean/examples -manpages: apt-vendor.ent manpages/subdirs -docbook: apt-vendor.ent docbook/subdirs - -DOCUMENTATIONPO = $(patsubst %.po,%,$(notdir $(wildcard po/*.po))) -DOCDIRLIST = $(addsuffix /makefile,$(DOCUMENTATIONPO)) - -dirs: $(DOCDIRLIST) -$(DOCDIRLIST) :: %/makefile : lang.makefile - test -d $(dir $@) || mkdir $(dir $@) - sed "s#@@LANG@@#$(subst /,,$(dir $@))#" $< > $@ - -docbook/subdirs manpages/subdirs clean/subdirs veryclean/subdirs: - for dir in en $(dir $(DOCDIRLIST)); do \ - $(MAKE) -C $$dir $(patsubst %/subdirs,%,$@); \ - done - -clean/examples: - rm -f examples/sources.list - rm -f apt-vendor.ent - -stats: - for i in po/*.po; do echo -n "$$i: "; msgfmt --output-file=/dev/null --statistics $$i; done - -ifdef PO4A -MANPAGEPOLIST = $(addprefix manpages-translation-,$(DOCUMENTATIONPO)) -DOCBOOKPOLIST = $(addprefix docbook-translation-,$(DOCUMENTATIONPO)) - -.PHONY: update-po po4a $(MANPAGEPOLIST) $(DOCBOOKPOLIST) $(DOCDIRLIST) - -po4a: manpages/subdirs docbook/subdirs - -update-po: - po4a --previous --no-backups --force --no-translations \ - --msgmerge-opt --add-location=file \ - --porefs noline,wrap \ - --package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \ - --msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf - sed -n '/^#$$/,$$p' po/apt-doc.pot > po/apt-doc.pot.headerfree - #cat po/apt-doc.pot > po/apt-doc.pot.headerfree - cat po/header.pot.txt po/apt-doc.pot.headerfree > po/apt-doc.pot - rm -f po/apt-doc.pot.headerfree - -manpages/subdirs: $(MANPAGEPOLIST) -$(MANPAGEPOLIST) :: manpages-translation-% : %/makefile po4a.conf - po4a --previous --no-backups --translate-only $(dir $<)apt.ent \ - --msgmerge-opt --add-location=file \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.1.xml,%.$(subst /,,$(dir $<)).1.xml,$(wildcard *.1.xml))) \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.2.xml,%.$(subst /,,$(dir $<)).2.xml,$(wildcard *.2.xml))) \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.3.xml,%.$(subst /,,$(dir $<)).3.xml,$(wildcard *.3.xml))) \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.4.xml,%.$(subst /,,$(dir $<)).4.xml,$(wildcard *.4.xml))) \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.5.xml,%.$(subst /,,$(dir $<)).5.xml,$(wildcard *.5.xml))) \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.6.xml,%.$(subst /,,$(dir $<)).6.xml,$(wildcard *.6.xml))) \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.7.xml,%.$(subst /,,$(dir $<)).7.xml,$(wildcard *.7.xml))) \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.8.xml,%.$(subst /,,$(dir $<)).8.xml,$(wildcard *.8.xml))) \ - --package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \ - --msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf - -docbook/subdirs: $(DOCBOOKPOLIST) -$(DOCBOOKPOLIST) :: docbook-translation-% : %/makefile po4a.conf - po4a --previous --no-backups --translate-only $(dir $<)apt.ent \ - --msgmerge-opt --add-location=file \ - $(patsubst %,--translate-only $(dir $<)%,$(patsubst %.dbk,%.$(subst /,,$(dir $<)).dbk,$(wildcard *.dbk))) \ - --package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \ - --msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf -endif - -ifdef DOXYGEN -DOXYGEN_SOURCES = $(shell find $(BASE)/apt-pkg -not -name .\\\#* -and \( -name \*.cc -or -name \*.h \) ) - -clean: doxygen-clean - -doxygen-clean: - rm -fr $(BUILD)/doc/doxygen - rm -f $(BUILD)/doc/doxygen-stamp - -$(BUILD)/doc/doxygen-stamp: $(DOXYGEN_SOURCES) $(BUILD)/doc/Doxyfile - rm -fr $(BUILD)/doc/doxygen - mkdir $(BUILD)/doc/doxygen # some versions seem to not create this directory #628799 - $(DOXYGEN) $(BUILD)/doc/Doxyfile - touch $(BUILD)/doc/doxygen-stamp - -docbook: $(BUILD)/doc/doxygen-stamp -endif diff --git a/dselect/makefile b/dselect/makefile deleted file mode 100644 index fab72b264..000000000 --- a/dselect/makefile +++ /dev/null @@ -1,17 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=dselect - -# Bring in the default rules -include ../buildlib/defaults.mak - -# DSelect interfacing directory -SOURCE = desc.apt install names setup update -TO = $(BUILD)/scripts/dselect -TARGET = program -include $(COPY_H) - -# LOCAL = dselect -SOURCE = install update -TYPE = sh -include $(PODOMAIN_H) diff --git a/ftparchive/makefile b/ftparchive/makefile deleted file mode 100644 index c80487c3f..000000000 --- a/ftparchive/makefile +++ /dev/null @@ -1,21 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=ftparchive - -# Bring in the default rules -include ../buildlib/defaults.mak - -# The apt-ftparchive program -ifdef BDBLIB -APT_DOMAIN:=apt-utils -PROGRAM=apt-ftparchive -SLIBS = -lapt-pkg -lapt-inst -lapt-private $(BDBLIB) $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile apt-inst/makefile apt-private/makefile -SOURCE = apt-ftparchive.cc cachedb.cc writer.cc contents.cc override.cc \ - multicompress.cc sources.cc byhash.cc -include $(PROGRAM_H) -else -PROGRAM=apt-ftparchive -MESSAGE="Must have libdb to build apt-ftparchive" -include $(FAIL_H) -endif # ifdef BDBLIB diff --git a/methods/makefile b/methods/makefile deleted file mode 100644 index 3274e9279..000000000 --- a/methods/makefile +++ /dev/null @@ -1,110 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=methods - -# Bring in the default rules -include ../buildlib/defaults.mak -BIN := $(BIN)/methods - -include ../buildlib/libversion.mak -APT_DOMAIN := apt - -# The file method -PROGRAM=file -SLIBS = -lapt-pkg $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = file.cc -include $(PROGRAM_H) - -# The copy method -PROGRAM=copy -SLIBS = -lapt-pkg $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = copy.cc -include $(PROGRAM_H) - -# The store method -PROGRAM=store -SLIBS = -lapt-pkg $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = store.cc -include $(PROGRAM_H) - -# The gpgv method -PROGRAM=gpgv -SLIBS = -lapt-pkg $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = gpgv.cc -include $(PROGRAM_H) - -# The cdrom method -PROGRAM=cdrom -SLIBS = -lapt-pkg $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = cdrom.cc -include $(PROGRAM_H) - -# The http method -PROGRAM=http -SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS) -lresolv -LIB_MAKES = apt-pkg/makefile -SOURCE = http.cc http_main.cc rfc2553emu.cc connect.cc server.cc -include $(PROGRAM_H) - -# The https method -PROGRAM=https -SLIBS = -lapt-pkg -lcurl $(INTLLIBS) -lresolv -LIB_MAKES = apt-pkg/makefile -SOURCE = https.cc server.cc -include $(PROGRAM_H) - -# The ftp method -PROGRAM=ftp -SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS) -lresolv -LIB_MAKES = apt-pkg/makefile -SOURCE = ftp.cc rfc2553emu.cc connect.cc -include $(PROGRAM_H) - -# The rred method -PROGRAM=rred -SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = rred.cc -include $(PROGRAM_H) - -# The rsh method -PROGRAM=rsh -SLIBS = -lapt-pkg $(INTLLIBS) -LIB_MAKES = apt-pkg/makefile -SOURCE = rsh.cc -include $(PROGRAM_H) - -# The mirror method -PROGRAM=mirror -SLIBS = -lapt-pkg $(SOCKETLIBS) -lresolv -LIB_MAKES = apt-pkg/makefile -SOURCE = mirror.cc http.cc rfc2553emu.cc connect.cc server.cc -include $(PROGRAM_H) - -# SSH method symlink -binary: $(BIN)/ssh -veryclean: clean-$(BIN)/ssh - -$(BIN)/ssh: - echo "Installing ssh method link" - ln -fs rsh $(BIN)/ssh -clean-$(BIN)/ssh: - -rm $(BIN)/ssh - -# create compat links for all compressors -COMPRESSORS=gzip bzip2 lzma xz - -binary: $(addprefix $(BIN)/,$(COMPRESSORS)) -veryclean: $(addprefix clean-$(BIN)/,$(COMPRESSORS)) - -$(addprefix $(BIN)/,$(COMPRESSORS)): $(BIN)/store - echo "Installing $(notdir $@) method link" - ln -fs store $@ - -$(addprefix clean-$(BIN)/,$(COMPRESSORS)): - -rm $(BIN)/$(notdir $@) diff --git a/po/LINGUAS b/po/LINGUAS deleted file mode 100644 index 6d77cf856..000000000 --- a/po/LINGUAS +++ /dev/null @@ -1,7 +0,0 @@ -## If a language isn't listed here but a po file is available the build will fail. -## If a language is disabled deliberately, list it in a line starting with a single '#' - -ar ast bg bs ca cs cy da de dz el es eu fi fr gl hu it ja km ko ku lt mr nb ne nl nn pl pt pt_BR ro ru sk sl sv th tl tr uk vi zh_CN zh_TW - -## disabled by translator request #313283: -# he diff --git a/po/makefile b/po/makefile deleted file mode 100644 index f42d476a3..000000000 --- a/po/makefile +++ /dev/null @@ -1,114 +0,0 @@ -# -*- make -*- - -# This will compile the gettext message catalogues. - -# The other make files drop file lists in build/po/domains/DOMAIN/* which -# is then picked up by this make file to define all the domains and all the -# source files that compose each domain. It then produces the POT files -# and then filters the PO files through the per-domain POT file to create -# the input to msgformat, which is then dumped into a locale directory. - -BASE=.. -SUBDIR=po - -# Bring in the default rules -include ../buildlib/defaults.mak - -CATALOGS := $(addsuffix .gmo, $(shell sed -e '/^\#/ d' -e '/^$$/ d' LINGUAS | tr '\n' ' ')) -DOMAINS := $(sort $(notdir $(wildcard $(PO_DOMAINS)/*))) -POTFILES := $(addsuffix .pot,$(addprefix $(PO)/,$(DOMAINS))) - -# Construct a list of all mo files for all domains under $(PO_DOMAINS) -MOFILES := $(patsubst %.gmo,%.mo,$(CATALOGS)) -MOFILES := $(foreach D,$(DOMAINS),$(addprefix $(PO_DOMAINS)/$(D)/,$(MOFILES))) -LANG_POFILES := $(patsubst %.mo,%.po,$(MOFILES)) -LINGUAS := $(patsubst %.gmo,%,$(CATALOGS)) - -GETDOMAIN = $(word 1,$(subst /, ,$(1))) - -# Generate the list of files from the bits the other make files dropped -# and produce the .pot file. -$(POTFILES) : $(PO)/%.pot : - echo "Generating POT file $@" - echo $@ : $(wildcard $(PO)/domains/$*/*.*list) $(addprefix $(BASE)/,$(shell cat $(wildcard $(PO)/domains/$*/*.srclist))) > $@.d.tmp - cmp --silent $@.d.tmp $@.d || mv $@.d.tmp $@.d -# From sh source - cat $(PO)/domains/$*/*.shlist 2> /dev/null | (cd $(BASE) && xargs -n1 bash --dump-po-strings) > $(PO)/domains/$*/sh.pot.tmp - cmp --silent $(PO)/domains/$*/sh.pot.tmp $(PO)/domains/$*/sh.pot || \ - mv $(PO)/domains/$*/sh.pot.tmp $(PO)/domains/$*/sh.pot -# From C/C++ source - cat $(PO)/domains/$*/*.srclist | sort > $(PO)/POTFILES_$*.in - $(XGETTEXT) --default-domain=$* --directory=$(BASE) \ - --add-comments --foreign --keyword=_ --keyword=N_ \ - --add-location=file \ - --keyword=P_:1,2 \ - --files-from=$(PO)/POTFILES_$*.in -o $(PO)/domains/$*/c.pot.tmp - cmp --silent $(PO)/domains/$*/c.pot.tmp $(PO)/domains/$*/c.pot || \ - mv $(PO)/domains/$*/c.pot.tmp $(PO)/domains/$*/c.pot - rm -f $(PO)/POTFILES_$*.in - $(MSGCOMM) --omit-header --more-than=0 $(PO)/domains/$*/c.pot $(PO)/domains/$*/sh.pot --output=$@.tmp - cmp --silent $@ $@.tmp || mv $@.tmp $@ - # copy into the domain dirs to make rosetta happy - rm -f $(PO)/domains/$*/*.pot - cp $@ $(PO)/domains/$* - -# Filter the complete translation with the domain specific file to produce -# only the subtext needed for this domain -# We cannot express the dependencies required for this directly with a pattern -# rule, so we use the .d hack. -$(LANG_POFILES) : $(PO_DOMAINS)/%.po : $(POTFILES) - printf "%s " "Generating $@" - echo $@ : $(notdir $@) $(PO)/$(call GETDOMAIN,$*).pot > $(PO)/$(call GETDOMAIN,$*)_$(notdir $@).d - $(MSGMERGE) --add-location=file $(notdir $@) $(PO)/$(call GETDOMAIN,$*).pot -o $@ - -$(MOFILES) : $(PO_DOMAINS)/%.mo : $(PO_DOMAINS)/%.po - printf "%s: " "Generating $(LOCALE)/$(notdir $*)/LC_MESSAGES/$(call GETDOMAIN,$*).mo" - $(GMSGFMT) --statistics -o $@ $< - mkdir -p $(LOCALE)/$(notdir $*)/LC_MESSAGES/ - cp $@ $(LOCALE)/$(notdir $*)/LC_MESSAGES/$(call GETDOMAIN,$*).mo - -stats: all-linguas-enabled - for i in *.pot *.po; do echo -n "$$i: "; msgfmt --output-file=/dev/null --statistics $$i; done - -binary: $(POTFILES) $(MOFILES) all-linguas-enabled - -$(PACKAGE)-all.pot: $(POTFILES) - # we create our partial pot files without a header to avoid changing dates in *.mo files, - # but we want a header for our master-pot file, so we use a dummy pot with nothing but the header - $(XGETTEXT) --default-domain=$(PO)/$(PACKAGE)-dummy.pot --foreign --language=c \ - -o $(PO)/$(PACKAGE)-dummy.pot --force-po --package-name='$(PACKAGE)' \ - --package-version='$(PACKAGE_VERSION)' --msgid-bugs-address='$(PACKAGE_MAIL)' /dev/null - $(MSGCOMM) --more-than=0 $(PO)/$(PACKAGE)-dummy.pot $(POTFILES) --output=$(PACKAGE)-all.pot - rm -f $(PO)/$(PACKAGE)-dummy.pot - -.PHONY: update-po all-linguas-enabled -update-po: $(PACKAGE)-all.pot all-linguas-enabled - for lang in ${LINGUAS}; do \ - echo "Updating $$lang.po"; \ - $(MSGMERGE) $$lang.po $(PACKAGE)-all.pot -o $$lang.new.po; \ - cmp $$lang.new.po $$lang.po || cp $$lang.new.po $$lang.po; \ - rm -f $$lang.new.po; \ - done - -all-linguas-enabled: LINGUAS -ifdef NOISY - echo "Available Translations: $(shell ls *.po | cut -d'.' -f 1 | sort | tr '\n' ' ')" - echo "Mentioned Translations: $(shell sed -e '/^\#\#/ d' -e '/^$$/ d' -e 's/# //' LINGUAS | tr ' ' '\n' | sort | tr '\n' ' ')" - echo "Build Translations: $(shell echo "$(LINGUAS)" | tr ' ' '\n' | sort | tr '\n' ' ')" -endif - test "$(shell ls *.po | cut -d'.' -f 1 | sort | tr '\n' ' ')" = \ - "$(shell sed -e '/^\#\#/ d' -e '/^$$/ d' -e 's/# //' LINGUAS | tr ' ' '\n' | sort | tr '\n' ' ')" || \ - ( echo "ERROR: Not all available translations are mentioned in po/LINGUAS!"; exit 100) - -clean: clean/local -clean/local: - rm -f $(MOFILES) $(LANG_POFILES) $(PO)/*.d - -# Include the dependencies that are available -The_DFiles = $(wildcard $(PO)/*.d) -ifneq ($(words $(The_DFiles)),0) -include $(The_DFiles) -endif - -# otherwise the output is completely screwed -.NOTPARALLEL: diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index 35a0a51e3..000000000 --- a/test/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -*- make -*- - -# This is the top level test makefile for APT, it recurses to each lower -# level make file and runs it with the proper target -ifndef NOISY -.SILENT: -endif - -.PHONY: startup headers library clean veryclean all binary program doc test update-po -startup all clean veryclean binary program dirs test update-po manpages docbook: - $(MAKE) -C libapt $@ - $(MAKE) -C interactive-helper $@ - -# Some very common aliases -.PHONY: maintainer-clean dist-clean distclean pristine sanity -maintainer-clean dist-clean distclean pristine sanity: veryclean diff --git a/test/integration/makefile b/test/integration/makefile deleted file mode 100644 index fb12fe9a8..000000000 --- a/test/integration/makefile +++ /dev/null @@ -1,10 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=test/integration - -# Bring in the default rules -include ../../buildlib/defaults.mak - -.PHONY: test -test: - ./run-tests diff --git a/test/interactive-helper/makefile b/test/interactive-helper/makefile deleted file mode 100644 index 096767c41..000000000 --- a/test/interactive-helper/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=test/interactive-helper -APT_DOMAIN=none - -# Bring in the default rules -include ../../buildlib/defaults.mak - -# Program for testing methods -PROGRAM=mthdcat -SLIBS = -SOURCE = mthdcat.cc -include $(PROGRAM_H) - -# Program for testing the tar/deb extractor -PROGRAM=testdeb -SLIBS = -lapt-pkg -lapt-inst -LIB_MAKES = apt-pkg/makefile apt-inst/makefile -SOURCE = testdeb.cc -include $(PROGRAM_H) - -# Program for testing tar extraction -PROGRAM=extract-control -SLIBS = -lapt-pkg -lapt-inst -LIB_MAKES = apt-pkg/makefile apt-inst/makefile -SOURCE = extract-control.cc -include $(PROGRAM_H) - -# Program for testing udevcdrom -PROGRAM=test_udevcdrom -SLIBS = -lapt-pkg -LIB_MAKES = apt-pkg/makefile -SOURCE = test_udevcdrom.cc -include $(PROGRAM_H) - -PROGRAM=test_fileutl -SLIBS = -lapt-pkg -LIB_MAKES = apt-pkg/makefile -SOURCE = test_fileutl.cc -include $(PROGRAM_H) - -# Program for checking rpm versions -#PROGRAM=rpmver -#SLIBS = -lapt-pkg -lrpm -#SOURCE = rpmver.cc -#include $(PROGRAM_H) - -# very simple webserver for APT testing -PROGRAM=aptwebserver -SLIBS = -lapt-pkg -lpthread -LIB_MAKES = apt-pkg/makefile -SOURCE = aptwebserver.cc -include $(PROGRAM_H) diff --git a/test/libapt/makefile b/test/libapt/makefile deleted file mode 100644 index 5ff9cf68a..000000000 --- a/test/libapt/makefile +++ /dev/null @@ -1,84 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=test/libapt -BASENAME=_libapt_test -APT_DOMAIN=none - -# Bring in the default rules -include ../../buildlib/defaults.mak - -.PHONY: test -ifeq (file-okay,$(shell $(CC) -I $(BASE)/build/include -M gtest_runner.cc >/dev/null 2>&1 && echo 'file-okay')) -test: $(BIN)/gtest$(BASENAME) - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=$(LIB) $(BIN)/gtest$(BASENAME) - -$(BIN)/gtest$(BASENAME): $(LIB)/gtest.a - -PROGRAM = gtest${BASENAME} -SLIBS = -lapt-pkg -lapt-private -lapt-inst -pthread $(LIB)/gtest.a -LIB_MAKES = apt-pkg/makefile apt-private/makefile apt-inst/makefile -SOURCE = gtest_runner.cc $(wildcard *-helpers.cc *_test.cc) -include $(PROGRAM_H) - - -MKDIRS += $(OBJ) $(LIB) -LOCAL=gtest -SOURCE=gtest-all -gtest-OBJS := $(addprefix $(OBJ)/,$(addsuffix .o,$(SOURCE))) - -# The rest of the file is based on the example found in -# /usr/share/doc/libgtest-dev/examples/make/Makefile -GTEST_DIR = /usr/src/gtest - -# Flags passed to the preprocessor. -# Set Google Test's header directory as a system directory, such that -# the compiler doesn't generate warnings in Google Test headers. -#CPPFLAGS += -isystem $(GTEST_DIR)/include - -# Flags passed to the C++ compiler. -CXXFLAGS += -pthread -# disable some flags for gtest again -CXXFLAGS+= -Wno-missing-declarations -CXXFLAGS+= -Wno-missing-field-initializers -CXXFLAGS+= -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wno-suggest-attribute=noreturn -CXXFLAGS+= -Wno-undef - -# All Google Test headers. Usually you shouldn't change this definition. -GTEST_HEADERS = /usr/include/gtest/*.h \ - /usr/include/gtest/internal/*.h - -# House-keeping build targets. -.PHONY: clean/gtest veryclean/gtest -clean: clean/gtest -clean/gtest: - rm -f $(gtest-OBJS) -veryclean: veryclean/gtest -veryclean/gtest: clean/gtest - rm -f $(LIB)/gtest.a - -# Usually you shouldn't tweak such internal variables, indicated by a -# trailing _. -GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS) - -# Builds gtest.a -# For simplicity and to avoid depending on Google Test's -# implementation details, the dependencies specified below are -# conservative and not optimized. This is fine as Google Test -# compiles fast and for ordinary users its source rarely changes. -$(gtest-OBJS): $(GTEST_SRCS_) - echo Compiling $@ - $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c -o $@ $(GTEST_DIR)/src/$(notdir $(basename $@)).cc - -$(LIB)/gtest.a: $(OBJ)/gtest-all.o - echo Building static library $@ - -rm -f $@ - $(AR) $(ARFLAGS) $@ $^ - -else -test: - @echo "APT uses Googles C++ testing framework for its unit tests" - @echo "On Debian systems this is available in the 'libgtest-dev' package." - @echo "Please install it before attempting to run the unit tests." - $(CC) -I $(BASE)/build/include -M gtest_runner.cc - exit 100 -endif diff --git a/vendor/makefile b/vendor/makefile deleted file mode 100644 index 966c3d080..000000000 --- a/vendor/makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=vendor - -# Bring in the default rules -include ../buildlib/defaults.mak - -all headers library binary program doc manpages docbook test update-po startup dirs: current -all: all/subdirs -binary: binary/subdirs -doc: doc/subdirs -clean: clean/subdirs -veryclean: veryclean/subdirs -dirs: dirs/subdirs -manpages: manpages/subdirs - -all/subdirs binary/subdirs doc/subdirs dirs/subdirs manpages/subdirs clean/subdirs veryclean/subdirs: - test ! -e current/makefile || $(MAKE) -C current $(patsubst %/subdirs,%,$@) - test ! -e current/makefile.auto || $(MAKE) -C current -f makefile.auto $(patsubst %/subdirs,%,$@) - -current: - rm -f $@ - # search for an exact match to use the correct sources.list example - find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \ - if dpkg-vendor --is $$DISTRO; then \ - ln -s $$DISTRO $@; \ - break; \ - fi; \ - done - # if we haven't found a specific, look for a deriving - # we do ubuntu and debian last as those are the biggest families - # and would therefore potentially 'shadow' smaller families - # (especially debian as it sorts quiet early) - if ! test -e $@; then \ - find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \ - if [ "$$DISTRO" = 'debian' -o "$$DISTRO" = 'ubuntu' ]; then continue; fi; \ - if dpkg-vendor --derives-from $$DISTRO; then \ - ln -s $$DISTRO $@; \ - break; \ - fi; \ - done; \ - test -e $@ || \ - (dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \ - ln -s debian $@; \ - fi - if test ! -e current/makefile; then \ - sed "s#@@VENDOR@@#$(notdir $(shell readlink -f current))#" vendor.makefile > current/makefile.auto; \ - fi - -.PHONY: clean veryclean all binary vendor - -clean: clean/current -clean/current: clean/subdirs - rm -f current/makefile.auto current - -veryclean: veryclean/current -veryclean/current: veryclean/subdirs - rm -f current/makefile.auto current diff --git a/vendor/vendor.makefile b/vendor/vendor.makefile deleted file mode 100644 index 32de3b0d5..000000000 --- a/vendor/vendor.makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=vendor/@@VENDOR@@ - -# Bring in the default rules -include ../../buildlib/defaults.mak - -doc binary manpages: sources.list - -sources.list: sources.list.in ../../doc/apt-verbatim.ent - while read line; do \ - if [ "$${line}" = '&sourceslist-list-format;' ]; then \ - $(BASE)/vendor/getinfo vendor sourceslist-list-format ; \ - else \ - echo "$${line}"; \ - fi \ - done < $< | sed -e 's#&debian-stable-codename;#$(shell ../getinfo debian-stable-codename)#g' \ - -e 's#&debian-oldstable-codename;#$(shell ../getinfo debian-oldstable-codename)#g' \ - -e 's#&debian-testing-codename;#$(shell ../getinfo debian-testing-codename)#g' \ - -e 's#&ubuntu-codename;#$(shell ../getinfo ubuntu-codename)#g' \ - -e 's#¤t-codename;#$(shell ../getinfo current-codename)#g' \ - > $@ - -clean: clean/sources.list -veryclean: clean/sources.list - -clean/sources.list: - rm -f sources.list -- cgit v1.2.3 From 4d22a5704a0ebe19a5fa2524ac90a26c824325de Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 20:17:21 +0200 Subject: Update gitignore for cmake We cannot be sure if you are not running the build tree, so this is a bit ugly. Gbp-Dch: ignore --- .gitignore | 111 ++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 14e8c596c..7baa7fbeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,92 @@ -*~ -# build artifacts -/aclocal.m4 -/autom4te.cache/ -/build/ -/buildlib/config.guess -/buildlib/config.sub -/configure - -# generated files in the process to build all -# apt man pages and other documentation -/doc/*/ +# Include directory +include/ + +# Cmake files +CMakeCache.txt +CMakeFiles +CMakeScripts +Makefile +cmake_install.cmake +install_manifest.txt +CTestTestfile.cmake +Testing/ + +gtest-* + +# Compiled output +*.o +*.so* +*.versionscript + +# Templates +*.pot +*.pot-* +!/po/apt-all.pot + +# Vendor files + +**/vendor/sources.list +**/LC_MESSAGES/ + +**/ftparchive/apt-ftparchive +**/cmdline/apt +**/cmdline/apt-cache +**/cmdline/apt-cdrom +**/cmdline/apt-config +**/cmdline/apt-extracttemplates +**/cmdline/apt-get +**/cmdline/apt-helper +**/cmdline/apt-key +**/cmdline/apt-mark +**/cmdline/apt-sortpkgs +**/cmdline/planners +**/cmdline/solvers +**/cmdline/apt + +**/methods/file +**/methods/copy +**/methods/store +**/methods/gpgv +**/methods/cdrom +**/methods/http +**/methods/https +**/methods/mirror +**/methods/ftp +**/methods/rred +**/methods/rsh +**/methods/ssh +**/methods/gzip +**/methods/bzip2 +**/methods/xz +**/methods/lzma + +**/test/interactive-helper/aptwebserver +**/test/interactive-helper/extract-control +**/test/interactive-helper/rpmver +**/test/interactive-helper/testdeb +**/test/interactive-helper/mthdcat +**/test/interactive-helper/test_fileutl +**/test/interactive-helper/test_udevcdrom +**/test/libapt/libapt_test + +# Documentation +Doxyfile +doxygen/ +*.html/ +*.text.html +*.text +*.*stamp* +*.[1-9] +**/doc/*/*.xml +**/doc/*/*.dbk !/doc/examples/ -!/doc/po/ -/doc/en/* -!/doc/en/makefile + +# Backend files +Makefile +*.ninja +.ninja* + +!CMakeLists.txt # package building artifacts /debian/*.log @@ -29,14 +102,6 @@ /debian/libapt-pkg-doc/ /debian/apt-transport-https/ -# generated from *.in files -/cmdline/apt-key -/doc/apt-vendor.ent -/doc/examples/sources.list -/vendor/current -/vendor/*/sources.list -/vendor/*/makefile.auto - # generated for and by abicheck /abicheck/apt_build.xml /abicheck/apt_installed.xml -- cgit v1.2.3 From 61fef4ddbec8f70bb9e213ac0491d4e6cfefab30 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Aug 2016 14:16:52 +0200 Subject: test: Automatically discover CMake build directory Look at the project root, and all directories directly below it and pick the directory with the newest CMakeCache.txt file. Gbp-Dch: ignore --- test/integration/framework | 22 +++++++++++++++++++++- test/integration/run-tests | 6 ++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/test/integration/framework b/test/integration/framework index 824bd46b6..0f442dff4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -257,6 +257,24 @@ escape_shell() { echo "$@" | sed -e "s#'#'\"'\"'#g" } +find_project_binary_dir() { + local TESTDIRECTORY="$(readlink -f "$(dirname $0)")" + if [ -z "$PROJECT_BINARY_DIR" ]; then + PROJECT_BINARY_DIR= + for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do + test -e "$dir/CMakeCache.txt" || continue + if [ -z "$PROJECT_BINARY_DIR" ] || + [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then + PROJECT_BINARY_DIR="$dir" + fi + done + if [ -z "$PROJECT_BINARY_DIR" ]; then + echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 + exit 1 + fi + export PROJECT_BINARY_DIR + fi +} setupenvironment() { # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then @@ -281,9 +299,11 @@ setupenvironment() { fi TESTDIRECTORY="$(readlink -f "$(dirname $0)")" + # Find the newest build directory (sets PROJECT_BINARY_DIR) + find_project_binary_dir # allow overriding the default BUILDDIR location SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" - BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/cmdline"}" + BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${PROJECT_BINARY_DIR}/cmdline"}" LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/../apt-pkg"}" METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/../methods"}" APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}" diff --git a/test/integration/run-tests b/test/integration/run-tests index 78f24fbaf..e90b4b755 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -1,4 +1,10 @@ #!/bin/sh + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +find_project_binary_dir + set -e TESTTORUN='' -- cgit v1.2.3