source: web/old/remctl-2.14/perl/Makefile.PL.in @ f6f3e91

web
Last change on this file since f6f3e91 was f6f3e91, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago

Preserve directory hierarchy (not sure what happened to it)

  • Property mode set to 100644
File size: 2.2 KB
Line 
1# Makefile.PL for libremctl Perl bindings.  -*- perl -*-
2#
3# Written by Russ Allbery
4# Copyright 2007 Board of Trustees, Leland Stanford Jr. University
5#
6# See LICENSE for licensing terms.
7
8# It's practically impossible to change the library link order with the Perl
9# build system.  It's also pratically impossible to correctly link a Perl
10# extension against a library that's built out of the same source tree without
11# introducing an rpath to the source tree, a potential security hole.
12#
13# If I don't tell MakeMaker about the full path to the just-built library, it
14# will helpfully delete the -lremctl reference and then create a broken
15# module, while saying that this is probably harmless.  If I do include it, I
16# have to fight with it to not add an rpath to the built module.  I did the
17# latter.  I don't know how portable this will be, but it's the only thing I
18# can come up with that actually works.
19
20use Config;
21use ExtUtils::MakeMaker;
22
23# We have to tell MakeMaker to find libremctl here.
24$PATH = '@abs_top_builddir@/client/.libs';
25
26# Hack the local path into lddlflags so that it will be first.  Otherwise, we
27# may accidentally build against an already installed libremctl instead of the
28# one that we just built.
29my $lddlflags = $Config{lddlflags};
30my $additions = "-L$PATH @LDFLAGS@";
31$lddlflags =~ s%(^| )-L% $additions -L%;
32
33# Override extliblist so that it never puts anything relative to the build
34# directory into LD_RUN_PATH.  Otherwise, ExtUtils::Liblist will hard-code the
35# build directory into the rpath of the module .so because it's trying to be
36# *way* too helpful.
37package MY;
38sub const_loadlibs {
39    my $loadlibs = shift->SUPER::const_loadlibs (@_);
40    $loadlibs =~ s%^(LD_RUN_PATH =.*[\s:])$main::PATH(:|\n)%$1$2%m;
41    return $loadlibs;
42}
43package main;
44
45# Okay, we can finally generate the Makefile.
46use ExtUtils::MakeMaker;
47WriteMakefile (
48    NAME              => 'Net::Remctl',
49    VERSION_FROM      => 'Remctl.pm',
50    ($] >= 5.005 ?
51      (ABSTRACT_FROM  => 'Remctl.pm',
52       AUTHOR         => 'Russ Allbery (rra@stanford.edu)') : ()),
53    INC               => '-I@top_srcdir@/client',
54    LDDLFLAGS         => $lddlflags,
55    LIBS              => "$additions -lremctl @LIBS@",
56);
Note: See TracBrowser for help on using the repository browser.