From aba9149b716bf0216281bb485bf9e71a9b49c9f8 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 25 May 2022 15:24:38 +0200 Subject: p7zip: fix %clang (#30843) --- var/spack/repos/builtin/packages/p7zip/package.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/p7zip/package.py b/var/spack/repos/builtin/packages/p7zip/package.py index 9f4384a08d..fdf5b4a08b 100644 --- a/var/spack/repos/builtin/packages/p7zip/package.py +++ b/var/spack/repos/builtin/packages/p7zip/package.py @@ -23,12 +23,23 @@ class P7zip(MakefilePackage): # all3 includes 7z, 7za, and 7zr build_targets = ['all3'] + depends_on('yasm', type='build', when='%clang') + def edit(self, spec, prefix): - if 'platform=darwin' in self.spec: - if '%gcc' in self.spec: - copy('makefile.macosx_gcc_64bits', 'makefile.machine') - elif '%apple-clang' in self.spec or '%clang' in self.spec: - copy('makefile.macosx_llvm_64bits', 'makefile.machine') + # Use the suggested makefile + for tgt, makefile in { + 'platform=linux %clang': 'makefile.linux_clang_amd64_asm', + 'platform=darwin %gcc': 'makefile.macosx_gcc_64bits', + 'platform=darwin %apple-clang': 'makefile.macosx_llvm_64bits', + 'platform=darwin %clang': 'makefile.macosx_llvm_64bits', + }.items(): + if tgt in self.spec: + copy(makefile, 'makefile.machine') + break + # Silence an error about -Wc++11-narrowing in clang. + if '@16.02 %clang' in spec: + with open('makefile.machine', 'a') as f: + f.write("ALLFLAGS += -Wno-c++11-narrowing") @property def install_targets(self): -- cgit v1.2.3-60-g2f50