summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/harfbuzz/harfbuzz/version-race.patch
blob: a8b8f0353cd4a0b26fd3249199f2ed105090f4bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
From 6ccadec1fae6a73749b7dfe2311f71d0e610e812 Mon Sep 17 00:00:00 2001
From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
Date: Wed, 30 Sep 2020 10:30:08 +0900
Subject: [PATCH] No need to pass source directory to gen-hb-version

The input file is by definition in the source directory, so dirname()
that instead of needing the directory to be passed.

Needed because a follow-up commit will change when this is called, and the
source directory isn't trivially available at that point.

generate hb-version.h once at configure time with Meson

Currently with Meson hb-version.h is generated during the build without
any explicit dependencies which can result in build failures due races
over the file.

Change this to be generated at configure time, so that the file is always
generated once before the build itself.

Closes #2667

Upstream-Status: Backport [https://github.com/harfbuzz/harfbuzz/commit/5aff83104e03d6d2617987d24a51e490ab7a5cd1]
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
---
 src/gen-hb-version.py |  6 +++---
 src/meson.build       | 17 ++++++++---------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/gen-hb-version.py b/src/gen-hb-version.py
index 15e56b9..bf16f88 100755
--- a/src/gen-hb-version.py
+++ b/src/gen-hb-version.py
@@ -4,15 +4,15 @@
 
 import os, sys, shutil
 
-if len (sys.argv) < 5:
+if len (sys.argv) < 4:
 	sys.exit(__doc__)
 
 version = sys.argv[1]
 major, minor, micro = version.split (".")
 
 OUTPUT = sys.argv[2]
-CURRENT_SOURCE_DIR = sys.argv[3]
-INPUT = sys.argv[4]
+INPUT = sys.argv[3]
+CURRENT_SOURCE_DIR = os.path.dirname(INPUT)
 
 with open (INPUT, "r", encoding='utf-8') as template:
 	with open (OUTPUT, "wb") as output:
diff --git a/src/meson.build b/src/meson.build
index 5e1787c..56d8ae2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,3 +1,10 @@
+hb_version_h = configure_file(
+               command: [find_program('gen-hb-version.py'), meson.project_version(), '@OUTPUT@', '@INPUT@'],
+               input: 'hb-version.h.in',
+               output: 'hb-version.h',
+               install: true,
+               install_dir: join_paths(get_option('includedir'), meson.project_name()))
+
 # Base and default-included sources and headers
 hb_base_sources = files(
   'hb-aat-layout-ankr-table.hh',
@@ -214,9 +221,9 @@ hb_base_headers = files(
   'hb-shape.h',
   'hb-style.h',
   'hb-unicode.h',
-  'hb-version.h',
   'hb.h',
 )
+hb_base_headers += hb_version_h
 
 # Optional Sources and Headers with external deps
 
@@ -281,14 +288,6 @@ hb_gobject_headers = files(
   'hb-gobject-structs.h',
 )
 
-custom_target('hb-version.h',
-  build_by_default: true,
-  input: 'hb-version.h.in',
-  output: 'hb-version.h',
-  command: [find_program('gen-hb-version.py'), meson.project_version(),
-            '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
-)
-
 ragel = find_program('ragel', required: false)
 if not ragel.found()
   warning('You have to install ragel if you are going to develop HarfBuzz itself')
-- 
2.25.1