Browse Source

Add pkg-config files for the apt-pkg and apt-inst libraries

Closes: #439121
tags/debian/1.9.0
Corentin Noël 2 years ago
parent
commit
7c461f0396
8 changed files with 50 additions and 2 deletions
  1. +1
    -0
      CMakeLists.txt
  2. +3
    -0
      apt-inst/CMakeLists.txt
  3. +9
    -0
      apt-inst/apt-inst.pc.in
  4. +3
    -0
      apt-pkg/CMakeLists.txt
  5. +8
    -0
      apt-pkg/apt-pkg.pc.in
  6. +1
    -0
      debian/libapt-pkg-dev.install
  7. +3
    -2
      debian/tests/control
  8. +22
    -0
      debian/tests/pkg-config-test

+ 1
- 0
CMakeLists.txt View File

@@ -189,6 +189,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;"


+ 3
- 0
apt-inst/CMakeLists.txt View File

@@ -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}")

+ 9
- 0
apt-inst/apt-inst.pc.in View File

@@ -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

+ 3
- 0
apt-pkg/CMakeLists.txt View File

@@ -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")


+ 8
- 0
apt-pkg/apt-pkg.pc.in View File

@@ -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}

+ 1
- 0
debian/libapt-pkg-dev.install View File

@@ -1,3 +1,4 @@
usr/include/apt-pkg/
usr/lib/*/libapt-inst*.so
usr/lib/*/libapt-pkg*.so
usr/lib/*/pkgconfig/apt-*.pc

+ 3
- 2
debian/tests/control View File

@@ -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

+ 22
- 0
debian/tests/pkg-config-test View File

@@ -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"

Loading…
Cancel
Save