cairo: fix a few "wrong" defaults (#49415)
Having variants all conditional leaves a lot more degree of freedom to clingo, and slows down the search. If variants have inconsistent defaults, we might end up with multiple, equally sub-optimal solutions. Sometimes this creates a "plateau" in the search space. Remove conditional boolean variants that can't be activated, since this just increases the complexity of the model. If 4 variants have to be all active / inactive together, it's better to use a single requires, than to explode it into multiple statements dealing with a single variant at a time. Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:

committed by
GitHub

parent
cb4d3a9fc2
commit
9875a0e807
@@ -45,14 +45,18 @@ class Cairo(AutotoolsPackage, MesonPackage):
|
|||||||
variant("X", default=False, description="Build with X11 support")
|
variant("X", default=False, description="Build with X11 support")
|
||||||
variant("gobject", default=False, description="Enable cairo's gobject functions feature")
|
variant("gobject", default=False, description="Enable cairo's gobject functions feature")
|
||||||
|
|
||||||
|
variant("svg", default=False, description="Enable cairo's SVG functions feature")
|
||||||
|
variant("png", default=False, description="Enable cairo's PNG functions feature")
|
||||||
|
|
||||||
|
# doesn't exist @1.17.8: but kept as compatibility
|
||||||
|
variant("pdf", default=False, description="Enable cairo's PDF surface backend feature")
|
||||||
|
|
||||||
|
variant("ft", default=False, description="Enable cairo's FreeType font backend feature")
|
||||||
|
variant("fc", default=False, description="Enable cairo's Fontconfig font backend feature")
|
||||||
|
|
||||||
# variants and build system depends for the autotools builds
|
# variants and build system depends for the autotools builds
|
||||||
with when("build_system=autotools"):
|
with when("build_system=autotools"):
|
||||||
variant("png", default=False, description="Enable cairo's PNG functions feature")
|
|
||||||
variant("svg", default=False, description="Enable cairo's SVG functions feature")
|
|
||||||
variant("pic", default=True, description="Enable position-independent code (PIC)")
|
variant("pic", default=True, description="Enable position-independent code (PIC)")
|
||||||
variant("pdf", default=False, description="Enable cairo's PDF surface backend feature")
|
|
||||||
variant("ft", default=False, description="Enable cairo's FreeType font backend feature")
|
|
||||||
variant("fc", default=False, description="Enable cairo's Fontconfig font backend feature")
|
|
||||||
|
|
||||||
# seems to be an older cairo limitation as cairo@1.18.2 seems to build fine against libpng
|
# seems to be an older cairo limitation as cairo@1.18.2 seems to build fine against libpng
|
||||||
conflicts("+png", when="platform=darwin")
|
conflicts("+png", when="platform=darwin")
|
||||||
@@ -74,71 +78,23 @@ class Cairo(AutotoolsPackage, MesonPackage):
|
|||||||
# https://gitlab.freedesktop.org/cairo/cairo/-/blob/1.18.2/meson_options.txt
|
# https://gitlab.freedesktop.org/cairo/cairo/-/blob/1.18.2/meson_options.txt
|
||||||
with when("build_system=meson"):
|
with when("build_system=meson"):
|
||||||
variant("dwrite", default=False, description="Microsoft Windows DWrite font backend")
|
variant("dwrite", default=False, description="Microsoft Windows DWrite font backend")
|
||||||
|
|
||||||
# doesn't exist @1.17.8: but kept as compatibility
|
|
||||||
variant(
|
|
||||||
"pdf",
|
|
||||||
default=False,
|
|
||||||
description="""+pdf is combined into +zlib now, kept seperate for compatibility.
|
|
||||||
+pdf implies +zlib now. Please use the updated variants""",
|
|
||||||
)
|
|
||||||
# svg is combined into png now, kept seperate for compatibility
|
|
||||||
variant(
|
|
||||||
"svg",
|
|
||||||
default=False,
|
|
||||||
description="""+svg is combined into +png now, kept seperate for compatibility.
|
|
||||||
+svg implies +png now. Please use the updated variants""",
|
|
||||||
)
|
|
||||||
|
|
||||||
# meson seems to have assumptions about what is enabled/disabled
|
|
||||||
# these four compile best if +variant in unison, otherwise various errors happen
|
|
||||||
# if these aren't in sync. It is easier to have a sane default. conflicts below
|
|
||||||
# to try to protect known incompatibilities
|
|
||||||
variant("png", default=True, description="Enable cairo's PNG and SVG functions feature")
|
|
||||||
variant("ft", default=True, description="Enable cairo's FreeType font backend feature")
|
|
||||||
variant("fc", default=True, description="Enable cairo's Fontconfig font backend feature")
|
|
||||||
variant(
|
variant(
|
||||||
"zlib",
|
"zlib",
|
||||||
default=True,
|
default=False,
|
||||||
description="Enable cairo's script, ps, pdf, xml functions feature",
|
description="Enable cairo's script, ps, pdf, xml functions feature",
|
||||||
)
|
)
|
||||||
|
|
||||||
variant("quartz", default=False, description="Enable cairo's Quartz functions feature")
|
variant("quartz", default=False, description="Enable cairo's Quartz functions feature")
|
||||||
variant("tee", default=False, description="Enable cairo's tee functions feature")
|
variant("tee", default=False, description="Enable cairo's tee functions feature")
|
||||||
|
|
||||||
# not in spack
|
|
||||||
variant(
|
|
||||||
"spectre",
|
|
||||||
default=False,
|
|
||||||
description="Not available. Enable cairo's spectre functions feature",
|
|
||||||
)
|
|
||||||
|
|
||||||
# (bfd might be too old) with binutils 2.43.1 on macos
|
|
||||||
# so not sure how this is supposed to work
|
|
||||||
variant(
|
|
||||||
"symbol-lookup",
|
|
||||||
default=False,
|
|
||||||
description="Not available. Enable cairo's symbol lookup functions feature",
|
|
||||||
)
|
|
||||||
|
|
||||||
# not currently supported variants
|
|
||||||
conflicts("+spectre", msg="Not currently supported")
|
|
||||||
conflicts("+symbol-lookup", msg="Not currently supported")
|
|
||||||
|
|
||||||
# meson seems to have assumptions about what is enabled/disabled
|
# meson seems to have assumptions about what is enabled/disabled
|
||||||
# so this protects against incompatible combinations
|
# so this protects against incompatible combinations
|
||||||
conflicts("~zlib+png", msg="+png requires +zlib")
|
requires(
|
||||||
conflicts("~ft+fc", msg="+fc requires +ft")
|
"~zlib~ft~fc~png~pdf",
|
||||||
conflicts("+ft~fc", msg="+ft requires +fc")
|
"+zlib+ft+fc+png+pdf",
|
||||||
conflicts("+ft+fc~zlib", msg="+fc+ft requires +zlib")
|
policy="one_of",
|
||||||
conflicts("+fc+ft~png+zlib", msg="+ft+fc+zlib requires +png")
|
msg="these variants must be activated, or deactivated, together",
|
||||||
|
)
|
||||||
# +pdf implies zlib now
|
|
||||||
requires("+zlib", when="+pdf")
|
|
||||||
requires("~zlib", when="~pdf", msg="+pdf implies +zlib now")
|
|
||||||
# +svg implies png now
|
|
||||||
requires("+svg", when="+png")
|
|
||||||
requires("~png", when="~svg", msg="+svg implies +png now")
|
|
||||||
|
|
||||||
# https://gitlab.freedesktop.org/cairo/cairo/-/blob/1.18.2/meson.build?ref_type=tags#L2
|
# https://gitlab.freedesktop.org/cairo/cairo/-/blob/1.18.2/meson.build?ref_type=tags#L2
|
||||||
depends_on("meson@1.3.0:", type="build")
|
depends_on("meson@1.3.0:", type="build")
|
||||||
@@ -146,19 +102,16 @@ class Cairo(AutotoolsPackage, MesonPackage):
|
|||||||
# both autotools and meson need this for auto discovery of depends
|
# both autotools and meson need this for auto discovery of depends
|
||||||
depends_on("pkgconfig", type="build")
|
depends_on("pkgconfig", type="build")
|
||||||
|
|
||||||
# non build system specific depends
|
# non build system specific dependencies
|
||||||
# versions that use (the old) autotools build
|
depends_on("freetype", when="+ft")
|
||||||
with when("@:1.17.4"):
|
depends_on("libpng", when="+png")
|
||||||
depends_on("pixman@0.36.0:", when="@1.17.2:")
|
depends_on("glib")
|
||||||
depends_on("freetype", when="+ft")
|
depends_on("pixman@0.36.0:", when="@1.17.2:")
|
||||||
depends_on("fontconfig@2.10.91:", when="+fc")
|
depends_on("fontconfig@2.10.91:", when="+fc")
|
||||||
depends_on("libpng", when="+png")
|
|
||||||
depends_on("glib")
|
|
||||||
|
|
||||||
# non build system specific depends
|
# non build system specific depends
|
||||||
# versions that use (the new) meson build
|
# versions that use (the new) meson build
|
||||||
with when("@1.18.0:"):
|
with when("@1.18.0:"):
|
||||||
depends_on("binutils", when="+symbol-lookup")
|
|
||||||
depends_on("freetype@2.13.0:", when="+ft")
|
depends_on("freetype@2.13.0:", when="+ft")
|
||||||
depends_on("libpng@1.4.0:", when="+png")
|
depends_on("libpng@1.4.0:", when="+png")
|
||||||
depends_on("glib@2.14:", when="+gobject")
|
depends_on("glib@2.14:", when="+gobject")
|
||||||
@@ -200,27 +153,21 @@ def enable_or_disable(self, feature_name, variant=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def meson_args(self):
|
def meson_args(self):
|
||||||
args = []
|
args = [
|
||||||
|
self.enable_or_disable("dwrite"),
|
||||||
args.append(self.enable_or_disable("dwrite"))
|
self.enable_or_disable("fontconfig", variant="ft"),
|
||||||
args.append(self.enable_or_disable("fontconfig", variant="ft"))
|
self.enable_or_disable("freetype", variant="fc"),
|
||||||
args.append(self.enable_or_disable("freetype", variant="fc"))
|
self.enable_or_disable("png"),
|
||||||
|
self.enable_or_disable("quartz"),
|
||||||
args.append(self.enable_or_disable("png"))
|
self.enable_or_disable("tee"),
|
||||||
|
self.enable_or_disable("xcb"),
|
||||||
args.append(self.enable_or_disable("quartz"))
|
self.enable_or_disable("xlib", variant="X"),
|
||||||
args.append(self.enable_or_disable("tee"))
|
self.enable_or_disable("xlib-xcb", variant="X"),
|
||||||
args.append(self.enable_or_disable("xcb"))
|
self.enable_or_disable("zlib"),
|
||||||
|
self.enable_or_disable("glib", variant="gobject"),
|
||||||
args.append(self.enable_or_disable("xlib", variant="X"))
|
"-Dspectre=disabled",
|
||||||
args.append(self.enable_or_disable("xlib-xcb", variant="X"))
|
"-Dsymbol-lookup=disabled",
|
||||||
|
]
|
||||||
args.append(self.enable_or_disable("zlib"))
|
|
||||||
|
|
||||||
args.append(self.enable_or_disable("glib", variant="gobject"))
|
|
||||||
args.append(self.enable_or_disable("spectre"))
|
|
||||||
args.append(self.enable_or_disable("symbol-lookup"))
|
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user