Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cairo: 'new' version 1.18.0 (now also MesonPackage) #43586

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

wdconinc
Copy link
Contributor

@wdconinc wdconinc commented Apr 11, 2024

This PR 'adds' cairo version 1.18.0. This is in quotes since the version was there already; it just wasn't buildable. With version 1.18.0 (actually 1.17.6) the build system was switched to meson and no more autotools stuff is inside cairo for 1.18.0. Because 1.16.0 was set as preferred, this was likely not noticed.

Not all options can be trivially translated from autotools to meson. Several are counter-intuitive (like +pdf is achieved by ensuring that zlib is installed... and +svg and +png are identical now... and +svg leads to a circular dependency anyway). Main changes:

  • --disable-trace doesn't have an equivalent,
  • freetype LDFLAGS and LIBS is not appended as it was for configure_args.

This builds with meson now, and with identical features in include/cairo/cairo-features.h, from 1.17.4 to 1.18.0 with +X+fc+ft+gobject+pdf+png~svg.

Copy link

spackbot-app bot commented Apr 11, 2024

Hi @wdconinc! I noticed that the following package(s) don't yet have maintainers:

  • cairo

Are you interested in adopting any of these package(s)? If so, simply add the following to the package class:

    maintainers("wdconinc")

If not, could you contact the developers of this package and see if they are interested? You can quickly see who has worked on a package with spack blame:

$ spack blame cairo

Thank you for your help! Please don't add maintainers without their consent.

You don't have to be a Spack expert or package developer in order to be a "maintainer," it just gives us a list of users willing to review PRs or debug issues relating to this package. A package can have multiple maintainers; just add a list of GitHub handles of anyone who wants to volunteer.

@wdconinc
Copy link
Contributor Author

@spackbot fix style

Copy link

spackbot-app bot commented Apr 11, 2024

Let me see if I can fix that for you!

Copy link

spackbot-app bot commented Apr 11, 2024

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: isort, black, flake8, mypy
==> Modified files
  var/spack/repos/builtin/packages/cairo/package.py
==> Running isort checks
  isort checks were clean
==> Running black checks
reformatted var/spack/repos/builtin/packages/cairo/package.py
All done! ✨ 🍰 ✨
1 file reformatted.
  black checks were clean
==> Running flake8 checks
  flake8 checks were clean
==> Running mypy checks
lib/spack/spack/version/version_types.py:145: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]"  [arg-type]
lib/spack/spack/version/version_types.py:447: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]"  [arg-type]
lib/spack/spack/version/version_types.py:476: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]"  [arg-type]
Found 3 errors in 1 file (checked 618 source files)
  mypy found errors
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

@wdconinc wdconinc marked this pull request as ready for review April 11, 2024 01:51
@wdconinc

This comment was marked as resolved.

@wdconinc
Copy link
Contributor Author

data-vis-sdk restricts freetype to 2.6.1 somehow, so that restricts cairo to 1.17.6 (which uses the new meson functionality). But all this passes gitlab-ci now.

@wdconinc
Copy link
Contributor Author

@AlexanderRichert-NOAA Do you want to review in the context of #40302 ?

@AlexanderRichert-NOAA
Copy link
Contributor

Yes, thanks-- I'll test it out with @1.18.0 +ft ^freetype~shared

@AlexanderRichert-NOAA
Copy link
Contributor

Installing 1.18.0 fails with freetype~shared, let me see if I can suggest a fix...

@AlexanderRichert-NOAA
Copy link
Contributor

I can get it to build with the following placed in the MesonBuilder block (alongside meson_args(); using flag_handler() would be ideal but I don't have time at the moment to make that work for me):

    def setup_build_environment(self, env):
        pkgconf = which("pkg-config")
        env.append_flags("CFLAGS", pkgconf("--libs", "--static", "freetype2", output=str))

Note the CFLAGS setting, unlike in the autotools build. Without it, or if I try to use LDFLAGS and LIBS as before, then I get a failure in the src/libcairo.so.2.11800.0 build step:

  >> 335    FAILED: src/libcairo.so.2.11800.0
     336    /dev/shm/spack-cairo/lib/spack/env/gcc/gcc  -o src/libcairo.so.2.11800.0 src/libcairo.so.2.11800.0.p/cairo-analysis-surface.c.o src/libcairo.so.2.11800.0.p/cairo-arc.c.o src/libcairo.so.2.11800.0.p/cairo-array.c.o src/libcair
            o.so.2.11800.0.p/cairo-atomic.c.o src/libcairo.so.2.11800.0.p/cairo-base64-stream.c.o src/libcairo.so.2.11800.0.p/cairo-base85-stream.c.o src/libcairo.so.2.11800.0.p/cairo-bentley-ottmann-rectangular.c.o src/libcairo.so.2.118
            00.0.p/cairo-bentley-ottmann-rectilinear.c.o src/libcairo.so.2.11800.0.p/cairo-bentley-ottmann.c.o src/libcairo.so.2.11800.0.p/cairo-botor-scan-converter.c.o src/libcairo.so.2.11800.0.p/cairo-boxes-intersect.c.o src/libcairo.
            so.2.11800.0.p/cairo-boxes.c.o src/libcairo.so.2.11800.0.p/cairo-cache.c.o src/libcairo.so.2.11800.0.p/cairo-clip-boxes.c.o src/libcairo.so.2.11800.0.p/cairo-clip-polygon.c.o src/libcairo.so.2.11800.0.p/cairo-clip-region.c.o 
            src/libcairo.so.2.11800.0.p/cairo-clip-surface.c.o src/libcairo.so.2.11800.0.p/cairo-clip-tor-scan-converter.c.o src/libcairo.so.2.11800.0.p/cairo-clip.c.o src/libcairo.so.2.11800.0.p/cairo-color.c.o src/libcairo.so.2.11800.0
            .p/cairo-composite-rectangles.c.o src/libcairo.so.2.11800.0.p/cairo-compositor.c.o src/libcairo.so.2.11800.0.p/cairo-contour.c.o src/libcairo.so.2.11800.0.p/cairo-damage.c.o src/libcairo.so.2.11800.0.p/cairo-debug.c.o src/lib
            cairo.so.2.11800.0.p/cairo-default-context.c.o src/libcairo.so.2.11800.0.p/cairo-device.c.o src/libcairo.so.2.11800.0.p/cairo-error.c.o src/libcairo.so.2.11800.0.p/cairo-fallback-compositor.c.o src/libcairo.so.2.11800.0.p/cai
            ro-fixed.c.o src/libcairo.so.2.11800.0.p/cairo-font-face-twin-data.c.o src/libcairo.so.2.11800.0.p/cairo-font-face-twin.c.o src/libcairo.so.2.11800.0.p/cairo-font-face.c.o src/libcairo.so.2.11800.0.p/cairo-font-options.c.o sr
            c/libcairo.so.2.11800.0.p/cairo-freed-pool.c.o src/libcairo.so.2.11800.0.p/cairo-freelist.c.o src/libcairo.so.2.11800.0.p/cairo-gstate.c.o src/libcairo.so.2.11800.0.p/cairo-hash.c.o src/libcairo.so.2.11800.0.p/cairo-hull.c.o 
            src/libcairo.so.2.11800.0.p/cairo-image-compositor.c.o src/libcairo.so.2.11800.0.p/cairo-image-info.c.o src/libcairo.so.2.11800.0.p/cairo-image-source.c.o src/libcairo.so.2.11800.0.p/cairo-image-surface.c.o src/libcairo.so.2.
            11800.0.p/cairo-line.c.o src/libcairo.so.2.11800.0.p/cairo-lzw.c.o src/libcairo.so.2.11800.0.p/cairo-mask-compositor.c.o src/libcairo.so.2.11800.0.p/cairo-matrix.c.o src/libcairo.so.2.11800.0.p/cairo-mempool.c.o src/libcairo.
            so.2.11800.0.p/cairo-mesh-pattern-rasterizer.c.o src/libcairo.so.2.11800.0.p/cairo-misc.c.o src/libcairo.so.2.11800.0.p/cairo-mono-scan-converter.c.o src/libcairo.so.2.11800.0.p/cairo-mutex.c.o src/libcairo.so.2.11800.0.p/cai
            ro-no-compositor.c.o src/libcairo.so.2.11800.0.p/cairo-observer.c.o src/libcairo.so.2.11800.0.p/cairo-output-stream.c.o src/libcairo.so.2.11800.0.p/cairo-paginated-surface.c.o src/libcairo.so.2.11800.0.p/cairo-path-bounds.c.o
             src/libcairo.so.2.11800.0.p/cairo-path-fill.c.o src/libcairo.so.2.11800.0.p/cairo-path-fixed.c.o src/libcairo.so.2.11800.0.p/cairo-path-in-fill.c.o src/libcairo.so.2.11800.0.p/cairo-path-stroke-boxes.c.o src/libcairo.so.2.11
            800.0.p/cairo-path-stroke-polygon.c.o src/libcairo.so.2.11800.0.p/cairo-path-stroke-traps.c.o src/libcairo.so.2.11800.0.p/cairo-path-stroke-tristrip.c.o src/libcairo.so.2.11800.0.p/cairo-path-stroke.c.o src/libcairo.so.2.1180
            0.0.p/cairo-path.c.o src/libcairo.so.2.11800.0.p/cairo-pattern.c.o src/libcairo.so.2.11800.0.p/cairo-pen.c.o src/libcairo.so.2.11800.0.p/cairo-polygon-intersect.c.o src/libcairo.so.2.11800.0.p/cairo-polygon-reduce.c.o src/lib
            cairo.so.2.11800.0.p/cairo-polygon.c.o src/libcairo.so.2.11800.0.p/cairo-raster-source-pattern.c.o src/libcairo.so.2.11800.0.p/cairo-recording-surface.c.o src/libcairo.so.2.11800.0.p/cairo-rectangle.c.o src/libcairo.so.2.1180
            0.0.p/cairo-rectangular-scan-converter.c.o src/libcairo.so.2.11800.0.p/cairo-region.c.o src/libcairo.so.2.11800.0.p/cairo-rtree.c.o src/libcairo.so.2.11800.0.p/cairo-scaled-font.c.o src/libcairo.so.2.11800.0.p/cairo-shape-mas
            k-compositor.c.o src/libcairo.so.2.11800.0.p/cairo-slope.c.o src/libcairo.so.2.11800.0.p/cairo-spans-compositor.c.o src/libcairo.so.2.11800.0.p/cairo-spans.c.o src/libcairo.so.2.11800.0.p/cairo-spline.c.o src/libcairo.so.2.11
            800.0.p/cairo-stroke-dash.c.o src/libcairo.so.2.11800.0.p/cairo-stroke-style.c.o src/libcairo.so.2.11800.0.p/cairo-surface-clipper.c.o src/libcairo.so.2.11800.0.p/cairo-surface-fallback.c.o src/libcairo.so.2.11800.0.p/cairo-s
            urface-observer.c.o src/libcairo.so.2.11800.0.p/cairo-surface-offset.c.o src/libcairo.so.2.11800.0.p/cairo-surface-snapshot.c.o src/libcairo.so.2.11800.0.p/cairo-surface-subsurface.c.o src/libcairo.so.2.11800.0.p/cairo-surfac
            e-wrapper.c.o src/libcairo.so.2.11800.0.p/cairo-surface.c.o src/libcairo.so.2.11800.0.p/cairo-time.c.o src/libcairo.so.2.11800.0.p/cairo-tor-scan-converter.c.o src/libcairo.so.2.11800.0.p/cairo-tor22-scan-converter.c.o src/li
            bcairo.so.2.11800.0.p/cairo-toy-font-face.c.o src/libcairo.so.2.11800.0.p/cairo-traps-compositor.c.o src/libcairo.so.2.11800.0.p/cairo-traps.c.o src/libcairo.so.2.11800.0.p/cairo-tristrip.c.o src/libcairo.so.2.11800.0.p/cairo
            -unicode.c.o src/libcairo.so.2.11800.0.p/cairo-user-font.c.o src/libcairo.so.2.11800.0.p/cairo-version.c.o src/libcairo.so.2.11800.0.p/cairo-wideint.c.o src/libcairo.so.2.11800.0.p/cairo.c.o src/libcairo.so.2.11800.0.p/cairo-
            cff-subset.c.o src/libcairo.so.2.11800.0.p/cairo-scaled-font-subsets.c.o src/libcairo.so.2.11800.0.p/cairo-truetype-subset.c.o src/libcairo.so.2.11800.0.p/cairo-type1-fallback.c.o src/libcairo.so.2.11800.0.p/cairo-type1-glyph
            -names.c.o src/libcairo.so.2.11800.0.p/cairo-type1-subset.c.o src/libcairo.so.2.11800.0.p/cairo-type3-glyph-surface.c.o src/libcairo.so.2.11800.0.p/cairo-pdf-operators.c.o src/libcairo.so.2.11800.0.p/cairo-pdf-shading.c.o src
            /libcairo.so.2.11800.0.p/cairo-tag-attributes.c.o src/libcairo.so.2.11800.0.p/cairo-tag-stack.c.o src/libcairo.so.2.11800.0.p/cairo-deflate-stream.c.o src/libcairo.so.2.11800.0.p/cairo-ft-font.c.o src/libcairo.so.2.11800.0.p/
            cairo-colr-glyph-render.c.o src/libcairo.so.2.11800.0.p/cairo-svg-glyph-render.c.o src/libcairo.so.2.11800.0.p/cairo-tee-surface.c.o -L/dev/shm/spack-cairo/opt/spack/linux-centos8-zen/gcc-8.5.0/freetype-2.11.1-vszlkmontwo555n
            ghku7gh7uxqtsiywa/lib -L/dev/shm/spack-cairo/opt/spack/linux-centos8-zen/gcc-8.5.0/libpng-1.6.39-sdmeepbakzkts7a6bqptdcxialiraozs/lib64 -L/dev/shm/spack-cairo/opt/spack/linux-centos8-zen/gcc-8.5.0/zlib-ng-2.1.6-2oco2rjg356vcd
            kakpa6p7cyd6uxaay2/lib -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libcairo.so.2 -Wl,-rpath,/dev/shm/spack-cairo/opt/spack/linux-centos8-zen/gcc-8.5.0/pixman-0.42.2-rvhk47f4b3j7k2k2h
            kw75gwpreaqrphu/lib -Wl,-rpath-link,/dev/shm/spack-cairo/opt/spack/linux-centos8-zen/gcc-8.5.0/pixman-0.42.2-rvhk47f4b3j7k2k2hkw75gwpreaqrphu/lib -Wl,-Bsymbolic-functions -lpthread -lm -ldl /dev/shm/spack-cairo/opt/spack/linu
            x-centos8-zen/gcc-8.5.0/freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/lib/libfreetype.a /dev/shm/spack-cairo/opt/spack/linux-centos8-zen/gcc-8.5.0/pixman-0.42.2-rvhk47f4b3j7k2k2hkw75gwpreaqrphu/lib/libpixman-1.so -Wl,--end
            -group
     337    /dev/shm/spack-cairo/opt/spack/linux-centos8-zen/gcc-8.5.0/freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/lib/libfreetype.a(sfnt.o): In function `Load_SBit_Png':
  >> 338    /tmp/ajwr/spack-stage/spack-stage-freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/spack-src/src/sfnt/pngshim.c:298: undefined reference to `png_create_read_struct'
  >> 339    /tmp/ajwr/spack-stage/spack-stage-freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/spack-src/src/sfnt/pngshim.c:308: undefined reference to `png_create_info_struct'
  >> 340    /tmp/ajwr/spack-stage/spack-stage-freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/spack-src/src/sfnt/pngshim.c:316: undefined reference to `png_set_longjmp_fn'
  >> 341    /tmp/ajwr/spack-stage/spack-stage-freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/spack-src/src/sfnt/pngshim.c:322: undefined reference to `png_set_read_fn'
  >> 342    /tmp/ajwr/spack-stage/spack-stage-freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/spack-src/src/sfnt/pngshim.c:324: undefined reference to `png_read_info'
  >> 343    /tmp/ajwr/spack-stage/spack-stage-freetype-2.11.1-vszlkmontwo555nghku7gh7uxqtsiywa/spack-src/src/sfnt/pngshim.c:325: undefined reference to `png_get_IHDR'
...

@aumuell
Copy link
Contributor

aumuell commented Apr 11, 2024

data-vis-sdk restricts freetype to 2.6.1 somehow,

This is most likely due to a recently added test dependency in py-matplotlib: #43597


def autoreconf(self, spec, prefix):
class MesonBuilder(spack.build_systems.meson.MesonBuilder):
def meson_args(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def meson_args(self):
def setup_build_environment(self, env):
if self.spec.satisfies("+ft ^freetype~shared"):
pkgconf = which("pkg-config")
env.append_flags("CFLAGS", pkgconf("--libs", "--static", "freetype2", output=str))
def meson_args(self):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or

Suggested change
def meson_args(self):
@when("+ft ^freetype~shared")
def setup_build_environment(self, env):
pkgconf = which("pkg-config")
env.append_flags("CFLAGS", pkgconf("--libs", "--static", "freetype2", output=str))
def meson_args(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either approach is fine with me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sorry for the delay on this. I started testing with freetype ~shared and now I'm not able to build fontconfig without those changes either. I'm not sure adding all these extra cflags to packages downstream from freetype is the right thing to do. It seems something is missing in freetype's pc files: they should get picked up by spack, and the ldflags should include the -lpng library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants