While trying to build the official Debian packages for libguestfs 1.22,
I noticed that instead of working around ExtUtils::MakeMaker's
limitations, I had made quite a mess of building the Perl bindings. I
have tried from different sides to fix things, but could not get it
quite right:
- EU::MM expects Makefile.PL to be in the same directory as the generated
Makefile (We work around that using sed.)
- In principle, there seem to be two ways to do things:
1. Call make -f builddir/Makefile-pl from srcdir (that's what we do
now), override INST_*. Problems with this:
- XS is still built in srcdir.
- there is actually code in ExtUtils::Install which is used from the
generated Makefile-pl that bases its decisions where to install
*.pm files on whether there are any files within ./blib/arch/
(hard-coded)! I have found no way to override this.
2. Call make -f Makefile-pl from builddir. I tried that and thought
that I would be able to patch absolute paths for source files
(*.xs, lib/*) and generated files (*.c, *.xs, blib/*) into the
generated Makefile-pl. Much of a perfectly good weekend went to
waste over that attempt.
I realized that I was actively working against ExtUtils::MakeMaker's
design. Separating source and build trees has never been a concern. Even
if I got it right once, I'd expect things to break in interesting ways
in the future.
From a look at the documentation, Module::Build does not seem to have
a
solution, either.
I give up and propose that we go back to the hackish, yet simple
previous solution and adopt that for libguestfs as well:
-[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/. $(builddir)/.
I agree that this is ugly, but works and it won't hurt when building
libguestfs from within the source directory.
Cheers,
-Hilko