gh: fix cross
"zowoq" wrote this commit: https://github.com/NixOS/nixpkgs/pull/225121#issuecomment-1500037413
This commit is contained in:
parent
ffd548d5cc
commit
661117e16f
@ -1,4 +1,4 @@
|
||||
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, testers, gh }:
|
||||
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, stdenv, testers, gh }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "gh";
|
||||
@ -15,27 +15,23 @@ buildGoModule rec {
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
# upstream unsets these to handle cross but it breaks our build
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace "GOOS= GOARCH= GOARM= GOFLAGS= CGO_ENABLED=" ""
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh manpages
|
||||
make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh ${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) "manpages"}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 bin/gh -t $out/bin
|
||||
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installManPage share/man/*/*.[1-9]
|
||||
|
||||
installShellCompletion --cmd gh \
|
||||
--bash <($out/bin/gh completion -s bash) \
|
||||
--fish <($out/bin/gh completion -s fish) \
|
||||
--zsh <($out/bin/gh completion -s zsh)
|
||||
'' + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user