diff options
Diffstat (limited to 'make/unit-cc.pl')
-rwxr-xr-x | make/unit-cc.pl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/make/unit-cc.pl b/make/unit-cc.pl index f04423ce3..1cf6cf866 100755 --- a/make/unit-cc.pl +++ b/make/unit-cc.pl @@ -29,16 +29,14 @@ use warnings FATAL => qw(all); use File::Spec::Functions qw(abs2rel); -use make::configure; use make::console; +use make::directive; chdir $ENV{BUILDPATH}; my $type = shift; my $out = shift; -our %config = read_configure_cache(); - if ($type eq 'gen-ld') { do_static_find(@ARGV); } elsif ($type eq 'static-ld') { @@ -67,10 +65,16 @@ sub message($$$) { } } +sub rpath($) { + my $message = shift; + $message =~ s/-L(\S+)/-Wl,-rpath,$1 -L$1/g unless defined $ENV{INSPIRCD_DISABLE_RPATH}; + return $message; +} + sub do_static_find { my @flags; for my $file (@ARGV) { - push @flags, get_property($file, 'LinkerFlags'); + push @flags, rpath(get_directive($file, 'LinkerFlags', '')); } open F, '>', $out; print F join ' ', @flags; @@ -106,7 +110,7 @@ sub do_core_link { sub do_link_dir { my ($dir, $link_flags) = (shift, ''); for my $file (<$dir/*.cpp>) { - $link_flags .= get_property($file, 'LinkerFlags') . ' '; + $link_flags .= rpath(get_directive($file, 'LinkerFlags', '')) . ' '; } my $execstr = "$ENV{CXX} -o $out $ENV{PICLDFLAGS} $link_flags @_"; message 'LINK', $out, $execstr; @@ -119,7 +123,7 @@ sub do_compile { my $flags = ''; my $libs = ''; if ($do_compile) { - $flags = $ENV{CORECXXFLAGS} . ' ' . get_property($file, 'CompileFlags'); + $flags = $ENV{CORECXXFLAGS} . ' ' . get_directive($file, 'CompilerFlags', ''); if ($file =~ m#(?:^|/)((?:m|core)_[^/. ]+)(?:\.cpp|/.*\.cpp)$#) { $flags .= ' -DMODNAME=\\"'.$1.'\\"'; @@ -128,7 +132,7 @@ sub do_compile { if ($do_link) { $flags = join ' ', $flags, $ENV{PICLDFLAGS}; - $libs = get_property($file, 'LinkerFlags'); + $libs = rpath(get_directive($file, 'LinkerFlags', '')); } else { $flags .= ' -c'; } |