Install headers, add pkgconfig file

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

Commit Message

Ville Skyttä March 10, 2008, 9:18 p.m. UTC
  Hello,

As discussed in the freetype/fontconfig pkgconfig thread, here's a combined 
patch implementing installation of VDR's headers and generating a pkgconfig 
*.pc file.

This patch is mostly just a discussion draft - I haven't tried installing the 
headers and the pkgconfig file isn't installed yet by any "make install*" 
(mostly because very ironically, there's no way to query pkg-config for its 
default search path, which is something I've intended to report a bug about 
since a long time ago, but failed so far - maybe I'll do it right now :)).  

Also, I don't know if all *.h are actually something that should be installed 
by "install-headers", but since they're all available in the current setup 
for plugins to use too, I suppose weeding through them is an orthogonal task 
to this patch if needed in the first place (and maybe better discussed in 
the "RFC: Makefile ravamp" [sic] thread from Sat 8th Mar).
  

Comments

Matthias Schwarzott March 10, 2008, 11:27 p.m. UTC | #1
On Montag, 10. März 2008, Ville Skyttä wrote:
> Hello,
>
> As discussed in the freetype/fontconfig pkgconfig thread, here's a combined
> patch implementing installation of VDR's headers and generating a pkgconfig
> *.pc file.
>
> This patch is mostly just a discussion draft - I haven't tried installing
> the headers and the pkgconfig file isn't installed yet by any "make
> install*" (mostly because very ironically, there's no way to query
> pkg-config for its default search path, which is something I've intended to
> report a bug about since a long time ago, but failed so far - maybe I'll do
> it right now :)).
>

Citing pkg-config manpage:
By default, pkg-config looks in the directory prefix/lib/pkgconfig for these 
files; it will also look in the  colon-separated  (on  Windows,  
semicolon-separated) list of directories specified by the PKG_CONFIG_PATH 
environment variable.

So you can install .pc file anywhere you want if you add this location to 
PKG_CONFIG_PATH.

So /usr/bin/pkg-config will always look into /usr/lib/pkgconfig.
We can either use
A. $(DESTDIR)/usr/lib/pkgconfig
or
B. $(DESTDIR)$(PREFIX)/lib/pkgconfig

For most installations A should be fine.

Matthias
  
Clemens Kirchgatterer March 11, 2008, 11:58 a.m. UTC | #2
On Tue, Mar 11, 2008 at 12:27 AM, Matthias Schwarzott <zzam@gentoo.org> wrote:

> On Montag, 10. März 2008, Ville Skyttä wrote:

>  So you can install .pc file anywhere you want if you add this location to
>  PKG_CONFIG_PATH.
>
>  So /usr/bin/pkg-config will always look into /usr/lib/pkgconfig.
>  We can either use
>  A. $(DESTDIR)/usr/lib/pkgconfig
>  or
>  B. $(DESTDIR)$(PREFIX)/lib/pkgconfig
>
>  For most installations A should be fine.

definitly B, otherwise it will not work for parallel installs of
different vdr versions in different $PREFIXes.

best regards ...
clemens
  
Matthias Schwarzott March 11, 2008, 12:57 p.m. UTC | #3
On Dienstag, 11. März 2008, clemens kirchgatterer wrote:
> On Tue, Mar 11, 2008 at 12:27 AM, Matthias Schwarzott <zzam@gentoo.org> 
wrote:
> > On Montag, 10. März 2008, Ville Skyttä wrote:
> >
> >  So you can install .pc file anywhere you want if you add this location
> > to PKG_CONFIG_PATH.
> >
> >  So /usr/bin/pkg-config will always look into /usr/lib/pkgconfig.
> >  We can either use
> >  A. $(DESTDIR)/usr/lib/pkgconfig
> >  or
> >  B. $(DESTDIR)$(PREFIX)/lib/pkgconfig
> >
> >  For most installations A should be fine.
>
> definitly B, otherwise it will not work for parallel installs of
> different vdr versions in different $PREFIXes.
>

Ack!
BUT: B with default values from Makefile gives
/usr/local/lib/pkgconfig that by default is not in pkgconfig search-path.

And I wrote: "For most installations ..."

Matthias
  
Joerg Pulz March 11, 2008, 2:46 p.m. UTC | #4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Tue, 11 Mar 2008, Matthias Schwarzott wrote:

> On Dienstag, 11. März 2008, clemens kirchgatterer wrote:
>> On Tue, Mar 11, 2008 at 12:27 AM, Matthias Schwarzott <zzam@gentoo.org>
> wrote:
>>> On Montag, 10. März 2008, Ville Skyttä wrote:
>>>
>>>  So you can install .pc file anywhere you want if you add this location
>>> to PKG_CONFIG_PATH.
>>>
>>>  So /usr/bin/pkg-config will always look into /usr/lib/pkgconfig.
>>>  We can either use
>>>  A. $(DESTDIR)/usr/lib/pkgconfig
>>>  or
>>>  B. $(DESTDIR)$(PREFIX)/lib/pkgconfig
>>>
>>>  For most installations A should be fine.
>>
>> definitly B, otherwise it will not work for parallel installs of
>> different vdr versions in different $PREFIXes.
>>
>
> Ack!
> BUT: B with default values from Makefile gives
> /usr/local/lib/pkgconfig that by default is not in pkgconfig search-path.
>
> And I wrote: "For most installations ..."

What would you think is the default?

case 1:
download pkg-config, extract it, run configure, make, make install
and you end up with pkg-config installed in /usr/local/bin and the default 
search path will be "/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig"
as the configure script sets:
 	pc_path='${libdir}/pkgconfig:${datadir}/pkgconfig'
if there is no '--with-pc_path=/my/path' given to configure.
case 2:
install an openSuSE-10.3 (i386) system with the prepackaged pkg-config RPM 
and you end up with pkg-config installed in /usr/bin and the default search 
path is "/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:
/usr/lib/pkgconfig:/usr/share/pkgconfig:/opt/kde3/lib/pkgconfig"
case 3:
install a Debian-4.0 (x86_64) system with the prepackaged pkg-config DEB 
and you end up with pkg-config installed in /usr/bin and the default 
search path is "/usr/local/lib/pkgconfig:
/usr/local/lib/pkgconfig/x86_64-linux-gnu:/usr/local/share/pkgconfig:
/usr/lib/pkgconfig:/usr/lib/pkgconfig/x86_64-linux-gnu:/usr/share/pkgconfig"
case 4:
install FreeBSD and install the prebuilt pkg-config package or built it by 
hand out of the ports tree and you end up with pkg-config installed in 
/usr/local/bin and the default search path is "/usr/local/libdata/pkgconfig:
/usr/local/lib/pkgconfig"

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?

Joerg

- -- 
The beginning is the most important part of the work.
 				-Plato
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFH1ps+SPOsGF+KA+MRAvWCAJ9Q8xP2Zywci6CxH+Y0dLhahaLo/ACeJsrR
xSPJC+0zZ/vWNoRm879qMTs=
=auza
-----END PGP SIGNATURE-----
  
Clemens Kirchgatterer March 12, 2008, 7:13 a.m. UTC | #5
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.

best regards ...
clemens
  
Clemens Kirchgatterer March 12, 2008, 7:21 a.m. UTC | #6
On Wed, Mar 12, 2008 at 8:13 AM, clemens kirchgatterer <clemens@1541.org> 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.

i may add the reasoning: the only way i (as user) and up with software
installed in /usr/local/ is by compiling it myself. if i do so, i am
well aware of setting all relevant PATH variables as $PATH,
$LD_LIBRARY_PATH, $PKG_CONFIG_PATH. most likly these are allready set
for /usr/local in the systems default /etc/profile.

clemens
  

Patch

--- Makefile~	2008-03-06 21:29:58.000000000 +0200
+++ Makefile	2008-03-10 23:05:48.000000000 +0200
@@ -21,2 +21,3 @@ 
 BINDIR   = $(PREFIX)/bin
+INCLUDEDIR = $(PREFIX)/include
 LOCDIR   = ./locale
@@ -77,3 +78,3 @@ 
 
-all: vdr i18n
+all: vdr vdr.pc i18n
 
@@ -103,2 +104,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 +181,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
 
@@ -194,2 +213,8 @@ 
 
+# Headers:
+
+install-includes: include-dir
+	@mkdir -p $(DESTDIR)$(INCLUDEDIR)
+	@cp -pR include/vdr include/libsi $(DESTDIR)$(INCLUDEDIR)
+
 # Source documentation:
@@ -206,3 +231,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