[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ppp plugins and dependencies



On 07/06/15 12:35, Chris Boot wrote:
> On 07/06/15 11:49, Michael Biebl wrote:
>> Shipping a .pc file upstream to get the correct plugin directory (and
>> build flags) sounds like a useful addition.
> 
> Upstream's build system is... archaic. It doesn't autotools and its
> configure script is hand-built and does its own templating. I don't
> think there's much scope for adding pkg-config upstream, sadly.

.pc files without Autotools are pretty easy: all you really need is some
way to substitute the variables that dependent packages ought to use.
For instance pppd/Makefile.linux could do this:

pppd.pc: pppd.pc.in Makefile
	sed -e 's![@]plugindir[@]!${LIBDIR}!' \
		-e 's![@]pppd[@]!${BINDIR}/pppd!' \
		-e 's![@]includedir[@]!${INCDIR}!' \
		-e 's![@]VERSION[@]!${VERSION}!' \
		< $< > $@

with pppd.pc.in containing something like this:

plugindir=@plugindir@
pppd=@pppd@
includedir=@includedir@

Name: pppd
Description: PPP daemon
Requires:
Version: @VERSION@
Cflags: -I${includedir}

and the definition of LIBDIR copied from pppd/plugins/Makefile.linux
into pppd/Makefile.linux.

Then you could use `pkg-config --cflags pppd`, `pkg-config
--variable=plugindir pppd`, `pkg-config --variable=pppd pppd` to get the
necessary information.

(This is untested and might contain errors, but you get the idea. I'm
assuming that Makefile is dynamically created with @SUBSTITUTIONS@
substituted, like it is for Autotools - if it isn't, the dependency
might need adjustment.)

    S


Reply to: