buildGo: remove some additional references to srcs
This commit is contained in:
parent
38b2bb3516
commit
6c007869b6
1 changed files with 7 additions and 3 deletions
10
third_party/tvl/nix/buildGo/default.nix
vendored
10
third_party/tvl/nix/buildGo/default.nix
vendored
|
@ -21,7 +21,7 @@ let
|
|||
replaceStrings
|
||||
toString;
|
||||
|
||||
inherit (pkgs) lib go runCommand fetchFromGitHub protobuf symlinkJoin;
|
||||
inherit (pkgs) lib go runCommand fetchFromGitHub protobuf symlinkJoin removeReferencesTo;
|
||||
|
||||
# Helpers for low-level Go compiler invocations
|
||||
spaceOut = lib.concatStringsSep " ";
|
||||
|
@ -42,6 +42,8 @@ let
|
|||
|
||||
pathToName = p: replaceStrings ["/"] ["_"] (toString p);
|
||||
|
||||
removeRefs = refs: "${removeReferencesTo}/bin/remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") ([ go ] ++ refs)}";
|
||||
|
||||
# Add an `overrideGo` attribute to a function result that works
|
||||
# similar to `overrideAttrs`, but is used specifically for the
|
||||
# arguments passed to Go builders.
|
||||
|
@ -55,10 +57,11 @@ let
|
|||
program = { name, srcs, deps ? [], x_defs ? {} }:
|
||||
let uniqueDeps = allDeps (map (d: d.gopkg) deps);
|
||||
in runCommand name {} ''
|
||||
${go}/bin/go tool compile -o ${name}.a -trimpath=$PWD -trimpath=${go} ${includeSources uniqueDeps} ${spaceOut srcs}
|
||||
${go}/bin/go tool compile -o ${name}.a -trimpath="$PWD;${go}" ${includeSources uniqueDeps} ${spaceOut srcs}
|
||||
mkdir -p $out/bin
|
||||
export GOROOT_FINAL=go
|
||||
${go}/bin/go tool link -o $out/bin/${name} -buildid nix ${xFlags x_defs} ${includeLibs uniqueDeps} ${name}.a
|
||||
${removeRefs srcs} $out/bin/${name}
|
||||
'';
|
||||
|
||||
# Build a Go library assembled out of the specified files.
|
||||
|
@ -87,8 +90,9 @@ let
|
|||
mkdir -p $out/${path}
|
||||
${srcList path (map (s: "${s}") srcs)}
|
||||
${asmBuild}
|
||||
${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath=$PWD -trimpath=${go} -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs}
|
||||
${go}/bin/go tool compile -pack ${asmLink} -o $out/${path}.a -trimpath="$PWD;${go}" -p ${path} ${includeSources uniqueDeps} ${spaceOut srcs}
|
||||
${asmPack}
|
||||
${removeRefs srcs} $out/${path}.a
|
||||
'') // {
|
||||
inherit gopkg;
|
||||
goDeps = uniqueDeps;
|
||||
|
|
Loading…
Reference in a new issue