diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-07-12 19:21:01 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-07-12 19:21:01 +0000 |
commit | 79a8825ce8d1d5aefcbde645718cf83f90f0119c (patch) | |
tree | f15f0454e2093ac99bcea2e033f1f610e6f76bd5 /usr.bin/libtool/LT | |
parent | e703878bcb4dd3f9a073c667dedce5c76550ae84 (diff) |
common code for deducing libraries.
Still fucks up order somehow...
Diffstat (limited to 'usr.bin/libtool/LT')
-rw-r--r-- | usr.bin/libtool/LT/LaFile.pm | 11 | ||||
-rw-r--r-- | usr.bin/libtool/LT/Linker.pm | 19 | ||||
-rw-r--r-- | usr.bin/libtool/LT/Program.pm | 11 |
3 files changed, 22 insertions, 19 deletions
diff --git a/usr.bin/libtool/LT/LaFile.pm b/usr.bin/libtool/LT/LaFile.pm index a2a1aa93358..df80e4bdf8b 100644 --- a/usr.bin/libtool/LT/LaFile.pm +++ b/usr.bin/libtool/LT/LaFile.pm @@ -1,4 +1,4 @@ -# $OpenBSD: LaFile.pm,v 1.15 2012/07/12 11:43:46 espie Exp $ +# $OpenBSD: LaFile.pm,v 1.16 2012/07/12 19:21:00 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org> # Copyright (c) 2012 Marc Espie <espie@openbsd.org> @@ -319,14 +319,7 @@ sub link } else { push @libflags, '-Wl,-no-whole-archive' if $prev_was_archive; $prev_was_archive = 0; - my $lib = basename($a); - if ($lib =~ m/^lib(.*)\.so(\.\d+){2}/) { - $lib = $1; - } else { - say "warning: cannot derive -l flag from library filename $a, assuming hash key -l$k"; - $lib = $k; - } - push @libflags, "-l$lib"; + push @libflags, $linker->infer_libparameter($a, $k); } $libcounter++; } diff --git a/usr.bin/libtool/LT/Linker.pm b/usr.bin/libtool/LT/Linker.pm index 7637954b9f3..93b1da58a37 100644 --- a/usr.bin/libtool/LT/Linker.pm +++ b/usr.bin/libtool/LT/Linker.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Linker.pm,v 1.4 2012/07/12 09:43:34 espie Exp $ +# $OpenBSD: Linker.pm,v 1.5 2012/07/12 19:21:00 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org> # Copyright (c) 2012 Marc Espie <espie@openbsd.org> @@ -81,6 +81,23 @@ sub common1 tsay {"final orderedlibs = @$orderedlibs"}; return ($staticlibs, $orderedlibs, $args); } + +sub infer_libparameter +{ + my ($self, $a, $k) = @_; + my $lib = basename($a); + if ($lib =~ m/^lib(.*)\.so(\.\d+){2}$/) { + $lib = $1; + } elsif ($lib =~ m/^lib(.*)\.so$/) { + say "warning: library filename $a has no version number"; + $lib = $1; + } else { + say "warning: cannot derive -l flag from library filename $a, assuming hash key -l$k"; + $lib = $k; + } + return "-l$lib"; +} + 1; diff --git a/usr.bin/libtool/LT/Program.pm b/usr.bin/libtool/LT/Program.pm index 5aa965eea6f..009f08f5a7e 100644 --- a/usr.bin/libtool/LT/Program.pm +++ b/usr.bin/libtool/LT/Program.pm @@ -1,4 +1,4 @@ -# $OpenBSD: Program.pm,v 1.17 2012/07/12 11:43:46 espie Exp $ +# $OpenBSD: Program.pm,v 1.18 2012/07/12 19:21:00 espie Exp $ # Copyright (c) 2007-2010 Steven Mestdagh <steven@openbsd.org> # Copyright (c) 2012 Marc Espie <espie@openbsd.org> @@ -165,14 +165,7 @@ sub link # don't make a -lfoo out of a static library push @libflags, $a; } else { - my $lib = basename($a); - if ($lib =~ m/^lib(.*)\.so(\.\d+){2}/) { - $lib = $1; - } else { - say "warning: cannot derive -l flag from library filename $a, assuming hash key $k"; - $lib = $k; - } - push @libflags, "-l$lib"; + push @libflags, $linker->infer_libparameter($a, $k); } } |