I have a package[1] that I'm updating to a new upstream version. Upstream, the project uses meson to compile the binaries (written in Go), as well as generate and install a number of data files. I want to use meson to compile and install the project downstream because I feel meson does a good job managing all the data files and installation directories.
I am trying to replicate the logic of the %gobuild macro so that I can continue to use meson *and* use as much of the go-rpm-macros as possible, with as little duplication as possible. Upstream, I have defined custom_targets[3] for the Go binaries with the following command array:
[go, 'build', gobuildflags, '-o', '@OUTPUT@', '-ldflags', goldflags, packagename]
gobuildflags is an array that is constructed[4] from a meson build option[3].
In my spec %build, I attempt to set the gobuildflags meson build option like so:
%meson -Dgobuildflags=%{shescape:%gobuildflags}
When meson parses the incoming gobuildflags value and splits the string into an array, it separates the value of the -tags flag into two separate single-quoted command line arguments like this (extracted from the resulting ninja.build):
COMMAND = /usr/bin/go build -buildmode pie -compiler gc '-tags="rpm_crashtraceback' '$${BUILDTAGS:-}"' ...
Is there some other way I can pass the output of %gobuildflags into meson as a build option that doesn't split apart the double-quoted values like this?
1: https://src.fedoraproject.org/rpms/yggdrasil 2: https://github.com/RedHatInsights/yggdrasil/blob/main/cmd/yggd/meson.build#L... 3: https://github.com/RedHatInsights/yggdrasil/blob/main/meson_options.txt#L4 4: https://github.com/RedHatInsights/yggdrasil/blob/main/meson.build#L25
golang@lists.fedoraproject.org