From 4d25632e59dda75744a618da45014e03a4f031f9 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 16 Apr 2020 17:30:24 -0700 Subject: macOS: Fix emacs Linking (#16106) * macOS: Fix emacs Linking Fix linking issue of emacs on macOS (clang and gcc). Applies the same work-around as conda-forge: https://github.com/conda-forge/emacs-feedstock/blob/b051f6c928d8b99fed3fabd9a8d67be993f94494/recipe/build.sh Homebrew avoids this by linking against the system ncurses lib: https://github.com/Homebrew/homebrew-core/blob/master/Formula/emacs.rb * ncurses: fix outdated variant comment this comment was build on the assumption that gnutls triggers a termlib dependency in emacs. that's not the case, ncurses itself depends on termlib when build with this feature. --- var/spack/repos/builtin/packages/emacs/package.py | 7 +++++++ var/spack/repos/builtin/packages/ncurses/package.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/emacs/package.py b/var/spack/repos/builtin/packages/emacs/package.py index d073157826..6842e79043 100644 --- a/var/spack/repos/builtin/packages/emacs/package.py +++ b/var/spack/repos/builtin/packages/emacs/package.py @@ -47,6 +47,13 @@ class Emacs(AutotoolsPackage, GNUMirrorPackage): depends_on('gnutls', when='+tls') depends_on('jpeg') + @when('platform=darwin') + def setup_build_environment(self, env): + # on macOS, emacs' config does search hard enough for ncurses' + # termlib `-ltinfo` lib, which results in linker errors + if '+termlib' in spec['ncurses']: + env.append_flags('LDFLAGS', '-ltinfo') + def configure_args(self): spec = self.spec diff --git a/var/spack/repos/builtin/packages/ncurses/package.py b/var/spack/repos/builtin/packages/ncurses/package.py index 85fd9d68f8..cfb122623d 100644 --- a/var/spack/repos/builtin/packages/ncurses/package.py +++ b/var/spack/repos/builtin/packages/ncurses/package.py @@ -28,7 +28,8 @@ class Ncurses(AutotoolsPackage, GNUMirrorPackage): variant('symlinks', default=False, description='Enables symlinks. Needed on AFS filesystem.') variant('termlib', default=True, - description='Enables termlib needs for gnutls in emacs.') + description='Enables termlib features. This is an extra ' + 'lib and optional internal dependency.') depends_on('pkgconfig', type='build') -- cgit v1.2.3-60-g2f50