3
0
Fork 0
forked from mirrors/nixpkgs

manifest-tool: fix static build and update 2.0.6 -> 2.1.5 (#279451)

* manifest-tool: 2.0.6 -> 2.1.5

* manifest-tool: fix static build

* manifest-tool: remove import from derivation

---------

Co-authored-by: R. Ryantm <ryantm-bot@ryantm.com>
This commit is contained in:
tricktron 2024-01-08 13:44:09 +01:00 committed by GitHub
parent 8c56a751cb
commit afa089e86d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,15 +9,14 @@
buildGoModule rec {
pname = "manifest-tool";
version = "2.0.6";
gitCommit = "2ed9312726765567a84f2acc44a0c8a6e50f4b7a";
version = "2.1.5";
modRoot = "v2";
src = fetchFromGitHub {
owner = "estesp";
repo = "manifest-tool";
rev = "v${version}";
sha256 = "sha256-oopk++IdNF6msxOszT0fKxQABgWKbaQZ2aNH9chqWU0=";
hash = "sha256-TCR8A35oETAZszrZFtNZulzCsh9UwGueTyHyYe+JQeI=";
leaveDotGit = true;
postFetch = ''
git -C $out rev-parse HEAD > $out/.git-revision
@ -29,14 +28,26 @@ buildGoModule rec {
nativeBuildInputs = [ git ];
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
] ++ lib.optionals stdenv.hostPlatform.isStatic [
"-linkmode=external"
"-extldflags"
"-static"
];
preConfigure = ''
ldflags="-X main.gitCommit=$(cat .git-revision)"
export ldflags+=" -X main.gitCommit=$(cat .git-revision)"
'';
CGO_ENABLED = if stdenv.hostPlatform.isStatic then "0" else "1";
GO_EXTLINK_ENABLED = if stdenv.hostPlatform.isStatic then "0" else "1";
ldflags = lib.optionals stdenv.hostPlatform.isStatic [ "-w" "-extldflags" "-static" ];
tags = lib.optionals stdenv.hostPlatform.isStatic [ "netgo" ];
tags = lib.optionals stdenv.hostPlatform.isStatic [
"cgo"
"netgo"
"osusergo"
"static_build"
];
passthru.tests.version = testers.testVersion {
package = manifest-tool;