2024-01-02 16:21:30 +08:00
|
|
|
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
|
2018-10-08 04:52:23 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2016-05-12 12:22:25 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
2022-05-29 00:55:44 +08:00
|
|
|
from spack.package import *
|
2014-12-26 08:09:42 +08:00
|
|
|
|
2016-06-21 11:21:10 +08:00
|
|
|
|
2016-11-05 03:12:37 +08:00
|
|
|
class Cairo(AutotoolsPackage):
|
2016-06-21 11:21:10 +08:00
|
|
|
"""Cairo is a 2D graphics library with support for multiple output
|
|
|
|
devices."""
|
2018-12-15 00:46:52 +08:00
|
|
|
|
2018-12-18 23:39:36 +08:00
|
|
|
homepage = "https://www.cairographics.org/"
|
|
|
|
url = "https://www.cairographics.org/releases/cairo-1.16.0.tar.xz"
|
2014-12-26 08:09:42 +08:00
|
|
|
|
2024-01-02 12:53:24 +08:00
|
|
|
license("LGPL-2.1-or-later OR MPL-1.1", checked_by="tgamblin")
|
2023-12-23 03:29:11 +08:00
|
|
|
|
2024-03-13 04:34:17 +08:00
|
|
|
version("1.18.0", sha256="243a0736b978a33dee29f9cca7521733b78a65b5418206fef7bd1c3d4cf10b64")
|
2021-09-26 16:25:26 +08:00
|
|
|
version(
|
|
|
|
"1.17.4",
|
|
|
|
sha256="74b24c1ed436bbe87499179a3b27c43f4143b8676d8ad237a6fa787401959705",
|
|
|
|
url="https://cairographics.org/snapshots/cairo-1.17.4.tar.xz",
|
|
|
|
) # Snapshot
|
2020-02-18 07:41:08 +08:00
|
|
|
version(
|
|
|
|
"1.17.2",
|
|
|
|
sha256="6b70d4655e2a47a22b101c666f4b29ba746eda4aa8a0f7255b32b2e9408801df",
|
|
|
|
url="https://cairographics.org/snapshots/cairo-1.17.2.tar.xz",
|
|
|
|
) # Snapshot
|
|
|
|
version(
|
|
|
|
"1.16.0",
|
|
|
|
sha256="5e7b29b3f113ef870d1e3ecf8adf21f923396401604bda16d44be45e66052331",
|
|
|
|
preferred=True,
|
|
|
|
)
|
2019-10-11 13:44:41 +08:00
|
|
|
version("1.14.12", sha256="8c90f00c500b2299c0a323dd9beead2a00353752b2092ead558139bd67f7bf16")
|
|
|
|
version("1.14.8", sha256="d1f2d98ae9a4111564f6de4e013d639cf77155baf2556582295a0f00a9bc5e20")
|
|
|
|
version("1.14.0", sha256="2cf5f81432e77ea4359af9dcd0f4faf37d015934501391c311bfd2d19a0134b7")
|
2014-12-26 08:09:42 +08:00
|
|
|
|
2016-12-17 02:49:02 +08:00
|
|
|
variant("X", default=False, description="Build with X11 support")
|
2018-12-18 23:39:36 +08:00
|
|
|
variant("pdf", default=False, description="Enable cairo's PDF surface backend feature")
|
2019-08-27 16:29:50 +08:00
|
|
|
variant("gobject", default=False, description="Enable cairo's gobject functions feature")
|
2019-12-11 01:58:37 +08:00
|
|
|
variant("ft", default=False, description="Enable cairo's FreeType font backend feature")
|
|
|
|
variant("fc", default=False, description="Enable cairo's Fontconfig font backend feature")
|
|
|
|
variant("png", default=False, description="Enable cairo's PNG functions feature")
|
|
|
|
variant("svg", default=False, description="Enable cairo's SVN functions feature")
|
2023-10-14 04:21:43 +08:00
|
|
|
variant("shared", default=True, description="Build shared libraries")
|
|
|
|
variant("pic", default=True, description="Enable position-independent code (PIC)")
|
2016-12-01 05:49:49 +08:00
|
|
|
|
|
|
|
depends_on("libx11", when="+X")
|
|
|
|
depends_on("libxext", when="+X")
|
|
|
|
depends_on("libxrender", when="+X")
|
|
|
|
depends_on("libxcb", when="+X")
|
Adjustments to get gtkplus to build (#3208)
* Hackery to get gtkplus to build
PR #3077 broke gtkplus by introducing gobject-introspection.
This big hack makes things work. It has problems.
1. Rather than deal with the nasty sbang fooey in the
g-ir-tool-template.in derived scripts, it just adds a python
dependency to each package that runs one of the scripts. This lets
the `/usr/bin/env python` sbang do the right thing.
2. It stuffs a several directories on to the XDG_DATA_DIRS environment
variable, which is used for (among other things) locating the .gir
files.
3. It avoids building the gtkplus demos because I can't make the bit
that calls `gdk-pixbuf-csource` work. It doesn't think that it can
load `.png` files and all of the google hits I found suggest a bad
`loader.cache` file. The file's fine and I can strace the command
and watch it read it in... Many, many hours wasted here.
In spite of the demo failing, the tests pass and an emacs built
with this lib seems to work.
* Fix sbang so everyone needn't depend_on python
Rather than have every package that
`depends_on('gobject-introspection')` also need to
`depend_on('python')`, this commit fixes the
scripts (e.g. `g-ir-scanner`).
The interesting bit is in the gobject-introspection package. There is
a beefy comment there that is included below.
The commit also removes the now un-necessary dependencies from various
packages.
I have two reservations about this commit:
1. How portable is the "insertion" sed command? I'm particularly
worried that some sed's might need the line to insert to be on a
different line, which I can't imagine how to cram into the
Makefile.in.
The solution I see to this is rather than extending the existing
sed command in the Makefile I could shim in another line in the
rule and e.g. call a bit of Perl (or Python, I suppose) which would
end up being much neater.
2. As written it always uses Spack's `.../bin/sbang`, which might or
might not be a good idea.
If I use "the solution" from number 1 above, then I can check the
line length before I munge it. Otherwise???
---
This package creates several scripts from |
toosl/g-ir-tool-template.in. In their original form these |
scripts end up with a sbang line like |
|
`#!/usr/bin/env /path/to/spack/python`. |
|
These scripts are generated and then used as part of the build |
(other packages also use the scripts after they've been |
installed). |
|
The path to the spack python can become too long. Because these |
tools are used as part of the build, the normal hook that fixes |
this problem can't help us. |
This package fixes the problem in two steps: |
- it rewrites the g-ir-tool-template so that its sbang line |
refers directly to spack's python (filter_file step below); and |
- it patches the Makefile.in so that the generated Makefile has an |
extra sed expression in its TOOL_SUBSTITUTION that results in |
an `#!/bin/bash /path/to/spack/bin/sbang` unconditionally being |
inserted into the scripts as they're generated. |
* Cairo needs python when it's +X
Cairo needs to depend_on python when it's +X. I think it's an
indirect requirement that's coming in via libxcb).
* Flake8 cleanup
* Make cairo's dep on python be type=build
This seems to be the right thing and seems to produce a result
that works (I can build gtk+ and then emacs+X on top of it).
2017-04-28 00:04:26 +08:00
|
|
|
depends_on("python", when="+X", type="build")
|
2019-12-11 01:58:37 +08:00
|
|
|
depends_on("libpng", when="+png")
|
|
|
|
depends_on("librsvg", when="+svg")
|
2018-12-18 23:39:36 +08:00
|
|
|
depends_on("glib")
|
2020-02-18 07:41:08 +08:00
|
|
|
depends_on("pixman@0.36.0:", when="@1.17.2:")
|
2018-12-18 23:39:36 +08:00
|
|
|
depends_on("pixman")
|
2019-12-27 06:20:16 +08:00
|
|
|
depends_on("automake", type="build")
|
|
|
|
depends_on("autoconf", type="build")
|
|
|
|
depends_on("libtool", type="build")
|
|
|
|
depends_on("m4", type="build")
|
2024-04-11 00:20:42 +08:00
|
|
|
depends_on("freetype build_system=autotools", when="+ft")
|
2018-12-18 23:39:36 +08:00
|
|
|
depends_on("pkgconfig", type="build")
|
2019-12-11 01:58:37 +08:00
|
|
|
depends_on("fontconfig@2.10.91:", when="+fc") # Require newer version of fontconfig.
|
2023-04-15 20:16:41 +08:00
|
|
|
depends_on("which", type="build")
|
2019-12-11 01:58:37 +08:00
|
|
|
|
|
|
|
conflicts("+png", when="platform=darwin")
|
|
|
|
conflicts("+svg", when="platform=darwin")
|
2023-10-14 04:21:43 +08:00
|
|
|
conflicts("+shared~pic")
|
2014-12-26 08:09:42 +08:00
|
|
|
|
2019-12-27 06:20:16 +08:00
|
|
|
# patch from https://gitlab.freedesktop.org/cairo/cairo/issues/346
|
2020-02-18 07:41:08 +08:00
|
|
|
patch("fontconfig.patch", when="@1.16.0:1.17.2")
|
2021-06-10 07:10:13 +08:00
|
|
|
# Don't regenerate docs to avoid a dependency on gtk-doc
|
|
|
|
patch("disable-gtk-docs.patch", when="^autoconf@2.70:")
|
2019-12-27 06:20:16 +08:00
|
|
|
|
|
|
|
def autoreconf(self, spec, prefix):
|
2021-06-10 07:10:13 +08:00
|
|
|
# Regenerate, directing the script *not* to call configure before Spack
|
|
|
|
# does
|
|
|
|
which("sh")("./autogen.sh", extra_env={"NOCONFIGURE": "1"})
|
2019-12-27 06:20:16 +08:00
|
|
|
|
2016-11-05 03:12:37 +08:00
|
|
|
def configure_args(self):
|
2018-12-18 23:39:36 +08:00
|
|
|
args = ["--disable-trace", "--enable-tee"] # can cause problems with libiberty
|
|
|
|
|
2017-05-24 05:43:22 +08:00
|
|
|
if "+X" in self.spec:
|
2018-12-18 23:39:36 +08:00
|
|
|
args.extend(["--enable-xlib", "--enable-xcb"])
|
2017-05-24 05:43:22 +08:00
|
|
|
else:
|
2018-12-18 23:39:36 +08:00
|
|
|
args.extend(["--disable-xlib", "--disable-xcb"])
|
|
|
|
|
|
|
|
args.extend(self.enable_or_disable("pdf"))
|
2019-08-27 16:29:50 +08:00
|
|
|
args.extend(self.enable_or_disable("gobject"))
|
2019-12-11 01:58:37 +08:00
|
|
|
args.extend(self.enable_or_disable("ft"))
|
|
|
|
args.extend(self.enable_or_disable("fc"))
|
2023-10-14 04:21:43 +08:00
|
|
|
args.extend(self.enable_or_disable("shared"))
|
|
|
|
args.extend(self.with_or_without("pic"))
|
|
|
|
|
|
|
|
if self.spec.satisfies("+ft ^freetype~shared"):
|
|
|
|
pkgconf = which("pkg-config")
|
|
|
|
ldflags = pkgconf("--libs-only-L", "--static", "freetype2", output=str)
|
|
|
|
libs = pkgconf("--libs-only-l", "--static", "freetype2", output=str)
|
|
|
|
args.append(f"LDFLAGS={ldflags}")
|
|
|
|
args.append(f"LIBS={libs}")
|
2018-12-18 23:39:36 +08:00
|
|
|
|
2016-11-05 03:12:37 +08:00
|
|
|
return args
|
2021-09-26 16:25:26 +08:00
|
|
|
|
|
|
|
def check(self):
|
|
|
|
"""The checks are only for the cairo devs: They write others shouldn't bother"""
|
|
|
|
pass
|