# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python import os from cerbero.tools.libtool import LibtoolLibrary from cerbero.tools.libtool import get_libtool_versions class Recipe(recipe.Recipe): name = 'fontconfig' version = '2.13.93' stype = SourceType.TARBALL url = 'https://www.freedesktop.org/software/fontconfig/release/fontconfig-%(version)s.tar.gz' tarball_checksum = '0f302a18ee52dde0793fe38b266bf269dfe6e0c0ae140e30d72c6cca5dc08db5' licenses = [{License.MIT: ['COPYING']}] btype = BuildType.MESON meson_options = {'doc': 'disabled', 'tests': 'disabled', 'tools': 'disabled'} deps = ['expat', 'freetype', 'zlib', 'bzip2'] patches = [ # From git master post-2.13.93 'fontconfig/0001-meson-error-out-in-script-if-gperf-preprocessing-fai.patch', # https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/138/ 'fontconfig/0001-handle-absolute-sysconfdir-when-installing-symlinks.patch', # https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/165 'fontconfig/0001-meson-fix-cross-compilation-issues-with-gperf-header.patch', # From git master post-2.13.93 'fontconfig/0001-Windows-Fix-symlink-privilege-error-detection.patch', 'fontconfig/0001-Overwrite-symlinks-for-config-files.patch', # Proper fix is pending, upstream issue is: # https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/247 'fontconfig/0001-fcobjs-Remove-duplicate-function-prototypes.patch', ] files_libs = ['libfontconfig'] files_etc = [ 'etc/fonts/conf.d', 'etc/fonts/fonts.conf', 'share/fontconfig' ] files_devel = ['lib/pkgconfig/fontconfig.pc', 'include/fontconfig'] def prepare(self): if self.config.target_platform in (Platform.WINDOWS, Platform.ANDROID): self.deps.append('libiconv') def post_install(self): # Meson does not generate la files major, minor, micro = get_libtool_versions(self.version) libtool_la = LibtoolLibrary('fontconfig', major, minor, micro, self.config.libdir, self.config.target_platform, deps=['expat', 'freetype', 'bz2', 'z']) libtool_la.save() # Create relative symlinks to prevent breakage during packaging if self.config.platform != Platform.WINDOWS: confddir = os.path.join(self.config.prefix, 'etc', 'fonts', 'conf.d') linksrc = os.path.join('..', '..', '..', 'share', 'fontconfig', 'conf.avail') for f in os.listdir(confddir): if not f.endswith('.conf'): continue os.remove(os.path.join(confddir, f)) os.symlink(os.path.join(linksrc, f), os.path.join(confddir, f)) super().post_install()