fontconfig: bump to version 2.17.1 (also for gcc2)

This commit is contained in:
Joachim Mairböck
2025-08-27 17:23:41 +02:00
parent 3c122ee46f
commit 791ac756d4
5 changed files with 221 additions and 247 deletions

View File

@@ -1,144 +0,0 @@
SUMMARY="A library for font customization and configuration"
DESCRIPTION="Fontconfig is a library for font customization and configuration."
HOMEPAGE="https://www.freedesktop.org/wiki/Software/fontconfig"
COPYRIGHT="2000-2005, 2006-2007 Keith Packard
2005 Patrick Lam
2009 Roozbeh Pournader
2008-2009 Red Hat, Inc.
2008 Danilo Segan
2012 Google, Inc."
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://www.freedesktop.org/software/fontconfig/release/fontconfig-$portVersion.tar.xz"
CHECKSUM_SHA256="506e61283878c1726550bc94f2af26168f1e9f2106eac77eaaf0b2cdfad66e4e"
PATCHES="fontconfig-$portVersion.patchset"
ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
libVersion="1.12.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
GLOBAL_WRITABLE_FILES="
settings/fonts/conf.d directory keep-old
settings/fonts/fonts.conf auto-merge
"
PROVIDES="
fontconfig$secondaryArchSuffix = $portVersion compat >= 2
cmd:fc_cache$secondaryArchSuffix
cmd:fc_cat$secondaryArchSuffix
cmd:fc_conflist$secondaryArchSuffix
cmd:fc_list$secondaryArchSuffix
cmd:fc_match$secondaryArchSuffix
cmd:fc_pattern$secondaryArchSuffix
cmd:fc_query$secondaryArchSuffix
cmd:fc_scan$secondaryArchSuffix
cmd:fc_validate$secondaryArchSuffix
lib:libfontconfig$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libbz2$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
fontconfig${secondaryArchSuffix}_devel = $portVersion compat >= 2.1
devel:libfontconfig$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
fontconfig$secondaryArchSuffix == $portVersion base
devel:libfreetype$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
"
defineDebugInfoPackage fontconfig$secondaryArchSuffix \
$libDir/libfontconfig.so.$libVersion
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libbz2$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
devel:libiconv$secondaryArchSuffix
devel:libintl$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:autopoint
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:gperf
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
mkdir -p `finddir B_USER_CACHE_DIRECTORY`
autoreconf -vfi
FONTS_DIR=`finddir B_SYSTEM_FONTS_DIRECTORY`
FONTS_DIR2=`finddir B_SYSTEM_NONPACKAGED_FONTS_DIRECTORY`
FONTS_DIR3=`finddir B_USER_FONTS_DIRECTORY`
FONTS_DIR4=`finddir B_USER_NONPACKAGED_FONTS_DIRECTORY`
CACHE_DIR=`finddir B_USER_CACHE_DIRECTORY`
runConfigure ./configure \
--enable-libxml2 \
--with-default-fonts=${FONTS_DIR} \
--with-add-fonts=${FONTS_DIR2},${FONTS_DIR3},${FONTS_DIR4} \
--with-cache-dir=${CACHE_DIR}
make $jobArgs
}
INSTALL()
{
make install RUN_FC_CACHE_TEST=false
rm $libDir/*.la
prepareInstalledDevelLibs \
libfontconfig
fixPkgconfig
# The pkgconfig file reference other libraries using the wrong paths, which
# creates a lot of confusion. Fix them so correct paths are used.
local develPackageName="${portName}_devel-$portFullVersion"
local packageLinksDir=$(dirname $portPackageLinksDir)
local linksDir="$packageLinksDir/${develPackageName}/devel~libfreetype$secondaryArchSuffix/$relativeDevelopLibDir"
sed -i -e "s,^\(Libs.private.*\)-L.* \(-lfreetype.*\)$,\1-L$linksDir \2," \
$developLibDir/pkgconfig/fontconfig.pc
linksDir="$packageLinksDir/${develPackageName}/devel~libxml2$secondaryArchSuffix/$relativeDevelopLibDir"
sed -i -e "s,^\(Libs.private.*-lfreetype.*\) -L.* \(-lxml2.*\)$,\1-L$linksDir \2," \
$developLibDir/pkgconfig/fontconfig.pc
linksDir="$packageLinksDir/${develPackageName}/devel~libfreetype$secondaryArchSuffix/$relativeIncludeDir"
sed -i -e "s,^\(Cflags.*\)-I/packages.*\(/freetype2.*\)$,\1-I$linksDir\2," \
$developLibDir/pkgconfig/fontconfig.pc
linksDir="$packageLinksDir/${develPackageName}/devel~libxml2$secondaryArchSuffix/$relativeIncludeDir"
sed -i -e "s,^\(Cflags.*freetype2.*\)-I/packages.*\(/libxml2.*\)$,\1-I$linksDir\2," \
$developLibDir/pkgconfig/fontconfig.pc
packageEntries devel \
$developDir \
$manDir \
$docDir
# Make symlinks relative
for i in $settingsDir/fonts/conf.d/*.conf; do
ln -f -r -s "`readlink "$i"`" "$i"
done
}
TEST()
{
make check
}

View File

@@ -1,22 +1,23 @@
SUMMARY="A library for font customization and configuration"
DESCRIPTION="Fontconfig is a library for font customization and configuration."
HOMEPAGE="https://www.freedesktop.org/wiki/Software/fontconfig"
COPYRIGHT="2000-2005, 2006-2007 Keith Packard
COPYRIGHT="2000,2001,2002,2003,2004,2006,2007 Keith Packard
2005 Patrick Lam
2007 Dwayne Bailey and Translate.org.za
2009 Roozbeh Pournader
2008-2009 Red Hat, Inc.
2008 Danilo Segan
2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 Red Hat, Inc.
2008 Danilo Šegan
2012 Google, Inc."
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://www.freedesktop.org/software/fontconfig/release/fontconfig-$portVersion.tar.xz"
CHECKSUM_SHA256="d816a920384aa91bc0ebf20c3b51c59c2153fdf65de0b5564bf9e8473443d637"
REVISION="1"
SOURCE_URI="https://gitlab.freedesktop.org/api/v4/projects/890/packages/generic/fontconfig/$portVersion/fontconfig-$portVersion.tar.xz"
CHECKSUM_SHA256="9f5cae93f4fffc1fbc05ae99cdfc708cd60dfd6612ffc0512827025c026fa541"
PATCHES="fontconfig-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"
libVersion="1.12.0"
libVersion="1.16.1"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
GLOBAL_WRITABLE_FILES="
@@ -84,6 +85,10 @@ BUILD_PREREQUIRES="
cmd:python3
"
TEST_REQUIRES="
#cmd:curl # needed for 1 test, but that hangs on beta 5
"
BUILD()
{
mkdir -p `finddir B_USER_CACHE_DIRECTORY`

View File

@@ -1,48 +0,0 @@
From 9b00524ab93d879d199abb12b83c9768384dfb8d Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 10 Jun 2019 19:04:18 +0200
Subject: Fix for gcc2 and test-bz106632
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 091eed4..5a9fa94 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -142,6 +142,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
FcBool was_valid, was_processed = FcFalse;
int i;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *rooted_dir = NULL;
/*
* Now scan all of the directories into separate databases
@@ -164,7 +165,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
continue;
}
- FcChar8 *rooted_dir = NULL;
if (sysroot)
{
rooted_dir = FcStrPlus(sysroot, dir);
diff --git a/src/fccfg.c b/src/fccfg.c
index e81eeba..c389683 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2349,11 +2349,13 @@ FcConfigRealFilename (FcConfig *config,
if (!FcStrIsAbsoluteFilename (buf))
{
FcChar8 *dirname = FcStrDirname (nn);
+ FcChar8 *path;
+
FcStrFree (nn);
if (!dirname)
return NULL;
- FcChar8 *path = FcStrBuildFilename (dirname, buf, NULL);
+ path = FcStrBuildFilename (dirname, buf, NULL);
FcStrFree (dirname);
if (!path)
return NULL;
--
2.23.0

View File

@@ -1,47 +0,0 @@
From e56bbe61f812fc582e860f199af45613d80928bb Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 10 Jun 2019 19:04:18 +0200
Subject: Fix for gcc2 and test-bz106632
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index a99adba..8f5bc00 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -150,6 +150,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
FcBool was_valid, was_processed = FcFalse;
int i;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *rooted_dir = NULL;
/*
* Now scan all of the directories into separate databases
@@ -172,7 +173,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
continue;
}
- FcChar8 *rooted_dir = NULL;
if (sysroot)
{
rooted_dir = FcStrPlus(sysroot, dir);
diff --git a/src/fccfg.c b/src/fccfg.c
index eb174a4..c6f5a93 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2769,11 +2769,12 @@ FcConfigRealFilename (FcConfig *config,
else if (!FcStrIsAbsoluteFilename (buf))
{
FcChar8 *dirname = FcStrDirname (n);
+ FcChar8 *path;
FcStrFree (n);
if (!dirname)
return NULL;
- FcChar8 *path = FcStrBuildFilename (dirname, buf, NULL);
+ path = FcStrBuildFilename (dirname, buf, NULL);
FcStrFree (dirname);
if (!path)
return NULL;
--
2.30.2

View File

@@ -0,0 +1,208 @@
From b5fbd83166a4f0d12c6a33ace15f983ac7836e00 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 10 Jun 2019 19:04:18 +0200
Subject: Fix for gcc2 and test-bz106632
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index e225bdc..dda94ca 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -151,6 +151,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
FcBool was_valid, was_processed = FcFalse;
int i;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ FcChar8 *rooted_dir = NULL;
/*
* Now scan all of the directories into separate databases
@@ -170,7 +171,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
continue;
}
- FcChar8 *rooted_dir = NULL;
if (sysroot) {
rooted_dir = FcStrPlus (sysroot, dir);
} else {
diff --git a/src/fccfg.c b/src/fccfg.c
index 4bd1e4d..bf0db63 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2680,11 +2680,12 @@ FcConfigRealFilename (FcConfig *config,
return n;
else if (!FcStrIsAbsoluteFilename (buf)) {
FcChar8 *dirname = FcStrDirname (n);
+ FcChar8 *path;
FcStrFree (n);
if (!dirname)
return NULL;
- FcChar8 *path = FcStrBuildFilename (dirname, buf, NULL);
+ path = FcStrBuildFilename (dirname, buf, NULL);
FcStrFree (dirname);
if (!path)
return NULL;
--
2.50.1
From c5a1e7af156b43d3ce6f5713436a52d277b77fcf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Wed, 27 Aug 2025 17:14:48 +0200
Subject: more gcc2 fixes
diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c
index debf4d3..f905d99 100644
--- a/fc-query/fc-query.c
+++ b/fc-query/fc-query.c
@@ -121,6 +121,7 @@ main (int argc, char **argv)
FcChar8 *format = NULL;
int err = 0;
int i;
+ unsigned int (*query_function) (const FcChar8 *, unsigned int, FcBlanks *, int *, FcFontSet *) = FcFreeTypeQueryAll;
#if HAVE_GETOPT_LONG || HAVE_GETOPT
int c;
@@ -161,7 +162,6 @@ main (int argc, char **argv)
fs = FcFontSetCreate();
- unsigned int (*query_function) (const FcChar8 *, unsigned int, FcBlanks *, int *, FcFontSet *) = FcFreeTypeQueryAll;
#if ENABLE_FONTATIONS
if (getenv ("FC_FONTATIONS") != NULL) {
query_function = FcFontationsQueryAll;
diff --git a/src/fcdir.c b/src/fcdir.c
index 9527d94..9bd673e 100644
--- a/src/fcdir.c
+++ b/src/fcdir.c
@@ -75,13 +75,13 @@ FcFileScanFontConfig (FcFontSet *set,
FcBool ret = FcTrue;
int old_nfont = set->nfont;
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
+ unsigned int (*query_function) (const FcChar8 *, unsigned int, FcBlanks *, int *, FcFontSet *) = FcFreeTypeQueryAll;
if (FcDebug() & FC_DBG_SCAN) {
printf ("\tScanning file %s...", file);
fflush (stdout);
}
- unsigned int (*query_function) (const FcChar8 *, unsigned int, FcBlanks *, int *, FcFontSet *) = FcFreeTypeQueryAll;
#if ENABLE_FONTATIONS
if (getenv ("FC_FONTATIONS")) {
query_function = FcFontationsQueryAll;
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 0a87d27..111f2b1 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -1210,6 +1210,8 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
FcBool symbol = FcFalse;
FT_Error ftresult;
+ FcChar8 *wrapper = NULL;
+
FcInitDebug(); /* We might be called with no initizalization whatsoever. */
pat = FcPatternCreate();
@@ -2027,8 +2029,6 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
goto bail2;
}
- FcChar8 *wrapper = NULL;
-
#if HAVE_FT_GET_X11_FONT_FORMAT
/*
* Use the (not well documented or supported) X-specific function
@@ -2051,12 +2051,13 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
goto bail2;
if (FT_IS_SFNT (face)) {
+ char buf[4];
+ int fd = FcOpen ((char *)file, O_RDONLY);
+
/* If this is an SFNT wrapper, try to sniff the SFNT tag which is the
* first 4 bytes, to see if it is a WOFF or WOFF2 wrapper. */
wrapper = (FcChar8 *)"SFNT";
- char buf[4];
- int fd = FcOpen ((char *)file, O_RDONLY);
if (fd != -1 && read (fd, buf, 4)) {
if (buf[0] == 'w' && buf[1] == 'O' && buf[2] == 'F') {
if (buf[3] == 'F')
diff --git a/src/fcint.h b/src/fcint.h
index 8046cc8..a5e8ae8 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -63,7 +63,7 @@
# define FC_CONFIG_PATH "fonts.conf"
#endif
-#ifdef _WIN32
+#if defined(_WIN32) || (defined(__GNUC__) && __GNUC__ == 2)
# define FC_LIKELY(expr) (expr)
# define FC_UNLIKELY(expr) (expr)
#else
diff --git a/src/fcserialize.c b/src/fcserialize.c
index 398619b..67b8f0f 100644
--- a/src/fcserialize.c
+++ b/src/fcserialize.c
@@ -119,7 +119,8 @@ FcSerializeFind (const FcSerialize *serialize, const void *object)
uintptr_t hash = FcSerializeHashPtr (object);
size_t buckets_count = serialize->buckets_count;
size_t index = hash & (buckets_count - 1);
- for (size_t n = 0; n < buckets_count; ++n) {
+ size_t n;
+ for (n = 0; n < buckets_count; ++n) {
FcSerializeBucket *bucket = &serialize->buckets[index];
if (bucket->hash == 0) {
return NULL;
@@ -138,7 +139,8 @@ FcSerializeUncheckedSet (FcSerialize *serialize, FcSerializeBucket *insert)
const void *object = insert->object;
size_t buckets_count = serialize->buckets_count;
size_t index = insert->hash & (buckets_count - 1);
- for (size_t n = 0; n < buckets_count; ++n) {
+ size_t n;
+ for (n = 0; n < buckets_count; ++n) {
FcSerializeBucket *bucket = &serialize->buckets[index];
if (bucket->hash == 0) {
*bucket = *insert;
@@ -166,16 +168,17 @@ FcSerializeResize (FcSerialize *serialize, size_t new_count)
FcSerializeBucket *old_buckets_end = old_buckets ? old_buckets + old_count : NULL;
FcSerializeBucket *new_buckets = malloc (new_count * sizeof (*old_buckets));
+ FcSerializeBucket *new_buckets_end, *b;
if (!new_buckets)
return FcFalse;
- FcSerializeBucket *new_buckets_end = new_buckets + new_count;
- for (FcSerializeBucket *b = new_buckets; b < new_buckets_end; ++b)
+ new_buckets_end = new_buckets + new_count;
+ for (b = new_buckets; b < new_buckets_end; ++b)
b->hash = 0;
serialize->buckets = new_buckets;
serialize->buckets_count = new_count;
serialize->buckets_used = 0;
- for (FcSerializeBucket *b = old_buckets; b < old_buckets_end; ++b)
+ for (b = old_buckets; b < old_buckets_end; ++b)
if (b->hash != 0 && !FcSerializeUncheckedSet (serialize, b)) {
serialize->buckets = old_buckets;
serialize->buckets_count = old_count;
@@ -190,6 +193,7 @@ FcSerializeResize (FcSerialize *serialize, size_t new_count)
static FcSerializeBucket *
FcSerializeSet (FcSerialize *serialize, const void *object, intptr_t offset)
{
+ FcSerializeBucket bucket;
if (serialize->buckets_used >= serialize->buckets_used_max) {
size_t capacity = serialize->buckets_count;
if (capacity == 0)
@@ -205,7 +209,6 @@ FcSerializeSet (FcSerialize *serialize, const void *object, intptr_t offset)
serialize->buckets_used_max = capacity / 4u * 3u;
}
- FcSerializeBucket bucket;
bucket.object = object;
bucket.offset = offset;
bucket.hash = FcSerializeHashPtr (object);
--
2.50.1