blob: 2d692f36b521c5b8581e0aa267f513512da6dbc6 [file] [log] [blame]
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001Upstream-Status: Backport [https://github.com/harfbuzz/harfbuzz/commit/5aff83104e03d6d2617987d24a51e490ab7a5cd1]
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From bc1c93fbe04459a4b12c76c713ba1b750d2d9108 Mon Sep 17 00:00:00 2001
5From: Ross Burton <ross.burton@arm.com>
6Date: Mon, 7 Sep 2020 17:11:17 +0100
7Subject: [PATCH 1/2] [build] No need to pass source directory to
8 gen-hb-version
9
10The input file is by definition in the source directory, so dirname()
11that instead of needing the directory to be passed.
12
13Needed because a follow-up commit will change when this is called, and the
14source directory isn't trivially available at that point.
15---
16 src/gen-hb-version.py | 6 +++---
17 src/meson.build | 2 +-
18 2 files changed, 4 insertions(+), 4 deletions(-)
19
20diff --git a/src/gen-hb-version.py b/src/gen-hb-version.py
21index 15e56b93..bf16f88a 100755
22--- a/src/gen-hb-version.py
23+++ b/src/gen-hb-version.py
24@@ -4,15 +4,15 @@
25
26 import os, sys, shutil
27
28-if len (sys.argv) < 5:
29+if len (sys.argv) < 4:
30 sys.exit(__doc__)
31
32 version = sys.argv[1]
33 major, minor, micro = version.split (".")
34
35 OUTPUT = sys.argv[2]
36-CURRENT_SOURCE_DIR = sys.argv[3]
37-INPUT = sys.argv[4]
38+INPUT = sys.argv[3]
39+CURRENT_SOURCE_DIR = os.path.dirname(INPUT)
40
41 with open (INPUT, "r", encoding='utf-8') as template:
42 with open (OUTPUT, "wb") as output:
43diff --git a/src/meson.build b/src/meson.build
44index 5d7cd578..2d78c992 100644
45--- a/src/meson.build
46+++ b/src/meson.build
47@@ -286,7 +286,7 @@ custom_target('hb-version.h',
48 input: 'hb-version.h.in',
49 output: 'hb-version.h',
50 command: [find_program('gen-hb-version.py'), meson.project_version(),
51- '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
52+ '@OUTPUT@', '@INPUT@'],
53 )
54
55 ragel = find_program('ragel', required: false)
56--
572.28.0
58
59
60From 5aff83104e03d6d2617987d24a51e490ab7a5cd1 Mon Sep 17 00:00:00 2001
61From: Ross Burton <ross.burton@arm.com>
62Date: Mon, 7 Sep 2020 10:55:33 +0100
63Subject: [PATCH 2/2] [build] generate hb-version.h once at configure time with
64 Meson
65
66Currently with Meson hb-version.h is generated during the build without
67any explicit dependencies which can result in build failures due races
68over the file.
69
70Change this to be generated at configure time, so that the file is always
71generated once before the build itself.
72
73Closes #2667
74---
75 src/meson.build | 17 ++++++++---------
76 1 file changed, 8 insertions(+), 9 deletions(-)
77
78diff --git a/src/meson.build b/src/meson.build
79index 2d78c992..19290245 100644
80--- a/src/meson.build
81+++ b/src/meson.build
82@@ -1,3 +1,10 @@
83+hb_version_h = configure_file(
84+ command: [find_program('gen-hb-version.py'), meson.project_version(), '@OUTPUT@', '@INPUT@'],
85+ input: 'hb-version.h.in',
86+ output: 'hb-version.h',
87+ install: true,
88+ install_dir: join_paths(get_option('includedir'), meson.project_name()))
89+
90 # Base and default-included sources and headers
91 hb_base_sources = files(
92 'hb-aat-layout-ankr-table.hh',
93@@ -214,9 +221,9 @@ hb_base_headers = files(
94 'hb-shape.h',
95 'hb-style.h',
96 'hb-unicode.h',
97- 'hb-version.h',
98 'hb.h',
99 )
100+hb_base_headers += hb_version_h
101
102 # Optional Sources and Headers with external deps
103
104@@ -281,14 +288,6 @@ hb_gobject_headers = files(
105 'hb-gobject-structs.h',
106 )
107
108-custom_target('hb-version.h',
109- build_by_default: true,
110- input: 'hb-version.h.in',
111- output: 'hb-version.h',
112- command: [find_program('gen-hb-version.py'), meson.project_version(),
113- '@OUTPUT@', '@INPUT@'],
114-)
115-
116 ragel = find_program('ragel', required: false)
117 if not ragel.found()
118 warning('You have to install ragel if you are going to develop HarfBuzz itself')
119--
1202.28.0
121