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
This commit is contained in:
Matthieu Dorier 2023-07-24 17:45:21 -05:00 committed by GitHub
parent 1c3dc0bd5f
commit b2ed10dd83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))