]> code.ossystems Code Review - openembedded-core.git/commitdiff
harfbuzz: fix a build race around hb-version.h
authorRoss Burton <ross@burtonini.com>
Tue, 8 Sep 2020 13:57:17 +0000 (14:57 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 8 Sep 2020 15:43:35 +0000 (16:43 +0100)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-graphics/harfbuzz/harfbuzz/version-race.patch [new file with mode: 0644]
meta/recipes-graphics/harfbuzz/harfbuzz_2.7.2.bb

diff --git a/meta/recipes-graphics/harfbuzz/harfbuzz/version-race.patch b/meta/recipes-graphics/harfbuzz/harfbuzz/version-race.patch
new file mode 100644 (file)
index 0000000..2d692f3
--- /dev/null
@@ -0,0 +1,121 @@
+Upstream-Status: Backport [https://github.com/harfbuzz/harfbuzz/commit/5aff83104e03d6d2617987d24a51e490ab7a5cd1]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From bc1c93fbe04459a4b12c76c713ba1b750d2d9108 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Mon, 7 Sep 2020 17:11:17 +0100
+Subject: [PATCH 1/2] [build] 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.
+---
+ src/gen-hb-version.py | 6 +++---
+ src/meson.build       | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/gen-hb-version.py b/src/gen-hb-version.py
+index 15e56b93..bf16f88a 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 5d7cd578..2d78c992 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -286,7 +286,7 @@ custom_target('hb-version.h',
+   input: 'hb-version.h.in',
+   output: 'hb-version.h',
+   command: [find_program('gen-hb-version.py'), meson.project_version(),
+-            '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
++            '@OUTPUT@', '@INPUT@'],
+ )
+ ragel = find_program('ragel', required: false)
+-- 
+2.28.0
+
+
+From 5aff83104e03d6d2617987d24a51e490ab7a5cd1 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Mon, 7 Sep 2020 10:55:33 +0100
+Subject: [PATCH 2/2] [build] 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
+---
+ src/meson.build | 17 ++++++++---------
+ 1 file changed, 8 insertions(+), 9 deletions(-)
+
+diff --git a/src/meson.build b/src/meson.build
+index 2d78c992..19290245 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@', '@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.28.0
+
index 8416eb93d8de63f10561d80ec94a5fb3d663fbae..f95273f686f0e3781be521e3c23d34d64ec1eef5 100644 (file)
@@ -13,6 +13,7 @@ UPSTREAM_CHECK_REGEX = "harfbuzz-(?P<pver>\d+(\.\d+)+).tar"
 SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.xz \
            file://0001-Do-not-disable-introspection-in-cross-builds.patch \
            file://0001-src-hb-gobject-enums.cc.tmpl-write-out-only-the-file.patch \
+           file://version-race.patch \
            "
 SRC_URI[sha256sum] = "b8c048d7c2964a12f2c80deb6634dfc836b603dd12bf0d0a3df1627698e220ce"