diff options
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | apt-inst/CMakeLists.txt | 3 | ||||
-rw-r--r-- | apt-inst/apt-inst.pc.in | 9 | ||||
-rw-r--r-- | apt-pkg/CMakeLists.txt | 3 | ||||
-rw-r--r-- | apt-pkg/apt-pkg.pc.in | 8 | ||||
-rw-r--r-- | debian/libapt-pkg-dev.install | 1 | ||||
-rw-r--r-- | debian/tests/control | 5 | ||||
-rw-r--r-- | debian/tests/pkg-config-test | 22 |
8 files changed, 50 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index eed22e1a4..29cd30bc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,6 +191,7 @@ check_cxx_target(HAVE_FMV_SSE42_AND_CRC32DI "sse4.2" "__builtin_ia32_crc32di(0, set(PACKAGE ${PROJECT_NAME}) set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>") set(PACKAGE_VERSION "1.8.0") +string(REGEX MATCH "^[0-9.]+" PROJECT_VERSION ${PACKAGE_VERSION}) if (NOT DEFINED DPKG_DATADIR) execute_process(COMMAND ${PERL_EXECUTABLE} -MDpkg -e "print $Dpkg::DATADIR;" diff --git a/apt-inst/CMakeLists.txt b/apt-inst/CMakeLists.txt index 55950679a..e4e91e493 100644 --- a/apt-inst/CMakeLists.txt +++ b/apt-inst/CMakeLists.txt @@ -12,6 +12,8 @@ set(APT_INST_MAJOR ${MAJOR} PARENT_SCOPE) file(GLOB_RECURSE library "*.cc") file(GLOB_RECURSE headers "*.h") +configure_file(apt-inst.pc.in ${CMAKE_CURRENT_BINARY_DIR}/apt-inst.pc @ONLY) + # Create a library using the C++ files add_library(apt-inst SHARED ${library}) @@ -25,4 +27,5 @@ 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) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/apt-inst.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}") diff --git a/apt-inst/apt-inst.pc.in b/apt-inst/apt-inst.pc.in new file mode 100644 index 000000000..1d61a202f --- /dev/null +++ b/apt-inst/apt-inst.pc.in @@ -0,0 +1,9 @@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: apt-inst +Description: deb package format runtime library +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lapt-inst +Cflags: -I${includedir} +Requires: apt-pkg diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt index 256747935..57e422a14 100644 --- a/apt-pkg/CMakeLists.txt +++ b/apt-pkg/CMakeLists.txt @@ -29,6 +29,8 @@ execute_process(COMMAND grep "^#define APT_PKG_RELEASE" message(STATUS "Building libapt-pkg ${MAJOR} (release ${MINOR})") set(APT_PKG_MAJOR ${MAJOR} PARENT_SCOPE) # exporting for methods/CMakeLists.txt +configure_file(apt-pkg.pc.in ${CMAKE_CURRENT_BINARY_DIR}/apt-pkg.pc @ONLY) + # Definition of the C++ files used to build the library - note that this # is expanded at CMake time, so you have to rerun cmake if you add or remove # a file (you can just run cmake . in the build directory) @@ -67,6 +69,7 @@ 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) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/apt-pkg.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}") if(CMAKE_BUILD_TYPE STREQUAL "Coverage") diff --git a/apt-pkg/apt-pkg.pc.in b/apt-pkg/apt-pkg.pc.in new file mode 100644 index 000000000..c6491d921 --- /dev/null +++ b/apt-pkg/apt-pkg.pc.in @@ -0,0 +1,8 @@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: apt-pkg +Description: package management runtime library +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lapt-pkg -pthread +Cflags: -I${includedir} diff --git a/debian/libapt-pkg-dev.install b/debian/libapt-pkg-dev.install index 42e7c34d5..563e99909 100644 --- a/debian/libapt-pkg-dev.install +++ b/debian/libapt-pkg-dev.install @@ -1,3 +1,4 @@ usr/include/apt-pkg/ usr/lib/*/libapt-inst*.so usr/lib/*/libapt-pkg*.so +usr/lib/*/pkgconfig/apt-*.pc diff --git a/debian/tests/control b/debian/tests/control index 540b727bb..a12ae6f99 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,8 +1,9 @@ -Tests: run-tests +Tests: run-tests, pkg-config-test Restrictions: allow-stderr Depends: @, @builddeps@, dpkg, fakeroot, wget, stunnel4, lsof, db-util, gnupg (>= 2) | gnupg2, gnupg1 | gnupg (<< 2), gpgv (>= 2) | gpgv2, gpgv1 | gpgv (<< 2), - libfile-fcntllock-perl, python3-apt, aptitude + libfile-fcntllock-perl, python3-apt, aptitude, + pkg-config diff --git a/debian/tests/pkg-config-test b/debian/tests/pkg-config-test new file mode 100644 index 000000000..cb8d1ffb0 --- /dev/null +++ b/debian/tests/pkg-config-test @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > pkgconfigtest.c +#include <apt-pkg/init.h> + +int main() +{ + printf("Apt Version: %s \n", pkgVersion); + return 0; +} +EOF + +g++ -o pkgconfigtest pkgconfigtest.c `pkg-config --cflags --libs apt-pkg apt-inst` +echo "build: OK" +[ -x pkgconfigtest ] +./pkgconfigtest +echo "run: OK" |