build: Replace -lLIB with LIB.a for locally built libraries

LIBPATH in the generated Makefile may contain -L$(archlibdir) before
the ports' lib directories.  Disable path searching by resolving absolute
paths of locally built libraries.

Fixes issue #50.
This commit is contained in:
Daiki Ueno 2014-09-08 12:23:04 +09:00
Родитель fc299c9c1f
Коммит 325e772ff5
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -133,8 +133,20 @@ EOS
else
$LIBPATH = $LIBPATH | [lpath]
end
when /\A-l./
libs.push(arg)
when /\A-l(.+)\z/
# Resolve absolute paths of local static libraries to avoid
# linking with system libraries.
libname_to_recipe = {
'gpgme' => gpgme_recipe,
'assuan' => libassuan_recipe,
'gpg-error' => libgpg_error_recipe
}
recipe = libname_to_recipe[$1]
if recipe
libs.push(File.join(recipe.path, 'lib', "lib#{$1}.#{$LIBEXT}"))
else
libs.push(arg)
end
else
$LDFLAGS << ' ' << arg.shellescape
end