X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=bindings%2Fperl-shared%2FMakefile.PL;h=8793dd8fb78874e62e3877396cd77cee4a836e69;hb=b894ebf96ca888b9e3e13b2ab86a6c6f284b757c;hp=1701ded92832acf39530725f1d3635f1698eb600;hpb=d13a11d9abb791a0755bddb8a74ed36be59a82ad;p=rrdtool.git diff --git a/bindings/perl-shared/Makefile.PL b/bindings/perl-shared/Makefile.PL index 1701ded..8793dd8 100644 --- a/bindings/perl-shared/Makefile.PL +++ b/bindings/perl-shared/Makefile.PL @@ -3,9 +3,27 @@ use Config; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. -# Specify the location of the archive containing PIC compiled object files. -my $R = $^O eq 'Linux' ? "-Wl,--rpath -Wl," : "-R" ; -my $librrd = "-L../../src/.libs/ $R\$(RPATH) -lrrd"; +# if the last argument when calling Makefile.PL is RPATH=/... and ... is the +# path to librrd.so then the Makefile will be written such that RRDs.so knows +# where to find librrd.so later on ... +my $R=""; +if ($ARGV[-1] =~ /RPATH=(\S+)/){ + pop @ARGV; + my $rp = $1; + for ($^O){ + /linux/ && do{ $R = "-Wl,--rpath -Wl,$rp"}; + /hpux/ && do{ $R = "+b$rp"}; + /solaris/ && do{ $R = "-R$rp"}; + /aix/ && do{ $R = "-Wl,-blibpath:$rp"}; + } +} + +# darwin works without this because librrd contains its +# install_name which will includes the final location of the +# library after it is installed. This install_name gets transfered +# to the perl shared object. + +my $librrd = "-L../../src/.libs/ $R -lrrd"; WriteMakefile( 'NAME' => 'RRDs', @@ -13,6 +31,9 @@ WriteMakefile( 'DEFINE' => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}", 'INC' => '-I../../src', # Perl will figure out which one is valid - 'dynamic_lib' => {'OTHERLDFLAGS' => "$librrd -lm"}, + #'dynamic_lib' => {'OTHERLDFLAGS' => "$librrd -lm"}, + 'depend' => {'RRDs.c' => "../../src/librrd.la"}, + 'LDFROM' => '$(OBJECT) '.$librrd, 'realclean' => {FILES => 't/demo?.rrd t/demo?.png' } ); +