The grpc cmake build process does not produce .pc files.
To ease reuse of grpc from other packages, patch them in.

The pkg-config files are based on those created by the grpc Makefile
build. (gpr.pc merged into grpc.pc to avoid adding a third .pc file)
The library version numbers are extracted from the Makefile.

Signed-off-by: Clemens Gruber <[email protected]>
---
 .../0002-Add-pkg-config-files.patch           | 47 +++++++++++++++++++
 patches/grpc-1.17.0/series                    |  3 +-
 rules/grpc.make                               | 18 +++++++
 3 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 patches/grpc-1.17.0/0002-Add-pkg-config-files.patch

diff --git a/patches/grpc-1.17.0/0002-Add-pkg-config-files.patch 
b/patches/grpc-1.17.0/0002-Add-pkg-config-files.patch
new file mode 100644
index 000000000..713419bd9
--- /dev/null
+++ b/patches/grpc-1.17.0/0002-Add-pkg-config-files.patch
@@ -0,0 +1,47 @@
+From: Clemens Gruber <[email protected]>
+Date: Mon, 10 Dec 2018 13:44:53 +0100
+Subject: [PATCH] Add pkg-config files
+
+---
+ grpc++.pc.in | 12 ++++++++++++
+ grpc.pc.in   | 12 ++++++++++++
+ 2 files changed, 24 insertions(+)
+ create mode 100644 grpc++.pc.in
+ create mode 100644 grpc.pc.in
+
+diff --git a/grpc++.pc.in b/grpc++.pc.in
+new file mode 100644
+index 000000000000..c2677831a9c7
+--- /dev/null
++++ b/grpc++.pc.in
+@@ -0,0 +1,12 @@
++prefix=${pcfiledir}/../..
++exec_prefix=${prefix}
++libdir=${prefix}/lib
++includedir=${prefix}/include
++
++Name: gRPC++
++Description: C++ wrapper for gRPC
++Version: @VERSION@
++Cflags: -I${includedir}
++Requires.private: grpc protobuf
++Libs: -L${libdir} -lgrpc++
++Libs.private:
+diff --git a/grpc.pc.in b/grpc.pc.in
+new file mode 100644
+index 000000000000..917c57a5e074
+--- /dev/null
++++ b/grpc.pc.in
+@@ -0,0 +1,12 @@
++prefix=${pcfiledir}/../..
++exec_prefix=${prefix}
++libdir=${prefix}/lib
++includedir=${prefix}/include
++
++Name: gRPC
++Description: high performance general RPC framework
++Version: @VERSION@
++Cflags: -I${includedir}
++Requires.private: zlib libcares openssl
++Libs: -L{libdir} -lgrpc
++Libs.private: -lgpr
diff --git a/patches/grpc-1.17.0/series b/patches/grpc-1.17.0/series
index 767460cac..9683c0e9d 100644
--- a/patches/grpc-1.17.0/series
+++ b/patches/grpc-1.17.0/series
@@ -1,6 +1,7 @@
 # generated by git-ptx-patches
 #tag:base --start-number 1
 0001-CMakeLists.txt-allow-passing-a-pre-existing-grpc_cpp.patch
+0002-Add-pkg-config-files.patch
 #tag:upstream --start-number 100
 0100-Cancel-still-active-c-ares-queries-after-10-seconds-.patch
-# c405f5a2e885b4d6ee8e68fb8ef11483  - git-ptx-patches magic
+# 2ec60af54d62c846f3125aae9358fc16  - git-ptx-patches magic
diff --git a/rules/grpc.make b/rules/grpc.make
index b75389a87..55ae4d3e4 100644
--- a/rules/grpc.make
+++ b/rules/grpc.make
@@ -49,6 +49,24 @@ GRPC_CONF_OPT        := \
        -DgRPC_NATIVE_CPP_PLUGIN=$(PTXDIST_SYSROOT_HOST)/bin/grpc_cpp_plugin \
        -DPROTOBUF_PROTOC_EXECUTABLE=$(PTXDIST_SYSROOT_HOST)/bin/protoc
 
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/grpc.install:
+       @$(call targetinfo)
+       @$(call world/install, GRPC)
+
+       @install -d $(GRPC_PKGDIR)/usr/lib/pkgconfig/
+       VERSION=$$(grep "CORE_VERSION =" $(GRPC_DIR)/Makefile | sed 
's/.*=\s*//') \
+               ptxd_replace_magic $(GRPC_DIR)/grpc.pc.in > \
+               $(GRPC_PKGDIR)/usr/lib/pkgconfig/grpc.pc
+       VERSION=$$(grep "CPP_VERSION =" $(GRPC_DIR)/Makefile | sed 
's/.*=\s*//') \
+               ptxd_replace_magic $(GRPC_DIR)/grpc++.pc.in > \
+               $(GRPC_PKGDIR)/usr/lib/pkgconfig/grpc++.pc
+
+       @$(call touch)
+
 # ----------------------------------------------------------------------------
 # Target-Install
 # ----------------------------------------------------------------------------
-- 
2.19.2


_______________________________________________
ptxdist mailing list
[email protected]

Reply via email to