From 7a05f9de7d4ca8e8ccc9ec19d8ccd76afd23c146 Mon Sep 17 00:00:00 2001 From: Yureka Date: Fri, 20 Jan 2023 14:31:54 +0100 Subject: [PATCH] gccgo: wrap go binary (#207670) --- pkgs/build-support/cc-wrapper/default.nix | 1 + pkgs/build-support/cc-wrapper/go-wrapper.sh | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 pkgs/build-support/cc-wrapper/go-wrapper.sh diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index d1c57a77a58c..06aabf2a6f3e 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -264,6 +264,7 @@ stdenv.mkDerivation { + optionalString cc.langGo or false '' wrap ${targetPrefix}gccgo $wrapper $ccPath/${targetPrefix}gccgo + wrap ${targetPrefix}go ${./go-wrapper.sh} $ccPath/${targetPrefix}go ''; strictDeps = true; diff --git a/pkgs/build-support/cc-wrapper/go-wrapper.sh b/pkgs/build-support/cc-wrapper/go-wrapper.sh new file mode 100644 index 000000000000..5dfc5d2b73fc --- /dev/null +++ b/pkgs/build-support/cc-wrapper/go-wrapper.sh @@ -0,0 +1,11 @@ +#! @shell@ +set -eu -o pipefail +o posix +shopt -s nullglob + +if (( "${NIX_DEBUG:-0}" >= 7 )); then + set -x +fi + +export GCCGO="@out@/bin/gccgo" + +exec @prog@ "$@"