Skip to content
Snippets Groups Projects
Commit 784234ae authored by Geoffrey Oxberry's avatar Geoffrey Oxberry Committed by Massimiliano Culpo
Browse files

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.
parent 970c7e8f
Branches
Tags
No related merge requests found
...@@ -79,4 +79,10 @@ def configure_args(self): ...@@ -79,4 +79,10 @@ def configure_args(self):
if '+libiberty' in spec: if '+libiberty' in spec:
configure_args.append('--enable-install-libiberty') 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 return configure_args
...@@ -50,20 +50,19 @@ def setup_dependent_package(self, module, dependent_spec): ...@@ -50,20 +50,19 @@ def setup_dependent_package(self, module, dependent_spec):
# the tools it provides to the dependent module. Some build # the tools it provides to the dependent module. Some build
# systems differentiate between BSD libtool (e.g., Darwin) and # systems differentiate between BSD libtool (e.g., Darwin) and
# GNU libtool, so also add 'glibtool' and 'glibtoolize' to the # 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'] executables = ['libtoolize', 'libtool', 'glibtoolize', 'glibtool']
for name in executables: for name in executables:
setattr(module, name, self._make_executable(name)) setattr(module, name, self._make_executable(name))
@run_after('install') @when('platform=darwin')
def post_install(self): def configure_args(self):
# Some platforms name GNU libtool and GNU libtoolize # Some platforms name GNU libtool and GNU libtoolize
# 'glibtool' and 'glibtoolize', respectively, to differentiate # 'glibtool' and 'glibtoolize', respectively, to differentiate
# them from BSD libtool and BSD libtoolize. On these BSD # them from BSD libtool and BSD libtoolize. On these BSD
# platforms, build systems sometimes expect to use the assumed # platforms, build systems sometimes expect to use the assumed
# GNU commands glibtool and glibtoolize instead of the BSD # GNU commands glibtool and glibtoolize instead of the BSD
# variant; this happens frequently, for instance, on Darwin # variant; this happens frequently, for instance, on Darwin
symlink(join_path(self.prefix.bin, 'libtoolize'), args = ['--program-prefix=g']
join_path(self.prefix.bin, 'glibtoolize')) return args
symlink(join_path(self.prefix.bin, 'libtoolize'),
join_path(self.prefix.bin, 'glibtoolize'))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment