From 2375e1ddd6d613df353ddd8b52202f991dbc9440 Mon Sep 17 00:00:00 2001 From: Michael Allwright Date: Sat, 10 Aug 2024 09:41:17 +0200 Subject: [PATCH] Do not clobber user environment variables in Meson script (#1255) --- foreign_cc/meson.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/foreign_cc/meson.bzl b/foreign_cc/meson.bzl index 804a0ff5..9d4179ab 100644 --- a/foreign_cc/meson.bzl +++ b/foreign_cc/meson.bzl @@ -87,13 +87,13 @@ def _create_meson_script(configureParameters): cxxopts = (ctx.fragments.cpp.copts + ctx.fragments.cpp.cxxopts + getattr(ctx.attr, "copts", [])) or [] if copts: - script.append("##export_var## CFLAGS \"{}\"".format(" ".join(copts).replace("\"", "'"))) + script.append("##export_var## CFLAGS \"{} ${{CFLAGS:-}}\"".format(" ".join(copts).replace("\"", "'"))) if cxxopts: - script.append("##export_var## CXXFLAGS \"{}\"".format(" ".join(cxxopts).replace("\"", "'"))) + script.append("##export_var## CXXFLAGS \"{} ${{CXXFLAGS:-}}\"".format(" ".join(cxxopts).replace("\"", "'"))) flags = get_flags_info(ctx) if flags.cxx_linker_executable: - script.append("##export_var## LDFLAGS \"{}\"".format(" ".join(flags.cxx_linker_executable).replace("\"", "'"))) + script.append("##export_var## LDFLAGS \"{} ${{LDFLAGS:-}}\"".format(" ".join(flags.cxx_linker_executable).replace("\"", "'"))) script.append("##export_var## CMAKE {}".format(attrs.cmake_path)) script.append("##export_var## NINJA {}".format(attrs.ninja_path))