Commit 96d52e17 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

fontconfig: update to 2.13.93 and build with meson

Removed xcode8 sdk workaround for mkostemp, probably needs fixing
in meson.build if detection is incorrect with older min-*-version
targets (e.g. by passing the right header file prefix to cc.has_function).

Part-of: <!675>
parent 9300c3be
Pipeline #257618 passed with stages
in 86 minutes and 51 seconds
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import os
from cerbero.utils import needs_xcode8_sdk_workaround
from cerbero.tools.libtool import LibtoolLibrary
from cerbero.tools.libtool import get_libtool_versions
class Recipe(recipe.Recipe):
name = 'fontconfig'
version = '2.12.6'
version = '2.13.93'
stype = SourceType.TARBALL
url = 'https://www.freedesktop.org/software/fontconfig/release/fontconfig-%(version)s.tar.gz'
tarball_checksum = '064b9ebf060c9e77011733ac9dc0e2ce92870b574cca2405e11f5353a683c334'
tarball_checksum = '0f302a18ee52dde0793fe38b266bf269dfe6e0c0ae140e30d72c6cca5dc08db5'
licenses = [{License.MIT: ['COPYING']}]
configure_options = '--disable-docs'
btype = BuildType.MESON
meson_options = {'doc': 'disabled', 'tests': 'disabled', 'tools': 'disabled'}
deps = ['expat', 'freetype', 'zlib', 'bzip2']
patches = [
'fontconfig/0001-Fix-cross-compilation-by-passing-CPPFLAGS-to-CPP.patch',
# https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/88
'fontconfig/0002-fcatomic-Fix-EXC_BAD_ACCESS-on-iOS-ARM64.patch',
'fontconfig/0003-Completely-disable-building-of-tests.patch',
# 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'
]
files_libs = ['libfontconfig']
......@@ -30,19 +34,14 @@ class Recipe(recipe.Recipe):
def prepare(self):
if self.config.target_platform in (Platform.WINDOWS, Platform.ANDROID):
self.deps.append('libiconv')
if needs_xcode8_sdk_workaround(self.config):
self.set_env('ac_cv_func_mkostemp', 'no')
if self.config.target_platform == Platform.WINDOWS:
if self.config.target_arch == Architecture.X86_64:
self.configure_options += ' --with-arch=x86_64 '
else:
self.configure_options += ' --with-arch=i686 '
else:
self.autoreconf = True
self.patches += ['fontconfig/0003-configure-Allow-static-build.patch']
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')
......
From 3b3f1d502d5abdac5d96a9c5e70408891357572b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete@collabora.com>
Date: Thu, 1 Feb 2018 10:52:40 +0000
Subject: [PATCH 1/3] Fix cross-compilation by passing CPPFLAGS to CPP
---
src/Makefile.am | 2 +-
src/Makefile.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 726c435..f8c8bd8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -109,7 +109,7 @@ fcobjshash.gperf: Makefile stamp-fcobjshash.gperf
@$(MAKE) stamp-fcobjshash.gperf
@touch -r stamp-fcobjshash.gperf $@
stamp-fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
- $(AM_V_GEN) $(CPP) -I$(top_srcdir) $< | \
+ $(AM_V_GEN) $(CPP) -I$(top_srcdir) $(CPPFLAGS) $< | \
$(SED) 's/^ *//;s/ *, */,/' | \
$(GREP) '^[^#]' | \
awk ' \
diff --git a/src/Makefile.in b/src/Makefile.in
index 0dd5c74..90d3a7a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -902,7 +902,7 @@ fcobjshash.gperf: Makefile stamp-fcobjshash.gperf
@$(MAKE) stamp-fcobjshash.gperf
@touch -r stamp-fcobjshash.gperf $@
stamp-fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
- $(AM_V_GEN) $(CPP) -I$(top_srcdir) $< | \
+ $(AM_V_GEN) $(CPP) -I$(top_srcdir) $(CPPFLAGS) $< | \
$(SED) 's/^ *//;s/ *, */,/' | \
$(GREP) '^[^#]' | \
awk ' \
--
2.27.0.windows.1
From 4912e1b58e2297c13857ec08fccf77221f106cd6 Mon Sep 17 00:00:00 2001
From: Heiko Becker <heirecka@exherbo.org>
Date: Thu, 3 Dec 2020 21:04:26 +0100
Subject: [PATCH] Handle absolute sysconfdir when installing symlinks
sysconfdir defaults to /etc when the prefix is set to /usr. But joining
MESON_INSTALL_DESTDIR_PREFIX and sysconfdir when the latter is an
absoulte path, results in sysconfdir only. Which might lead to an error
during install because /etc/fonts/conf.d/ might already exist from an
pre-existing fontconfig installation.
---
conf.d/link_confs.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/conf.d/link_confs.py b/conf.d/link_confs.py
index 0c42efb5..bafaf3a8 100644
--- a/conf.d/link_confs.py
+++ b/conf.d/link_confs.py
@@ -11,7 +11,14 @@ if __name__=='__main__':
parser.add_argument('links', nargs='+')
args = parser.parse_args()
- confpath = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], args.confpath)
+ if os.path.isabs(args.confpath):
+ destdir = os.environ.get('DESTDIR')
+ if destdir:
+ confpath = os.path.join(destdir, args.confpath[1:])
+ else:
+ confpath = args.confpath
+ else:
+ confpath = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], args.confpath)
if not os.path.exists(confpath):
os.makedirs(confpath)
--
GitLab
From 5bfb9bcbea916ca6bd62fa459978a33e47d8ad3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Thu, 31 Dec 2020 15:04:10 +0000
Subject: [PATCH] meson: error out in script if gperf preprocessing failed
---
src/cutout.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cutout.py b/src/cutout.py
index 6fa55a3..96cafd2 100644
--- a/src/cutout.py
+++ b/src/cutout.py
@@ -12,7 +12,7 @@ if __name__== '__main__':
print (args[0].output)
cpp = args[1]
- ret = subprocess.run(cpp + [args[0].input], stdout=subprocess.PIPE)
+ ret = subprocess.run(cpp + [args[0].input], stdout=subprocess.PIPE, check=True)
stdout = ret.stdout.decode('utf8')
--
2.29.2
From 15dd8e71cd9b702ab3def1d2fe885fa0a8e6815d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Sun, 17 Jan 2021 12:51:59 +0000
Subject: [PATCH] meson: fix cross-compilation issues with gperf header file
preprocessing
Pass c_args to the compiler when preprocessing the gperf header file,
they might contain important bits without which compilation/preprocessing
might fail (e.g. with clang on Android). cc.cmd_array() does not include
the c_args and we can't easily look them up from the meson.build file, so
we have retrieve them ourselves from the introspection info.
---
src/cutout.py | 16 ++++++++++++++--
src/meson.build | 5 ++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/cutout.py b/src/cutout.py
index 96cafd2..323eec8 100644
--- a/src/cutout.py
+++ b/src/cutout.py
@@ -1,5 +1,6 @@
import argparse
import subprocess
+import json
import os
import re
@@ -7,12 +8,23 @@ if __name__== '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('input')
parser.add_argument('output')
+ parser.add_argument('buildroot')
args = parser.parse_known_args()
- print (args[0].output)
+
+ # c_args might contain things that are essential for crosscompilation, but
+ # are not included in cc.cmd_array(), so we have to look them up ourselves
+ host_cargs = []
+ buildroot = args[0].buildroot
+ with open(os.path.join(buildroot, 'meson-info', 'intro-buildoptions.json')) as json_file:
+ bopts = json.load(json_file)
+ for opt in bopts:
+ if opt['name'] == 'c_args' and opt['section'] == 'compiler' and opt['machine'] == 'host':
+ host_cargs = opt['value']
+ break
cpp = args[1]
- ret = subprocess.run(cpp + [args[0].input], stdout=subprocess.PIPE, check=True)
+ ret = subprocess.run(cpp + host_cargs + [args[0].input], stdout=subprocess.PIPE, check=True)
stdout = ret.stdout.decode('utf8')
diff --git a/src/meson.build b/src/meson.build
index f2a4861..7f9bf31 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -44,10 +44,13 @@ endif
cpp += ['-I', join_paths(meson.current_source_dir(), '..')]
+# Can use meson.project_build_dir() once we require Meson 0.56
+project_build_dir = meson.current_build_dir() / '..'
+
fcobjshash_gperf = custom_target('fcobjshash.gperf',
input: 'fcobjshash.gperf.h',
output: 'fcobjshash.gperf',
- command: [python3, files('cutout.py')[0], '@INPUT@', '@OUTPUT@', cpp],
+ command: [python3, files('cutout.py')[0], '@INPUT@', '@OUTPUT@', project_build_dir, cpp],
build_by_default: true,
)
--
2.29.2
From 5786bcc6be8441d579d26f830ebb35bda40deef6 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Sat, 22 Feb 2020 03:57:50 +0530
Subject: [PATCH 2/3] fcatomic: Fix EXC_BAD_ACCESS on iOS ARM64
iPhone 2.1 was released a long time ago, and the macro for checking
the target iOS SDK version has changed. We can simplify everything and
do a very basic check.
---
src/fcatomic.h | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/fcatomic.h b/src/fcatomic.h
index cc28a88..657a5f5 100644
--- a/src/fcatomic.h
+++ b/src/fcatomic.h
@@ -70,24 +70,16 @@ typedef LONG fc_atomic_int_t;
#elif !defined(FC_NO_MT) && defined(__APPLE__)
#include <libkern/OSAtomic.h>
-#ifdef __MAC_OS_X_MIN_REQUIRED
#include <AvailabilityMacros.h>
-#elif defined(__IPHONE_OS_MIN_REQUIRED)
-#include <Availability.h>
-#endif
typedef int fc_atomic_int_t;
#define fc_atomic_int_add(AI, V) (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
#define fc_atomic_ptr_get(P) (OSMemoryBarrier (), (void *) *(P))
-#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_VERSION_MIN_REQUIRED >= 20100)
+#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 20100)
#define fc_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
#else
-#if __ppc64__ || __x86_64__
-#define fc_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P))
-#else
-#define fc_atomic_ptr_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P))
-#endif
+#error "Your macOS / iOS targets are too old"
#endif
#elif !defined(FC_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
--
2.27.0.windows.1
From 8946f58450e04fa8ebc32b62e7479ed8f122408b Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Wed, 30 Sep 2020 13:07:43 +0530
Subject: [PATCH 3/3] Completely disable building of tests
This was originally for disabling on Windows, but to avoid autoreconf,
we disable it everywhere.
---
Makefile.am | 3 ++-
Makefile.in | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 2b4a5b8..3cdd66e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,8 @@
SUBDIRS=fontconfig fc-blanks fc-case fc-lang fc-glyphname src \
fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \
- fc-validate conf.d test
+ fc-validate conf.d
+
if ENABLE_DOCS
SUBDIRS += doc
endif
diff --git a/Makefile.in b/Makefile.in
index 3e3001b..67e46ef 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -436,7 +436,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = fontconfig fc-blanks fc-case fc-lang fc-glyphname src \
fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \
- fc-validate conf.d test $(am__append_1)
+ fc-validate conf.d $(am__append_1)
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = fontconfig.pc.in fonts.conf.in fonts.dtd \
fontconfig.spec.in fontconfig.spec fontconfig-zip.in \
--
2.27.0.windows.1
From 4fe8cbc9b86f5d7c2d12e0c3f84e97c42e9026b9 Mon Sep 17 00:00:00 2001
From: Edward Hervey <bilboed@bilboed.com>
Date: Sun, 25 May 2014 11:20:34 +0200
Subject: [PATCH 3/3] configure: Allow static build
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 1086a9a..135e95a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,7 @@ fi
dnl Initialize libtool
LT_PREREQ([2.2])
-LT_INIT([disable-static win32-dll])
+LT_INIT([win32-dll])
dnl libtool versioning
--
1.9.0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment