Bob Friesenhahn <[EMAIL PROTECTED]> writes: > On Wed, 12 Apr 2006, Tyler MacDonald wrote:
>> And find some way for makemaker to treat those SUBDIRS as "black >> box" perl modules. I'd also like some way to pass extra arguments into the >> Makefile.PL/Build.PL to pull in libraries elsewhere in the project tree, > This is a problem since MakeMaker makes no provision for using > uninstalled libraries. The only way it works reliably is if the > libraries are installed. Regardless, I have found ways to use > uninstalled libraries if the Perl extension is built as static > (stand-alone executable). There is an annoying issue is that when > Makefile.PL is 'executed' to create Makefile, the libraries are scanned > for at that time. No warranty, and if it breaks, you get to keep both pieces. # It's practically impossible to change the library link order with the Perl # build system. It's also pratically impossible to correctly link a Perl # extension against a library that's built out of the same source tree without # introducing an rpath to the source tree, a potential security hole. # # If I don't tell MakeMaker about the full path to the just-built library, it # will helpfully delete the -lwebauth reference and then create a broken # module, while saying that this is probably harmless. If I do include it, I # have to fight with it to not add an rpath to the built module. I did the # latter. I don't know how portable this will be, but it's the only thing I # can come up with that actually works. use Config; use ExtUtils::MakeMaker; # We have to tell MakeMaker to find the WebAuth library here. $PATH = '@abs_top_builddir@/src/libwebauth/.libs'; # Hack the local path into lddlflags so that it will be first. Otherwise, we # may accidentally build against an already installed libwebauth instead of # the one that we just built. my $lddlflags = $Config{lddlflags}; my $additions = "-L$PATH @LDFLAGS@"; $lddlflags =~ s%(^| )-L% $additions -L%; # Override extliblist so that it never puts anything relative to the build # directory into LD_RUN_PATH. Otherwise, ExtUtils::Liblist will hard-code the # build directory into the rpath of the module .so because it's trying to be # *way* too helpful. package MY; sub const_loadlibs { my $loadlibs = shift->SUPER::const_loadlibs (@_); $loadlibs =~ s%^(LD_RUN_PATH =.*[\s:])$main::PATH(:|\n)%$1$2%m; return $loadlibs; } package main; -- Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/>