[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: fontconfig: detect mkostemp with stdlib.h

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Oct 12 09:10:00 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
48426959 by Steve Lhomme at 2025-10-12T07:21:32+00:00
contrib: fontconfig: detect mkostemp with stdlib.h

Patch sent upstream: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/480

- - - - -
747e2510 by Steve Lhomme at 2025-10-12T07:21:32+00:00
contrib: fontconfig: build with meson

- - - - -


2 changed files:

- + contrib/src/fontconfig/0001-detect-mkostemp-with-stdlib.h.patch
- contrib/src/fontconfig/rules.mak


Changes:

=====================================
contrib/src/fontconfig/0001-detect-mkostemp-with-stdlib.h.patch
=====================================
@@ -0,0 +1,62 @@
+From d72fa7a842405592a3b38282e59639843147601b Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <slhomme at matroska.org>
+Date: Fri, 10 Oct 2025 12:01:35 +0200
+Subject: [PATCH] detect mkostemp with stdlib.h
+
+On Apple platforms it may be detected as available by
+just linking with it.
+But when calling it it may be turned into a weak
+reference that will fail to run on older platforms.
+
+It's possible to get around this using __builtin_available() [^1]
+but due to the way this code is used a clean fallback is not
+possible.
+
+It's available since macOS 10.12, iOS 10.0, tvOS 10.0 and watchOS 3.0.
+
+[^1]: https://clang.llvm.org/docs/LanguageExtensions.html#objective-c-available
+---
+ configure.ac | 4 +++-
+ meson.build  | 4 ++--
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f2cf27ef..1cc95dd8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -194,7 +194,9 @@ AC_TYPE_PID_T
+ # Checks for library functions.
+ AC_FUNC_VPRINTF
+ AC_FUNC_MMAP
+-AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat strerror strerror_r])
++AC_CHECK_FUNCS([link mkstemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat strerror strerror_r])
++
++AC_CHECK_DECL([mkostemp],[AC_DEFINE_UNQUOTED([HAVE_MKOSTEMP],[1],[Define to 1 if you have the 'mkostemp' function.])],[],[#include <stdlib.h>])
+ 
+ AC_SEARCH_LIBS([fabs], [m], [], [AC_MSG_ERROR([unable to find the fabs() function])])
+ 
+diff --git a/meson.build b/meson.build
+index d71643db..4202eb5f 100644
+--- a/meson.build
++++ b/meson.build
+@@ -118,7 +118,6 @@ check_headers = [
+ check_funcs = [
+   ['link'],
+   ['mkstemp'],
+-  ['mkostemp'],
+   ['_mktemp_s'],
+   ['mkdtemp'],
+   ['getopt'],
+@@ -156,7 +155,8 @@ check_freetype_funcs = [
+ ]
+ 
+ check_header_symbols = [
+-  ['posix_fadvise', 'fcntl.h']
++  ['posix_fadvise', 'fcntl.h'],
++  ['mkostemp', 'stdlib.h'],
+ ]
+ 
+ check_struct_members = [
+-- 
+2.50.1 (Apple Git-155)
+


=====================================
contrib/src/fontconfig/rules.mak
=====================================
@@ -17,41 +17,25 @@ $(TARBALLS)/fontconfig-$(FONTCONFIG_VERSION).tar.gz:
 
 fontconfig: fontconfig-$(FONTCONFIG_VERSION).tar.gz .sum-fontconfig
 	$(UNPACK)
-	$(call update_autoconfig,.)
 	$(RM) $(UNPACK_DIR)/src/fcobjshash.gperf
 	# include the generated fcobjshash.h, not the one from src/
 	sed -i.orig -e 's,"fcobjshash.h",<fcobjshash.h>,' $(UNPACK_DIR)/src/fcobjs.c
-	$(call pkg_static, "fontconfig.pc.in")
+	$(APPLY) $(SRC)/fontconfig/0001-detect-mkostemp-with-stdlib.h.patch
 	$(MOVE)
 
-FONTCONFIG_CONF := --enable-libxml2 --disable-docs
-FONTCONFIG_INSTALL :=
-ifdef HAVE_MACOSX
-# fc-cache crashes on macOS
-FONTCONFIG_INSTALL += RUN_FC_CACHE_TEST=false
-endif
-
-# FreeType flags
-ifneq ($(findstring freetype2,$(PKGS)),)
-FONTCONFIG_CONF += --with-freetype-config="$(PREFIX)/bin/freetype-config"
-endif
-
-ifdef HAVE_CROSS_COMPILE
-FONTCONFIG_CONF += --with-arch=$(ARCH)
-endif
+FONTCONFIG_CONF := -Ddoc=disabled -Dtests=disabled -Dtools=disabled -Dnls=disabled
 
 ifdef HAVE_MACOSX
 FONTCONFIG_CONF += \
-	--with-cache-dir=~/Library/Caches/fontconfig \
-	--with-default-fonts=/System/Library/Fonts \
-	--with-add-fonts=/Library/Fonts,~/Library/Fonts
+	-Dcache-dir=~/Library/Caches/fontconfig \
+	-Ddefault-fonts-dirs=/System/Library/Fonts \
+	-Dadditional-fonts-dirs=/Library/Fonts,~/Library/Fonts
 endif
 
 DEPS_fontconfig = freetype2 $(DEPS_freetype2) libxml2 $(DEPS_libxml2)
 
-.fontconfig: fontconfig
-	$(MAKEBUILDDIR)
-	$(MAKECONFIGURE) $(FONTCONFIG_CONF)
-	+$(MAKEBUILD)
-	+$(MAKEBUILD) $(FONTCONFIG_INSTALL) install
+.fontconfig: fontconfig crossfile.meson
+	$(MESONCLEAN)
+	$(MESON) $(FONTCONFIG_CONF)
+	+$(MESONBUILD)
 	touch $@



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/04f73569728f62cd06e61f1400b0f2003c055c7e...747e25100a8e436cb70578ebb744299bd3ffe1ac

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/04f73569728f62cd06e61f1400b0f2003c055c7e...747e25100a8e436cb70578ebb744299bd3ffe1ac
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list