Package: libgoogle-glog-dev
Followup-For: Bug #977952

Hi,

I have created patches that fixes this issue.
Could you check and apply?

Best regards,
  Nobuhiro
>From 0999fee0b187f627f1df3154a52fce21dad78af7 Mon Sep 17 00:00:00 2001
From: Nobuhiro Iwamatsu <[email protected]>
Date: Tue, 19 Jan 2021 10:15:04 +0900
Subject: [PATCH 1/2] cmake: Add pkg-config file generation functiuon

Signed-off-by: Nobuhiro Iwamatsu <[email protected]>
---
 ...d-pkgconfig-file-generation-function.patch | 35 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 
debian/patches/cmake-Add-pkgconfig-file-generation-function.patch

diff --git a/debian/patches/cmake-Add-pkgconfig-file-generation-function.patch 
b/debian/patches/cmake-Add-pkgconfig-file-generation-function.patch
new file mode 100644
index 0000000..bb16eb8
--- /dev/null
+++ b/debian/patches/cmake-Add-pkgconfig-file-generation-function.patch
@@ -0,0 +1,35 @@
+From 54d91e377727b78f481a463e0fa3dd4e395b62b1 Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <[email protected]>
+Date: Tue, 19 Jan 2021 10:15:41 +0900
+Subject: [PATCH] cmake: Add pkgconfig file generation function
+
+When using CMake, the pkg-config file is not generated.
+This adds a function to generate files in pkg-config.
+
+Signed-off-by: Nobuhiro Iwamatsu <[email protected]>
+---
+ CMakeLists.txt | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 808330e..6f2abd1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -682,3 +682,14 @@ install (FILES
+ 
+ install (EXPORT glog-targets NAMESPACE glog:: DESTINATION
+   ${_glog_CMake_INSTALLDIR})
++
++# pkg-config
++set(VERSION           "${PROJECT_VERSION}")
++set(prefix            "${CMAKE_INSTALL_PREFIX}")
++set(exec_prefix       "\${prefix}")
++set(includedir                "\${prefix}/include")
++set(libdir            "\${prefix}/${LIB_INSTALL_DIR}")
++configure_file(libglog.pc.in libglog.pc @ONLY)
++
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglog.pc
++  DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+-- 
+2.30.0.rc2
+
diff --git a/debian/patches/series b/debian/patches/series
index f741466..65d1525 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 20120621_errnos.diff
 20130313_fix_test_on_ports.diff
 x32_build_fix.patch
+cmake-Add-pkgconfig-file-generation-function.patch
-- 
2.30.0.rc2

>From b99d71c512e985d0e7efdfc87eb5d08ad4576405 Mon Sep 17 00:00:00 2001
From: Nobuhiro Iwamatsu <[email protected]>
Date: Tue, 19 Jan 2021 10:15:21 +0900
Subject: [PATCH 2/2] Change to use cmake

Signed-off-by: Nobuhiro Iwamatsu <[email protected]>
---
 debian/rules | 42 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/debian/rules b/debian/rules
index e159670..4d39560 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,23 +5,55 @@
 #export DH_VERBOSE=1
 
 export DOCDIR=$(CURDIR)/debian/libgoogle-glog-doc/
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+BUILDDIR = obj-$(DEB_HOST_MULTIARCH)
+
+CONFIGURE_ARGS= \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLIB_INSTALL_DIR:STRING="lib/$(DEB_HOST_MULTIARCH)"
 
 override_dh_installdocs-indep:
        dh_installdocs
        sed -i 's|http.*/favicon.ico||' \
                $(DOCDIR)/usr/share/doc/libgoogle-glog-dev/glog.html
 
-override_dh_installchangelogs:
-       dh_installchangelogs ChangeLog
+override_dh_auto_build:
+       # dynamically linked
+       dh_auto_build -B $(BUILDDIR)
+       # statically linked
+       dh_auto_build -B $(BUILDDIR)-static
+
+override_dh_auto_configure:
+       # dynamically linked
+       dh_auto_configure -B $(BUILDDIR) \
+               -- $(CONFIGURE_ARGS) \
+               -DBUILD_SHARED_LIBS=ON \
+               -DBUILD_TESTING=ON
+
+       # statically linked
+       dh_auto_configure -B $(BUILDDIR)-static \
+               -- $(CONFIGURE_ARGS) \
+               -DBUILD_SHARED_LIBS=OFF \
+               -DBUILD_TESTING=OFF
+
+override_dh_auto_install:
+       dh_auto_install -O--buildsystem=cmake -B $(BUILDDIR)
+       find $(CURDIR)/debian/tmp/ -type d -name .cmake | xargs -r rm -rfv
+
+execute_before_dh_install:
+       # put the static libs together with the rest of the stuff
+       cp -v $(BUILDDIR)-static/*.a debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/
+       -$(RM) -r $(BUILDDIR)-static
 
 override_dh_auto_test:
        -if [ -f /proc/version ]; then $(MAKE) check; fi
 
 %:
-       dh $@ --with autoreconf
+       dh  $@ --buildsystem=cmake
 
 get-orig-source:
        uscan --verbose --force-download --rename
 
-.PHONY: override_dh_installdocs-indep override_dh_installchangelogs \
-       override_dh_auto_test
+.PHONY: override_dh_installdocs-indep override_dh_auto_install \
+       execute_before_dh_install override_dh_auto_build \
+       override_dh_auto_test override_dh_auto_configure
-- 
2.30.0.rc2

Reply via email to