X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=bindings%2Fperl-shared%2FMakefile.PL;h=c4573070da057caa19f2deb0a80b5f59987f6cbd;hp=598fc99f72e05cc7fb40252f47778afb901da9ec;hb=cdbb3ff0c9f7e26edf743ec8a1f8a39c86223789;hpb=ec028ffc51de6a4d33427ea505e2839b0516fd7d diff --git a/bindings/perl-shared/Makefile.PL b/bindings/perl-shared/Makefile.PL index 598fc99..c457307 100644 --- a/bindings/perl-shared/Makefile.PL +++ b/bindings/perl-shared/Makefile.PL @@ -3,18 +3,45 @@ 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"}; + /bsd/ && 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; +if ($^O eq 'darwin'){ + $librrd = '-lrrd'; +} +else { + $librrd = "-L../../src/.libs/ $R -lrrd"; +} WriteMakefile( 'NAME' => 'RRDs', 'VERSION_FROM' => 'RRDs.pm', # finds $VERSION 'DEFINE' => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}", - 'INC' => '-I../../src -I../../libraries/gd1.3', - # where to look for the necessary libraries + 'INC' => '-I../../src', # Perl will figure out which one is valid - 'depend' => {'RRDs.c' => "../../src/.libs/librrd.a"}, - 'dynamic_lib' => {'OTHERLDFLAGS' => "$librrd -lm"}, - 'realclean' => {FILES => 't/demo?.rrd t/demo?.png' } + #'dynamic_lib' => {'OTHERLDFLAGS' => "$librrd -lm"}, + 'depend' => {'RRDs.c' => "../../src/librrd.la"}, + 'LDFROM' => '$(OBJECT) '.$librrd, + 'realclean' => {FILES => 't/demo?.rrd t/demo?.png' }, + ($^O eq 'darwin') ? ( 'LDDLFLAGS' => "-L../../src/.libs/ $Config{lddlflags}" ) : () ); +