Hi,

I cloned Sean's librdmacm git repo and added pkgconfig support to it.
This is useful for other downstream projects to use the pkgconfig
infrastructure to detect cflag and ldflag options rather then using a
bunch of complex magic incantations to determine where the proper
library and header files are located.

patch attached.

Passes make distcheck and make install.

Regards
-steve
>From bd81cd5daf2a5e3f078ad4009ad61b9276a82b2f Mon Sep 17 00:00:00 2001
From: Steven Dake <[email protected]>
Date: Mon, 20 Jul 2009 10:41:07 -0700
Subject: [PATCH] Add pkgconfig support to rdmacm library.

---
 Makefile.am            |    2 ++
 configure.in           |    3 ++-
 librdmacm.spec.in      |    4 ++++
 pkgconfig/Makefile.am  |   25 +++++++++++++++++++++++++
 pkgconfig/rdmacm.pc.in |   11 +++++++++++
 5 files changed, 44 insertions(+), 1 deletions(-)
 create mode 100644 pkgconfig/Makefile.am
 create mode 100644 pkgconfig/rdmacm.pc.in

diff --git a/Makefile.am b/Makefile.am
index 290cbc3..60774a4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -67,6 +67,8 @@ man_MANS = \
 	man/rping.1 \
 	man/rdma_cm.7
 
+SUBDIRS = pkgconfig
+
 EXTRA_DIST = include/rdma/rdma_cma_abi.h include/rdma/rdma_cma.h \
 	     src/librdmacm.map librdmacm.spec.in $(man_MANS)
 
diff --git a/configure.in b/configure.in
index c06f65e..254a6e7 100644
--- a/configure.in
+++ b/configure.in
@@ -6,6 +6,7 @@ AC_CONFIG_SRCDIR([src/cma.c])
 AC_CONFIG_AUX_DIR(config)
 AM_CONFIG_HEADER(config.h)
 AM_INIT_AUTOMAKE(librdmacm, 1.0.8)
+AC_CHECK_PROGS([PKGCONFIG], [pkg-config])
 
 AM_PROG_LIBTOOL
 
@@ -62,5 +63,5 @@ AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
 
 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
 
-AC_CONFIG_FILES([Makefile librdmacm.spec])
+AC_CONFIG_FILES([Makefile pkgconfig/Makefile librdmacm.spec])
 AC_OUTPUT
diff --git a/librdmacm.spec.in b/librdmacm.spec.in
index 2c873c4..b8b60c7 100644
--- a/librdmacm.spec.in
+++ b/librdmacm.spec.in
@@ -60,6 +60,7 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root)
 %{_libdir}/lib*.so
 %{_libdir}/*.a
+%{_libdir}/pkgconfig/*.pc
 %{_includedir}/*
 %{_mandir}/man3/*
 %{_mandir}/man7/*
@@ -71,5 +72,8 @@ rm -rf $RPM_BUILD_ROOT
 
 %changelog
 
+* Mon Jul 20 2008 Steven Dake <[email protected]> - 1.0.8-1
+- Add pkgconfig files for downstream users of librdmacm.
+
 * Fri Feb 15 2008 Roland Dreier <[email protected]> - 1.0.6-1
 - Initial Fedora spec file
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
new file mode 100644
index 0000000..63571d7
--- /dev/null
+++ b/pkgconfig/Makefile.am
@@ -0,0 +1,25 @@
+MAINTAINERCLEANFILES	= Makefile.in
+
+EXTRA_DIST		= rdmacm.pc.in
+
+target_LIBS = rdmacm.pc
+
+%.pc: rdmacm.pc.in Makefile
+	rm -f $...@-t $@
+	sed \
+		-e 's#@''pre...@#$(exec_prefix)#g' \
+		-e 's#@''lib...@#$(libdir)#g' \
+		-e 's#@''libvers...@#$(VERSION)#g' \
+		-e 's#@''l...@#'$(*:lib%=%)'#g' \
+	    $< > $...@-t
+	chmod a-w $...@-t
+	mv $...@-t $@
+
+all-local: $(target_LIBS)
+
+install-exec-local: $(target_LIBS) $(target_PACKAGE)
+	$(INSTALL) -d $(DESTDIR)/$(libdir)/pkgconfig
+	$(INSTALL) -m 644 $(target_LIBS) $(DESTDIR)/$(libdir)/pkgconfig
+
+clean-local:
+	rm -f *.pc
diff --git a/pkgconfig/rdmacm.pc.in b/pkgconfig/rdmacm.pc.in
new file mode 100644
index 0000000..4a8a7e0
--- /dev/null
+++ b/pkgconfig/rdmacm.pc.in
@@ -0,0 +1,11 @@
+pref...@prefix@
+exec_prefix=${prefix}
+libd...@libdir@
+includedir=${prefix}/include
+
+Name: @LIB@
+Version: @LIBVERSION@
+Description: @LIB@
+Requires:
+Libs: -L${libdir} -...@lib@
+Cflags: -I${includedir}
-- 
1.6.2.2

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to