Install headers, add pkgconfig file
Commit Message
On Wednesday 12 March 2008, Ville Skyttä wrote:
> 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.
Here's the third revision, after a bit more testing. As a result of that,
there were a couple of minor bug fixes, most notable of which was to the
install-includes target.
@@ -19,6 +19,7 @@
PREFIX ?= /usr/local
MANDIR = $(PREFIX)/share/man
BINDIR = $(PREFIX)/bin
+INCLUDEDIR = $(PREFIX)/include
LOCDIR = ./locale
LIBS = -ljpeg -lpthread -ldl -lcap -lrt -lfreetype -lfontconfig
INCLUDES = -I/usr/include/freetype2
@@ -32,6 +33,8 @@
DOXYGEN = /usr/bin/doxygen
DOXYFILE = Doxyfile
+PCDIR ?= $(firstword $(subst :, , ${PKG_CONFIG_PATH}:$(PREFIX)/lib/pkgconfig))
+
-include Make.config
SILIB = $(LSIDIR)/libsi.a
@@ -75,7 +78,7 @@
DEFINES += -DVFAT
endif
-all: vdr i18n
+all: vdr i18n vdr.pc
# Implicit rules:
@@ -101,6 +104,23 @@
$(SILIB):
$(MAKE) -C $(LSIDIR) all
+# pkg-config file:
+
+vdr.pc: Makefile
+ echo "bindir=$(BINDIR)" > $@
+ echo "includedir=$(INCLUDEDIR)" >> $@
+ echo "configdir=$(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):
PODIR = po
@@ -161,7 +181,8 @@
# Install the files:
-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
# VDR binary:
@@ -192,6 +213,20 @@
@mkdir -p $(DESTDIR)$(PLUGINLIBDIR)
@cp --remove-destination $(PLUGINDIR)/lib/lib*-*.so.$(APIVERSION) $(DESTDIR)$(PLUGINLIBDIR)
+# Headers:
+
+install-includes: include-dir
+ @mkdir -p $(DESTDIR)$(INCLUDEDIR)
+ @cp -pLR 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:
srcdoc:
@@ -204,7 +239,7 @@
clean:
$(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
-rm -rf include
-rm -rf srcdoc