Skip to content

Instantly share code, notes, and snippets.

@lucyllewy
Created May 3, 2017 01:15
Show Gist options
  • Save lucyllewy/73de99f91f3fd88907f8a30436bf2af4 to your computer and use it in GitHub Desktop.
Save lucyllewy/73de99f91f3fd88907f8a30436bf2af4 to your computer and use it in GitHub Desktop.
Example of failing snapcraft build of fontconfig and freetype
name: fontconfig-fail
version: '0.1'
summary: Example failure of freetype and fontconfig
description: |
An example showing that compiling freetype and fontconfig will fail when
the compile tries to build fontconfig.
grade: devel
confinement: devmode
parts:
freetype:
source: https://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz
plugin: autotools
configflags: ['--prefix=/usr', '--with-harfbuzz=no']
build-packages: [libbz2-dev, libexpat1-dev, libpng12-dev, pkg-config, zlib1g]
stage-packages: [libbz2-1.0, libexpat1, libpng12-0, zlib1g]
fontconfig:
source: https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.1.tar.bz2
plugin: autotools
configflags: ['--prefix=/usr']
build-packages: [pkg-config]
after: [freetype]
@goulart81
Copy link

Hi Daniel, do you know if freetype use with snap has been fixed now ?

@lucyllewy
Copy link
Author

lucyllewy commented Jul 14, 2020

This is a very old gist. It was posted in a request on the forum, but didn't receive any replies. This particular gist still fails as-is, but it is fixable by rewriting the pkgconfig .pc file in the freetype build-step:

parts:
    freetype:
        ...
        override-build: |
            snapcraftctl build
            sed -i "s|=/usr|=$SNAPCRAFT_STAGE/usr|g" $SNAPCRAFT_PART_INSTALL/usr/lib/pkgconfig/freetype2.pc

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