libtool, binutils: fix darwin linking (#7073)

* libtool: fix linking of libtool on darwin

* binutils, libtool: fix conflicts w/ BSD tools, v2

Fix namespace conflicts with BSD tools in a more elegant fashion,
using a program prefix, similar to Homebrew.
This commit is contained in:
Geoffrey Oxberry 2018-01-28 06:36:24 -08:00 committed by Massimiliano Culpo
parent 970c7e8f45
commit 784234ae8e
2 changed files with 12 additions and 7 deletions

View File

@ -79,4 +79,10 @@ def configure_args(self):
if '+libiberty' in spec:
configure_args.append('--enable-install-libiberty')
# To avoid namespace collisions with Darwin/BSD system tools,
# prefix executables with "g", e.g., gar, gnm; see Homebrew
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/binutils.rb
if spec.satisfies('platform=darwin'):
configure_args.append('--program-prefix=g')
return configure_args

View File

@ -50,20 +50,19 @@ def setup_dependent_package(self, module, dependent_spec):
# the tools it provides to the dependent module. Some build
# systems differentiate between BSD libtool (e.g., Darwin) and
# GNU libtool, so also add 'glibtool' and 'glibtoolize' to the
# list of executables.
# list of executables. See Homebrew:
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/libtool.rb
executables = ['libtoolize', 'libtool', 'glibtoolize', 'glibtool']
for name in executables:
setattr(module, name, self._make_executable(name))
@run_after('install')
def post_install(self):
@when('platform=darwin')
def configure_args(self):
# Some platforms name GNU libtool and GNU libtoolize
# 'glibtool' and 'glibtoolize', respectively, to differentiate
# them from BSD libtool and BSD libtoolize. On these BSD
# platforms, build systems sometimes expect to use the assumed
# GNU commands glibtool and glibtoolize instead of the BSD
# variant; this happens frequently, for instance, on Darwin
symlink(join_path(self.prefix.bin, 'libtoolize'),
join_path(self.prefix.bin, 'glibtoolize'))
symlink(join_path(self.prefix.bin, 'libtoolize'),
join_path(self.prefix.bin, 'glibtoolize'))
args = ['--program-prefix=g']
return args