On Mon, 6 Jan 2014 17:54:56 -0500
Chris Marshall <devel.chm...@gmail.com> wrote:

> Again, Alien modules are for *perl* to access external dependencies
> and not for other external dependencies to access eachother---you've
> already given a bunch of examples of the standard pkg-config use
> in builds.

But now I don't understand how any e.g. smoketest machine can ever pass
this. How can a smoker install Alien::libtermkey? libtermkey's Makefile
has to know how to find unibilium, and only Alien::unibilium knows
where that is. The C-level agnostic-of-Perl Makefile only asks
pkg-config, and pkg-config has no clue.

The only possible way is if Alien::libtermkey tells it, but there is no
general mechanism for this to work.

...

Perhaps I need to see a concrete real example here.

Right now, libtermkey's Makefile looks like this:

ifeq ($(shell pkg-config --atleast-version=0.1.0 unibilium && echo 1),1)
  CFLAGS +=$(shell pkg-config --cflags unibilium) -DHAVE_UNIBILIUM
  LDFLAGS+=$(shell pkg-config --libs   unibilium)
else ...

I cannot see how that can /ever/ find what Alien::unibilium has
installed. At absolute best, PKG_CONFIG_PATH could be set to point at a
directory containing unibilium.pc, but the problem is no such file
exists in a useable form, because one wasn't written. The install 
process for unibilium did install /a/ .pc file but that is NOT USEABLE
at present, because it needs altering to make it work for the odd
directory locations that Alien::unibilium was forced to install it
into, as it wasn't root at the time. Namely:

   local $ENV{PKG_CONFIG_PATH} = "$libdir/pkgconfig/" if $use_bundled;
   unshift @args, "--define-variable=libdir=$libdir" if $use_bundled;

   open my $eupc, "-|", "pkg-config", @args, $module or
      die "Cannot popen pkg-config - $!";

   my $ret = do { local $/; <$eupc> }; chomp $ret;
   close $eupc;

and furthermore

sub libs
{
   # Append RPATH so that runtime linking actually works
   return _get_pkgconfig( libs => @_ ) .
      ( $use_bundled ? " -Wl,-R$libdir" : "" );
}

Because of this, I cannot see how Alien::libtermkey can /ever/ be
installed automated on a brand-new "clean slate" machine, without user
intervention specific to these libraries.

You suggest it is possible though, so perhaps you can explain to me
what code I can write in either Alien::unbilium to better export the
information so that libtermkey's Makefile can find it via pkg-config
alone, or else what code I can write in Alien::libtermkey to help drive
the build process to provide the extra information.

The current versions of both modules are visible on CPAN, so you can
refer there...

...

Once again, a summary of the facts:

 1) Alien::unibilium has to install the unibilium C library into Perl's
    @INC dir, and thus make up path names that /ONLY IT CAN KNOW/ for
    where to put the include and .pc files

 2) Alien::unibilium has to install unibilium.pc into lib/pkg-config
    knowing full well that the contents of the file as supplied by the
    unibilium C library /CANNOT BE USED/ as they stand, as certain
    options are missing (namely, the true $libdir and the adjustment of
    the RPATH linker option).

 3) libtermkey, the C library, invokes pkg-config in order to find
    unibilium, and does not involve Perl in the process at all.

Right now, about the only idea that I can see is that Alien::unibilium
has to invent a new unibilium.pc file that is useable as it stands, so
it can force the Makefile to find it by only setting PKG_CONFIG_PATH to
include the directory it can be found in. But this then involves an
Alien wrapping writing a new .pc file when it installs, other than the
one the original library actually supplied. That feels wrong to me.

-- 
Paul "LeoNerd" Evans

leon...@leonerd.org.uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Reply via email to