Install headers, add pkgconfig file

Message ID 200803122250.37396.ville.skytta@iki.fi
State New
Headers

Commit Message

Ville Skyttä March 12, 2008, 8:50 p.m. UTC
  On Wednesday 12 March 2008, clemens kirchgatterer wrote:
> On Tue, Mar 11, 2008 at 3:46 PM, Joerg Pulz <Joerg.Pulz@frm2.tum.de> wrote:
> >  Out of this four cases (there are probably more, one for every Linux
> >  distribution on this planet), tell me which is the most reasonable
> >  default?
>
> the most reasonable default is simply to put vdr.pc in
> [$(DESTDIR)/]$(PREFIX)/lib/pkgconfig. for cases that this is not
> appropriate, there is $PKG_CONFIG_PATH.

Agreed.  The second revision of the patch is attached; compared to the first 
one this also installs the *.pc file to the first (colon separated) component 
of $PKG_CONFIG_PATH, or to $(PREFIX)/lib/pkgconfig if $PKG_CONFIG_PATH is not 
set in the environment.  Unless I've missed something, as far as I'm 
concerned this is good enough to go in.

By the way, if someone's interested, the bug I reported against pkg-config 
because it can't be queried for its default *.pc dirs is 
https://bugs.freedesktop.org/show_bug.cgi?id=14975
  

Patch

--- Makefile.orig	2008-03-06 21:29:58.000000000 +0200
+++ Makefile	2008-03-12 22:41:54.000000000 +0200
@@ -21,2 +21,3 @@ 
 BINDIR   = $(PREFIX)/bin
+INCLUDEDIR = $(PREFIX)/include
 LOCDIR   = ./locale
@@ -34,2 +35,4 @@ 
 
+PCDIR   ?= $(firstword $(subst :, , ${PKG_CONFIG_PATH}:$(PREFIX)/lib/pkgconfig))
+
 -include Make.config
@@ -77,3 +80,3 @@ 
 
-all: vdr i18n
+all: vdr i18n vdr.pc
 
@@ -103,2 +106,19 @@ 
 
+# pkg-config file:
+
+vdr.pc: Makefile
+	echo "bindir=$(BINDIR)" > $@
+	echo "includedir=$(INCLUDEDIR)" >> $@
+	echo "confdir=$(CONFDIR)" >> $@
+	echo "videodir=$(VIDEODIR)" >> $@
+	echo "plugindir=$(PLUGINLIBDIR)" >> $@
+	echo "localedir=$(LOCDIR)" >> $@
+	echo "apiversion=$(APIVERSION)" >> $@
+	echo "" >> $@
+	echo "Name: VDR" >> $@
+	echo "Description: Video Disk Recorder" >> $@
+	echo "URL: http://www.cadsoft.de/vdr/" >> $@
+	echo "Version: $(VDRVERSION)" >> $@
+	echo "Cflags: $(CXXFLAGS) -I$(INCLUDEDIR)" >> $@
+
 # Internationalization (I18N):
@@ -163,3 +183,4 @@ 
 
-install: install-bin install-conf install-doc install-plugins install-i18n
+install: install-bin install-conf install-doc install-plugins install-i18n \
+	install-includes install-pc
 
@@ -194,2 +215,16 @@ 
 
+# Headers:
+
+install-includes: include-dir
+	@mkdir -p $(DESTDIR)$(INCLUDEDIR)
+	@cp -pR include/vdr include/libsi $(DESTDIR)$(INCLUDEDIR)
+
+# pkg-config file:
+
+install-pc: vdr.pc
+	if [ -n "$(PCDIR)" ] ; then \
+	    mkdir -p $(DESTDIR)$(PCDIR) ; \
+	    cp vdr.pc $(DESTDIR)$(PCDIR) ; \
+	    fi
+
 # Source documentation:
@@ -206,3 +241,3 @@ 
 	$(MAKE) -C $(LSIDIR) clean
-	-rm -f $(OBJS) $(DEPFILE) vdr core* *~
+	-rm -f $(OBJS) $(DEPFILE) vdr vdr.pc core* *~
 	-rm -rf $(LOCALEDIR) $(PODIR)/*.mo $(PODIR)/*.pot