summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-07-13 11:16:11 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2023-07-24 14:48:14 +0530
commit533baf667d399fe7f25d8a2b0c7c616206964bd2 (patch)
treea7a05687253f151449d62fc363d5bec554a302e9
parentf4d7eb9a13aad52fff12b02966fcac6924e5de20 (diff)
fontconfig.recipe: Fix build with MSYS2 gperf
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1227>
-rw-r--r--recipes/fontconfig.recipe2
-rw-r--r--recipes/fontconfig/0001-meson-Always-write-utf-8-files-with-LF-newlines.patch37
2 files changed, 39 insertions, 0 deletions
diff --git a/recipes/fontconfig.recipe b/recipes/fontconfig.recipe
index df416aa1..08765150 100644
--- a/recipes/fontconfig.recipe
+++ b/recipes/fontconfig.recipe
@@ -18,6 +18,8 @@ class Recipe(recipe.Recipe):
# Proper fix is pending, upstream issue is:
# https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/247
'fontconfig/0001-fcobjs-Remove-duplicate-function-prototypes.patch',
+ # https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/283
+ 'fontconfig/0001-meson-Always-write-utf-8-files-with-LF-newlines.patch',
]
files_libs = ['libfontconfig']
diff --git a/recipes/fontconfig/0001-meson-Always-write-utf-8-files-with-LF-newlines.patch b/recipes/fontconfig/0001-meson-Always-write-utf-8-files-with-LF-newlines.patch
new file mode 100644
index 00000000..3b051178
--- /dev/null
+++ b/recipes/fontconfig/0001-meson-Always-write-utf-8-files-with-LF-newlines.patch
@@ -0,0 +1,37 @@
+From 6081263d131848842b916a6d2506c1a612be7f81 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Thu, 13 Jul 2023 07:28:52 +0530
+Subject: [PATCH] meson: Always write utf-8 files with LF newlines
+
+Otherwise, MSYS2 gperf chokes on the CRLF newlines translated by
+`open()`, even though we explicitly write out `\n`
+
+```
+[1/48] Generating src/fcobjshash.h with a custom command
+FAILED: src/fcobjshash.h
+"C:\msys64\usr\bin\gperf.EXE" "--pic" "-m" "100" "src/fcobjshash.gperf" "--output-file" "src/fcobjshash.h"
+src/fcobjshash.gperf:17: warning: junk after %% is ignored
+src/fcobjshash.gperf:2: warning: junk after %} is ignored
+src/fcobjshash.gperf:3: junk after declaration
+ninja: build stopped: subcommand failed.
+```
+---
+ src/cutout.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cutout.py b/src/cutout.py
+index 6b46529..9fe46ce 100644
+--- a/src/cutout.py
++++ b/src/cutout.py
+@@ -29,7 +29,7 @@ if __name__== '__main__':
+
+ stdout = ret.stdout.decode('utf8')
+
+- with open(args[0].output, 'w') as out:
++ with open(args[0].output, 'w', encoding='utf-8', newline='\n') as out:
+ write = True
+ for l in stdout.split('\n'):
+ l = l.strip('\r')
+--
+2.41.0
+