Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame^] | 1 | Upstream-Status: Backport [https://github.com/harfbuzz/harfbuzz/commit/5aff83104e03d6d2617987d24a51e490ab7a5cd1] |
| 2 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 3 | |
| 4 | From bc1c93fbe04459a4b12c76c713ba1b750d2d9108 Mon Sep 17 00:00:00 2001 |
| 5 | From: Ross Burton <ross.burton@arm.com> |
| 6 | Date: Mon, 7 Sep 2020 17:11:17 +0100 |
| 7 | Subject: [PATCH 1/2] [build] No need to pass source directory to |
| 8 | gen-hb-version |
| 9 | |
| 10 | The input file is by definition in the source directory, so dirname() |
| 11 | that instead of needing the directory to be passed. |
| 12 | |
| 13 | Needed because a follow-up commit will change when this is called, and the |
| 14 | source 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 | |
| 20 | diff --git a/src/gen-hb-version.py b/src/gen-hb-version.py |
| 21 | index 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: |
| 43 | diff --git a/src/meson.build b/src/meson.build |
| 44 | index 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 | -- |
| 57 | 2.28.0 |
| 58 | |
| 59 | |
| 60 | From 5aff83104e03d6d2617987d24a51e490ab7a5cd1 Mon Sep 17 00:00:00 2001 |
| 61 | From: Ross Burton <ross.burton@arm.com> |
| 62 | Date: Mon, 7 Sep 2020 10:55:33 +0100 |
| 63 | Subject: [PATCH 2/2] [build] generate hb-version.h once at configure time with |
| 64 | Meson |
| 65 | |
| 66 | Currently with Meson hb-version.h is generated during the build without |
| 67 | any explicit dependencies which can result in build failures due races |
| 68 | over the file. |
| 69 | |
| 70 | Change this to be generated at configure time, so that the file is always |
| 71 | generated once before the build itself. |
| 72 | |
| 73 | Closes #2667 |
| 74 | --- |
| 75 | src/meson.build | 17 ++++++++--------- |
| 76 | 1 file changed, 8 insertions(+), 9 deletions(-) |
| 77 | |
| 78 | diff --git a/src/meson.build b/src/meson.build |
| 79 | index 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 | -- |
| 120 | 2.28.0 |
| 121 | |