Hi Steven,

more and more people are complaining that we do not ship .pc files to
support pkgconfig and make it easier to build against corosync/openais.

The patch in attachment creates (what should be good) pc files for each
of corosync libraries.

changes are simple:

- move the whole LIBDIR detection from Makefile to Makefile.inc as those
information are useful not only in the toplevel Makefile.

- use a temporary PRELIBDIR variable to store the output from ARCH
detection.

- point LIBDIR to PRELIBDIR/corosync (as it was before).

- use PRELIBDIR to get PKGCONFIGDIR.

- toplevel Makefile: add pkgconfig dir to all and clean target. Add
install bits (mkdir and install *.pc).

- add pkgconfig dir: this directory contains a very simple template that
generates via pkgconfig/Makefile all the .pc files we need. It depends
on LIBDIR being visible from Makefile.inc.

- As discussed on IRC all libs are standalone. So automatic generation
is not an issue as we don't have to special case anything.

Please ACK or apply.

Fabio

PS: The same will be proposed for openais once this is OK for everybody.
PPS: I agree the pkgconfig/Makefile could be better, but since autoconf
is on its way I didn't want to spend a great deal time on it. It still
supports builddir and srcdir and doesn't seem to break current
behaviour.
Index: Makefile.inc
===================================================================
--- Makefile.inc	(revision 1753)
+++ Makefile.inc	(working copy)
@@ -3,6 +3,25 @@
 DESTDIR=
 LCRSODIR=$(PREFIX)/libexec/lcrso
 
+ARCH=$(shell uname -p)
+ifeq (,$(findstring 64,$(ARCH)))
+PRELIBDIR=$(PREFIX)/lib
+else
+PRELIBDIR=$(PREFIX)/lib64
+endif
+ifeq (s390,$(ARCH))
+PRELIBDIR=$(PREFIX)/lib
+endif
+ifeq (s390x,$(ARCH))
+PRELIBDIR=$(PREFIX)/lib64
+endif
+ifeq (ia64,$(ARCH))
+PRELIBDIR=$(PREFIX)/lib
+endif
+
+LIBDIR=$(PRELIBDIR)/corosync
+PKGCONFIGDIR=$(PRELIBDIR)/pkgconfig
+
 # Do not modify below this line
 
 # Basic OS detection
Index: pkgconfig/libtemplate.pc.in
===================================================================
--- pkgconfig/libtemplate.pc.in	(revision 0)
+++ pkgconfig/libtemplate.pc.in	(revision 0)
@@ -0,0 +1,11 @@
+pref...@prefix@
+exec_prefix=${prefix}
+libd...@libdir@
+includedir=${prefix}/include
+
+Name: @LIB@
+Version: trunk
+Description: @LIB@
+Requires:
+Libs: -L${libdir} -...@lib@
+Cflags: -I${includedir}
Index: pkgconfig/Makefile
===================================================================
--- pkgconfig/Makefile	(revision 0)
+++ pkgconfig/Makefile	(revision 0)
@@ -0,0 +1,50 @@
+# Copyright (c) 2009 Red Hat, Inc.
+# 
+# All rights reserved.
+# 
+# This software licensed under BSD license, the text of which follows:
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# - Redistributions of source code must retain the above copyright notice,
+#   this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+# - Neither the name of the MontaVista Software, Inc. nor the names of its
+#   contributors may be used to endorse or promote products derived from this
+#   software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR ENGINES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# Include configuration
+#
+srcdir ?= $(CURDIR)/../
+subdir ?= pkgconfig
+
+include $(srcdir)/Makefile.inc
+
+LIBS = evs cpg cfg coroutil confdb quorum votequorum totem_pg logsys
+
+all:
+	for i in $(LIBS); do \
+		cat ${srcdir}/pkgconfig/libtemplate.pc.in | sed \
+			-e 's...@prefix@#$(PREFIX)#g' \
+			-e 's...@libdir@#$(LIBDIR)#g' \
+			-e 's...@lib@#'$${i}'#g' \
+		> lib$${i}.pc; \
+	done;
+
+clean:
+	rm -f *.pc
Index: Makefile
===================================================================
--- Makefile	(revision 1753)
+++ Makefile	(working copy)
@@ -46,23 +46,7 @@
 INCLUDEDIR_ENGINE=$(PREFIX)/include/corosync/engine
 MANDIR=$(PREFIX)/share/man
 ETCDIR=/etc
-ARCH=$(shell uname -p)
 
-ifeq (,$(findstring 64,$(ARCH)))
-LIBDIR=$(PREFIX)/lib/corosync
-else
-LIBDIR=$(PREFIX)/lib64/corosync
-endif
-ifeq (s390,$(ARCH))
-LIBDIR=$(PREFIX)/lib/corosync
-endif
-ifeq (s390x,$(ARCH))
-LIBDIR=$(PREFIX)/lib64/corosync
-endif
-ifeq (ia64,$(ARCH))
-LIBDIR=$(PREFIX)/lib/corosync
-endif
-
 SUBDIRS:=$(builddir)lcr $(builddir)lib $(builddir)tools $(builddir)exec $(builddir)test $(builddir)services
 sub_make = srcdir=$(srcdir) builddir=$(builddir) subdir=$(1)/ $(MAKE) -I$(srcdir)$(1) -f $(srcdir)$(1)/Makefile $(2)
 
@@ -73,6 +57,7 @@
 	@(cd $(builddir)tools; echo ==== `pwd` ===;  $(call sub_make,tools,all));
 	@(cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,all));
 	@(cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,all));
+	@(cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,all));
 
 # subdirs are not phony
 .PHONY: all clean install doxygen
@@ -113,6 +98,8 @@
 	(cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,clean));
 	(cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,clean));
 	(cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean));
+	(cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,clean));
+
 	rm -rf $(builddir)doc/api
 
 lint:
@@ -141,6 +128,7 @@
 	mkdir -p $(DESTDIR)$(MANDIR)/man5
 	mkdir -p $(DESTDIR)$(MANDIR)/man8
 	mkdir -p $(DESTDIR)$(ETCDIR)/ld.so.conf.d
+	mkdir -p $(DESTDIR)$(PKGCONFIGDIR)
 
 
 	for eLib in $(EXEC_LIBS); do					\
@@ -209,5 +197,7 @@
 	install -m 644 $(srcdir)man/*.5 $(DESTDIR)$(MANDIR)/man5
 	install -m 644 $(srcdir)man/*.8 $(DESTDIR)$(MANDIR)/man8
 
+	install -m 644 $(builddir)/pkgconfig/*.pc $(DESTDIR)$(PKGCONFIGDIR)
+
 doxygen:
 	mkdir -p doc/api && doxygen
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to