Add a .pc file to the library.
This patch was generated by Bryan Kadzban, and most recently supported by
Thomas H.P. Anderson.
For more info on what this file is used for, read:
http://en.wikipedia.org/wiki/Pkg-config
Signed-off-by: Andrew G Morgan <[email protected]>
diff --git a/Make.Rules b/Make.Rules
index 8393738..eea456d 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -35,6 +35,7 @@
SBINDIR=$(FAKEROOT)$(exec_prefix)/sbin
INCDIR=$(FAKEROOT)$(inc_prefix)/include
LIBDIR=$(FAKEROOT)$(lib_prefix)/$(lib)
+PKGCONFIGDIR=$(FAKEROOT)$(prefix)/$(lib)/pkgconfig
# common defines for libcap
LIBTITLE=libcap
diff --git a/README b/README
index b4740f0..7356eac 100644
--- a/README
+++ b/README
@@ -20,6 +20,7 @@
installs the library libcap.XX.Y in /lib[64]/
the binaries in /sbin/
the <sys/capability.h> file in /usr/include
+ the libcap.pc file in /usr/lib[64]/pkgconfig
* for some example programs look in progs.
diff --git a/libcap/Makefile b/libcap/Makefile
index 5e92596..6aa1055 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -17,6 +17,7 @@
ifeq ($(LIBATTR),yes)
FILES += cap_file
LDFLAGS += -lattr
+DEPS = -lattr
endif
INCLS=libcap.h cap_names.h $(INCS)
@@ -25,13 +26,22 @@
MINLIBNAME=$(MAJLIBNAME).$(MINOR)
GPERF_OUTPUT = _caps_output.gperf
-all: $(MINLIBNAME) $(STALIBNAME)
+all: $(MINLIBNAME) $(STALIBNAME) libcap.pc
ifeq ($(shell gperf --version > /dev/null 2>&1 && echo yes),yes)
USE_GPERF_OUTPUT = $(GPERF_OUTPUT)
INCLUDE_GPERF_OUTPUT = -include $(GPERF_OUTPUT)
endif
+libcap.pc: libcap.pc.in
+ sed -e 's,@prefix@,$(prefix),' \
+ -e 's,@exec_prefix@,$(exec_prefix),' \
+ -e 's,@libdir@,$(lib_prefix)/$(lib),' \
+ -e 's,@includedir@,$(inc_prefix)/include,' \
+ -e 's,@VERSION@,$(VERSION).$(MINOR),' \
+ -e 's,@deps@,$(DEPS),' \
+ $< >$@
+
_makenames: _makenames.c cap_names.list.h
$(BUILD_CC) $(BUILD_CFLAGS) $< -o $@
@@ -71,9 +81,11 @@
ifeq ($(FAKEROOT),)
-/sbin/ldconfig
endif
+ mkdir -p -m 0755 $(PKGCONFIGDIR)
+ install -m 0644 libcap.pc $(PKGCONFIGDIR)/libcap.pc
clean:
$(LOCALCLEAN)
- rm -f $(OBJS) $(LIBNAME)* $(STALIBNAME)
+ rm -f $(OBJS) $(LIBNAME)* $(STALIBNAME) libcap.pc
rm -f cap_names.h cap_names.list.h _makenames $(GPERF_OUTPUT)
cd include/sys && $(LOCALCLEAN)
diff --git a/libcap/libcap.pc.in b/libcap/libcap.pc.in
new file mode 100644
index 0000000..a28e3e4
--- /dev/null
+++ b/libcap/libcap.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libcap
+Description: libcap
+Version: @VERSION@
+Libs: -L${libdir} -lcap
+Libs.private: @deps@
+Cflags: -I${includedir}