From 1a0570550e5be5e34e103fb49a00d4c57b4770b2 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Mon, 6 Nov 2023 13:25:16 +0200 Subject: [PATCH 1/2] CI: fix the if condition to make it work properly Signed-off-by: Dmitry Baryshkov --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b81dfe9..265b5aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: apt -y install --no-install-recommends meson build-essential - name: Install cross-compilers - if:${{ matrix.target }} != 'native' + if: matrix.target != 'native' run: | apt -y install gcc-${{ matrix.target }} FAMILY=$(echo ${{ matrix.target }} | cut -d- -f 1) From 4d332b2b43412e391eee0798de0528365621f072 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Mon, 6 Nov 2023 12:52:25 +0100 Subject: [PATCH 2/2] meson: Use `configuration_data()` instead of piping variables through `echo` Having a template file with replacement macros is a bit cleaner than encoding the setup of the file in `meson.build` and piping that through `echo` with caputred variables. Unfortunately there appears to be no support for repetition, to e.g. expand a list of platform names into the various uses (array with comma- separation, or individual `extern struct` declarations, forcing us to have some form of string expansion within `meson.build`). --- meson.build | 17 ++++++----------- platforms.c.in | 9 +++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 platforms.c.in diff --git a/meson.build b/meson.build index 1e87672..4e2b921 100644 --- a/meson.build +++ b/meson.build @@ -33,7 +33,7 @@ debugcc_srcs = [ ] platform_defs = [] -platform_array = ['const struct debugcc_platform *platforms[] = {'] +platform_array = [] foreach p: platforms debugcc_srcs += p + '.c' @@ -45,19 +45,14 @@ foreach p: platforms pointing_to: 'debugcc') endforeach -platform_array += '\tNULL,' -platform_array += '};' +platforms = configuration_data() +platforms.set('PLATFORM_DEFS', '\n'.join(platform_defs)) +platforms.set('PLATFORM_ARRAY', '\n'.join(platform_array)) debugcc_srcs += configure_file( + input: 'platforms.c.in', output: 'platforms.c', - capture: true, - command: ['echo', - '/* Autogenerated file, do not edit */\n\n' + - '#include \n\n' + - '\n'.join(platform_defs) + - '\n\n' + - '\n'.join(platform_array) - ]) + configuration: platforms) executable('debugcc', debugcc_srcs, diff --git a/platforms.c.in b/platforms.c.in new file mode 100644 index 0000000..bf8b9fc --- /dev/null +++ b/platforms.c.in @@ -0,0 +1,9 @@ +/* Autogenerated file, do not edit */ +#include + +@PLATFORM_DEFS@ + +const struct debugcc_platform *platforms[] = { +@PLATFORM_ARRAY@ + NULL, +};