Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh: fix cross #225121

Merged
merged 1 commit into from May 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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