From b2ed10dd837677cb98d15a0a483b489b24922c59 Mon Sep 17 00:00:00 2001 From: Matthieu Dorier Date: Mon, 24 Jul 2023 17:45:21 -0500 Subject: quickjs: make Makefile use correct compiler (#39060) * quickjs: make Makefile use correct compiler * added lto variant and better handling of compilers * quickjs: correct style * quickjs: correct style for flake8 --- var/spack/repos/builtin/packages/quickjs/package.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/var/spack/repos/builtin/packages/quickjs/package.py b/var/spack/repos/builtin/packages/quickjs/package.py index b690950952..6f77137b75 100644 --- a/var/spack/repos/builtin/packages/quickjs/package.py +++ b/var/spack/repos/builtin/packages/quickjs/package.py @@ -25,7 +25,16 @@ class Quickjs(MakefilePackage): "2020-09-06", sha256="0021a3e8cdc6b61e225411d05e2841d2437e1ccf4b4cabb9a5f7685ebfb57717" ) + variant("lto", default=True, when="%gcc", description="Enable link-time optimization") + def edit(self, spec, prefix): makefile = FileFilter("Makefile") makefile.filter("prefix=/usr/local", "prefix={}".format(prefix)) makefile.filter("lib/quickjs", "lib") + makefile.filter("CFLAGS=", "CFLAGS+=-fPIC ") + if "+lto" not in spec: + makefile.filter("CONFIG_LTO=y", "") + cc = self.compiler.cc + makefile.filter("^ *CC=.*", " CC={}".format(cc)) + makefile.filter("^ *HOST_CC=.*", " HOST_CC={}".format(cc)) + makefile.filter("gcc-ar", "{}-ar".format(cc)) -- cgit v1.2.3-70-g09d2