fontconfig: add pic variant and support static deps (#44884)
* fontconfig: add pic variant; allow static dependencies * Revise fontconfig to clean up flags * Revise fontconfig to remove unnecessary flag * Update fontconfig * update fontconfig logic for static deps
This commit is contained in:
parent
d2fc0d6a35
commit
fd0baca222
@ -33,6 +33,8 @@ class Fontconfig(AutotoolsPackage):
|
||||
depends_on("uuid", when="@2.13.1:")
|
||||
depends_on("python@3:", type="build", when="@2.13.93:")
|
||||
|
||||
variant("pic", default=False, description="Enable position-independent code (PIC)")
|
||||
|
||||
def patch(self):
|
||||
"""Make test/run-test.sh compatible with dash"""
|
||||
filter_file("SIGINT SIGTERM SIGABRT EXIT", "2 15 6 0", "test/run-test.sh")
|
||||
@ -45,8 +47,29 @@ def _rm_offending_header(self):
|
||||
|
||||
def configure_args(self):
|
||||
font_path = join_path(self.spec["font-util"].prefix, "share", "fonts")
|
||||
args = ["--enable-libxml2", "--disable-docs", f"--with-default-fonts={font_path}"]
|
||||
ldflags = []
|
||||
libs = []
|
||||
deps = []
|
||||
if self.spec["bzip2"].satisfies("~shared"):
|
||||
deps.append("bzip2")
|
||||
if not self.spec["libpng"].satisfies("libs=shared"):
|
||||
deps.append("libpng")
|
||||
if self.spec["libxml2"].satisfies("~shared"):
|
||||
deps.append("libxml-2.0")
|
||||
if deps:
|
||||
pc = which("pkg-config")
|
||||
for lib in deps:
|
||||
ldflags.append(pc(lib, "--static", "--libs-only-L", output=str).strip())
|
||||
libs.append(pc(lib, "--static", "--libs-only-l", output=str).strip())
|
||||
args.append("LDFLAGS=%s" % " ".join(ldflags))
|
||||
args.append("LIBS=%s" % " ".join(libs))
|
||||
|
||||
return ["--enable-libxml2", "--disable-docs", f"--with-default-fonts={font_path}"]
|
||||
if self.spec.satisfies("+pic"):
|
||||
args.append(f"CFLAGS={self.compiler.cc_pic_flag}")
|
||||
args.append(f"FFLAGS={self.compiler.f77_pic_flag}")
|
||||
|
||||
return args
|
||||
|
||||
@run_after("install")
|
||||
def system_fonts(self):
|
||||
|
Loading…
Reference in New Issue
Block a user