From 2f84db881bf93d428aed101edf84e9dfa649317a Mon Sep 17 00:00:00 2001 From: "Mark W. Krentel" Date: Tue, 6 Aug 2019 22:21:25 -0500 Subject: ncurses: fix pic and opt flags (#12272) Resolves #11932. Move the PIC flags from CFLAGS on the configure line to the spack compiler wrapper for ncurses. The problem with the configure line for autotools is that specifying CFLAGS sets the entire flags, thus deleting the flags that configure would add itself. By default, if CFLAGS is unspecified, then configure picks a sensible default of `-g -O2`. But adding `-fPIC` erases these and it ends up building unoptimized. --- var/spack/repos/builtin/packages/ncurses/package.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/ncurses/package.py b/var/spack/repos/builtin/packages/ncurses/package.py index 383c0bf1d5..a68021f078 100644 --- a/var/spack/repos/builtin/packages/ncurses/package.py +++ b/var/spack/repos/builtin/packages/ncurses/package.py @@ -36,10 +36,14 @@ class Ncurses(AutotoolsPackage): def setup_environment(self, spack_env, run_env): spack_env.unset('TERMINFO') + def flag_handler(self, name, flags): + if name == 'cflags' or name == 'cxxflags': + flags.append(self.compiler.pic_flag) + + return (flags, None, None) + def configure(self, spec, prefix): opts = [ - 'CFLAGS={0}'.format(self.compiler.pic_flag), - 'CXXFLAGS={0}'.format(self.compiler.pic_flag), '--with-shared', '--with-cxx-shared', '--enable-overwrite', -- cgit v1.2.3-70-g09d2