Skip to content

Commit

Permalink
gh: fix cross
Browse files Browse the repository at this point in the history
"zowoq" wrote this commit:

  #225121 (comment)
  • Loading branch information
zowoq committed May 5, 2023
1 parent ffd548d commit 661117e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pkgs/applications/version-management/gh/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, testers, gh }:
{ lib, fetchFromGitHub, buildGoModule, installShellFiles, stdenv, testers, gh }:

buildGoModule rec {
pname = "gh";
Expand All @@ -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
'';

Expand Down

0 comments on commit 661117e

Please sign in to comment.