git » nmdb » commit a053e9a

Add a pkg-config file for libnmdb.

author Alberto Bertogli
2007-10-10 03:45:15 UTC
committer Alberto Bertogli
2007-10-10 03:45:15 UTC
parent c6f9dcda953a26920c4505ccae5a7760cbad5782

Add a pkg-config file for libnmdb.

The path where to install the .pc file is dubious. The manpage says
"_prefix_/lib/pkgconfig" so it's not very clear. We just install it to our
$(PREFIX)/lib/pkgconfig, which is usually the right place.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

.gitignore +1 -0
libnmdb/Makefile +11 -3
libnmdb/libnmdb.skel.pc +12 -0

diff --git a/.gitignore b/.gitignore
index dc7cf5e..d6bb4ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,5 @@ tests/c/*-*-cache
 tests/c/*-*-normal
 tests/c/*-*-sync
 /libnmdb/nmdb.h
+/libnmdb/libnmdb.pc
 /tags
diff --git a/libnmdb/Makefile b/libnmdb/Makefile
index e0e0cfe..611e05d 100644
--- a/libnmdb/Makefile
+++ b/libnmdb/Makefile
@@ -29,7 +29,7 @@ OBJS = libnmdb.o tcp.o tipc.o udp.o sctp.o
 
 default: all
 
-all: libs
+all: libs libnmdb.pc
 
 nmdb.h: nmdb.skel.h
 	@echo "generating nmdb.h"
@@ -40,6 +40,12 @@ nmdb.h: nmdb.skel.h
 		sed 's/++CONFIG_ENABLE_SCTP++/$(ENABLE_SCTP)/g' \
 		> nmdb.h
 
+libnmdb.pc: libnmdb.skel.pc
+	@echo "generating libnmdb.pc"
+	@cat libnmdb.skel.pc | \
+		sed 's@++PREFIX++@$(PREFIX)@g' \
+		> libnmdb.pc
+
 libs: libnmdb.so libnmdb.a
 
 libnmdb.so: nmdb.h $(OBJS)
@@ -49,12 +55,14 @@ libnmdb.a: nmdb.h $(OBJS)
 	$(AR) cr libnmdb.a $(OBJS)
 
 
-install-lib: libs
+install-lib: libs libnmdb.pc
 	install -d $(PREFIX)/lib
 	install -m 0755 libnmdb.so $(PREFIX)/lib
 	install -m 0755 libnmdb.a $(PREFIX)/lib
 	install -d $(PREFIX)/include
 	install -m 0644 nmdb.h $(PREFIX)/include
+	install -d $(PREFIX)/lib/pkgconfig
+	install -m 644 libnmdb.pc $(PREFIX)/lib/pkgconfig
 	@echo
 	@echo "Please run ldconfig to update your library cache"
 	@echo
@@ -70,7 +78,7 @@ install: install-lib install-man
 	$(CC) $(ALL_CFLAGS) -c $< -o $@
 
 clean:
-	rm -f nmdb.h $(OBJS) libnmdb.so libnmdb.a
+	rm -f nmdb.h libnmdb.pc $(OBJS) libnmdb.so libnmdb.a
 	rm -f *.bb *.bbg *.da *.gcov *.gcda *.gcno gmon.out
 
 .PHONY: default all libs install-lib install-man install clean
diff --git a/libnmdb/libnmdb.skel.pc b/libnmdb/libnmdb.skel.pc
new file mode 100644
index 0000000..0668ed3
--- /dev/null
+++ b/libnmdb/libnmdb.skel.pc
@@ -0,0 +1,12 @@
+
+prefix=++PREFIX++
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: libnmdb
+Description: Library for interacting with a nmdb server
+URL: http://auriga.wearlab.de/~alb/nmdb/
+Version: 0.22
+Libs: -L${libdir} -lqdbm
+Cflags: -I${includedir}
+