[PATCH] pkgconfig file for libspread
Hisham H M <[email protected]>
| Newsgroups | gmane.network.spread.user |
|---|---|
| Message-ID | <CAJpkDYc6fTSj-ByM_CW9E2XbnY5p9_SbuCKRPRY_rV=GSqh4+w@mail.gmail.com> |
Hello,
I'm just getting started with Spread and I'm enjoying it so far.
As I approached integrating the client library with my autoconf
scripts, I found it simpler to add a .pc file to the Spread
distribution rather than diving in the autoconf macros for library
search.
The attached patch adds a libspread.pc to the Spread distribution,
which is generated at build time and installed along with libspread. I
put it in the libspread directory since I figured that for
installations that build only the client library, I could do "make -C
libspread install" instead of installing the whole thing. This way I
get only libraries, headers and the .pc file installed.
With this patch, using the client library in other autoconf-based
projects can be done somewhat like this:
#------------------------------------
AC_ARG_WITH([libspread], [ --with-libspread=PREFIX Location of
libspread, the Spread client library],
[PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$with_libspread/lib/pkgconfig],[])
export PKG_CONFIG_PATH
LIBSPREADFOUND=no
PKG_CHECK_MODULES(LIBSPREAD,libspread >= 4.1,LIBSPREADFOUND=yes)
if ! test x$LIBSPREADFOUND = xyes; then
echo
echo "Failed."
echo "Libspread and its devel headers are required."
exit 1
fi
#------------------------------------
Thanks,
-- Hisham
ps: I'm not currently subscribed to the list, so please cc: me on any replies.
_______________________________________________
Spread-users mailing list
[email protected]
http://lists.spread.org/mailman/listinfo/spread-users
spread-4.1.0-pkgconfig_for_libspread.diff
(text/x-patch, 2.1 KB)
Index: configure.in
===================================================================
--- configure.in (revision 3397)
+++ configure.in (working copy)
@@ -790,7 +790,7 @@
AC_LINK_FILES(stdutil/Makefile, stdutil/Makefile)
fi
-AC_OUTPUT(Makefile daemon/Makefile docs/Makefile libspread/Makefile examples/Makefile)
+AC_OUTPUT(Makefile daemon/Makefile docs/Makefile libspread/Makefile libspread/libspread.pc examples/Makefile)
# Print summary of options
Index: libspread/Makefile.in
===================================================================
--- libspread/Makefile.in (revision 3397)
+++ libspread/Makefile.in (working copy)
@@ -15,6 +15,7 @@
top_srcdir=@top_srcdir@
buildtoolsdir=$(top_srcdir)/buildtools
host=@host@
+pkgconfigdir = $(libdir)/pkgconfig
DESTDIR=
VPATH=@srcdir@ $(top_srcdir)/daemon
@@ -225,6 +226,7 @@
install-files:
$(buildtoolsdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(buildtoolsdir)/mkinstalldirs $(DESTDIR)$(includedir)
+ $(buildtoolsdir)/mkinstalldirs $(DESTDIR)$(pkgconfigdir)
$(INSTALL) -m 644 libspread.a $(DESTDIR)$(libdir)/libspread.a
$(INSTALL) -m 644 libspread-core.a $(DESTDIR)$(libdir)/libspread-core.a
$(INSTALL) -m 644 libtspread-core.a $(DESTDIR)$(libdir)/libtspread-core.a
@@ -232,6 +234,7 @@
$(INSTALL) -m 644 $(top_srcdir)/include/sp_func.h $(DESTDIR)$(includedir)/sp_func.h
$(INSTALL) -m 644 $(top_srcdir)/include/sp_events.h $(DESTDIR)$(includedir)/sp_events.h
$(INSTALL) -m 644 $(top_srcdir)/include/fl.h $(DESTDIR)$(includedir)/fl.h
+ $(INSTALL) -m 644 libspread.pc $(DESTDIR)$(pkgconfigdir)/libspread.pc
uninstallall: uninstall
-rmdir $(DESTDIR)$(libdir)
Index: libspread/libspread.pc.in
===================================================================
--- libspread/libspread.pc.in (revision 0)
+++ libspread/libspread.pc.in (revision 0)
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=${prefix}/include
+
+Name: libspread
+Description: Client library for Spread, a group communication toolkit
+Version: @SP_MAJOR_VERSION@.@SP_MINOR_VERSION@.@SP_PATCH_VERSION@
+Libs: -L${libdir} -lspread
+Cflags: -I${includedir}