Hi,
Here is the correct patch to add pkg-config to apt-pkg and apt-inst.
I hope I've fixed all the requirements above.
Please note that I haven't been able to test the new test in the debian
package.
Kind regards,
Corentin Noël
>From f14b869bc92c066693c4f36e61fb216bd4c26692 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Corentin=20No=C3=ABl?= <coren...@elementary.io>
Date: Sat, 29 Oct 2016 16:07:24 +0200
Subject: [PATCH] Enable PkgConfig on the apt-pkg and apt-inst libraries
---
apt-inst/CMakeLists.txt | 3 +++
apt-inst/apt-inst.pc.in | 11 +++++++++++
apt-pkg/CMakeLists.txt | 3 +++
apt-pkg/apt-pkg.pc.in | 10 ++++++++++
debian/libapt-pkg-dev.install | 1 +
debian/tests/control | 5 +++--
6 files changed, 31 insertions(+), 2 deletions(-)
create mode 100644 apt-inst/apt-inst.pc.in
create mode 100644 apt-pkg/apt-pkg.pc.in
diff --git a/apt-inst/CMakeLists.txt b/apt-inst/CMakeLists.txt
index f757823..d11111a 100644
--- a/apt-inst/CMakeLists.txt
+++ b/apt-inst/CMakeLists.txt
@@ -10,6 +10,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})
@@ -23,4 +25,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 0000000..c752f46
--- /dev/null
+++ b/apt-inst/apt-inst.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: apt-inst
+Description: deb package format runtime library
+Version: @MAJOR@.@MINOR@
+Libs: -L${libdir} -lapt-inst
+Cflags: -I${includedir}/apt-pkg
+Requires: apt-pkg
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt
index 25ed13e..3d58235 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
file(GLOB_RECURSE library "*.cc" "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc")
file(GLOB_RECURSE headers "*.h")
@@ -62,6 +64,7 @@ add_version_script(apt-pkg)
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}")
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/apt-pkg.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
target_link_libraries(apt-pkg PUBLIC noprofile)
diff --git a/apt-pkg/apt-pkg.pc.in b/apt-pkg/apt-pkg.pc.in
new file mode 100644
index 0000000..ea762f6
--- /dev/null
+++ b/apt-pkg/apt-pkg.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: apt-pkg
+Description: package management runtime library
+Version: @MAJOR@.@MINOR@
+Libs: -L${libdir} -lapt-pkg
+Cflags: -I${includedir}/apt-pkg
diff --git a/debian/libapt-pkg-dev.install b/debian/libapt-pkg-dev.install
index 42e7c34..563e999 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 a282584..516e1d2 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,8 +1,9 @@
-Tests: run-tests
+Tests: run-tests, autopkgtest
Restrictions: allow-stderr
Depends: @, @builddeps@, fakeroot, wget, stunnel4, lsof, db-util,
gnupg (>= 2) | gnupg2,
gnupg1 | gnupg (<< 2),
gpgv (>= 2) | gpgv2,
gpgv1 | gpgv (<< 2),
- libfile-fcntllock-perl, python3-apt
+ libfile-fcntllock-perl, python3-apt,
+ pkg-config
--
2.7.4