[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#439121: Add a .pc file for libapt-pkt



On Tue, Nov 07, 2017 at 11:20:50PM +0100, Corentin Noël wrote:
> Here is a patch working with current master, It's now fully working. It
> contains a test to ensure that it works, I tested it with autopkgtest.

> From 44fa7251911378bb0ca16a23024b7f7ede5a8f84 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Corentin=20No=C3=ABl?= <corentin@elementary.io>
> Date: Tue, 7 Nov 2017 20:38:13 +0100
> 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 +++--
>  debian/tests/pkg-config-test  | 22 ++++++++++++++++++++++
>  7 files changed, 53 insertions(+), 2 deletions(-)
>  create mode 100644 apt-inst/apt-inst.pc.in
>  create mode 100644 apt-pkg/apt-pkg.pc.in
>  create mode 100644 debian/tests/pkg-config-test
> 
> diff --git a/apt-inst/CMakeLists.txt b/apt-inst/CMakeLists.txt
> index 31da115e4..063b40318 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..c752f4657
> --- /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@

That's wrong. If I define CMAKE_INSTALL_LIBDIR to /foo,
and prefix is /usr, you just set libdir to /usr//foo instead
of /foo.

Generally, we must not use CMAKE_INSTALL_PREFIX, and only
use CMAKE_INSTALL_FULL_LIBDIR, CMAKE_INSTALL_FULL_INCLUDEDIR,
and thus only define libdir and includedir, not prefix or
exec_prefix.

> +
> +Name: apt-inst
> +Description: deb package format runtime library
> +Version: @MAJOR@.@MINOR@
> +Libs: -L${libdir} -lapt-inst
> +Cflags: -I${includedir}/apt-pkg

The /apt-pkg should not be there.

> diff --git a/apt-pkg/apt-pkg.pc.in b/apt-pkg/apt-pkg.pc.in
> new file mode 100644
> index 000000000..97c90ce5e
> --- /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@

as above

> +
> +Name: apt-pkg
> +Description: package management runtime library
> +Version: @MAJOR@.@MINOR@
> +Libs: -L${libdir} -lapt-pkg -pthread
> +Cflags: -I${includedir}/apt-pkg

as above



-- 
Debian Developer - deb.li/jak | jak-linux.org - free software dev
Ubuntu Core Developer                              de, en speaker


Reply to: