2024-05-29 15:53:24 +00:00
|
|
|
{ lib, stdenv, meta, source, buildGoPackage }:
|
|
|
|
|
|
|
|
buildGoPackage {
|
2022-05-19 15:50:41 +00:00
|
|
|
pname = source.repo;
|
|
|
|
version = "${source.cleanVersion}-${source.shortRev}";
|
|
|
|
|
|
|
|
inherit meta;
|
|
|
|
inherit (source) src goPackagePath;
|
|
|
|
|
|
|
|
phases = ["unpackPhase" "configurePhase" "buildPhase"];
|
|
|
|
|
2024-04-26 12:34:04 +00:00
|
|
|
# https://pkg.go.dev/net#hdr-Name_Resolution
|
|
|
|
# https://github.com/status-im/status-mobile/issues/19736
|
|
|
|
# https://github.com/status-im/status-mobile/issues/19581
|
|
|
|
# TODO: try removing when go is upgraded to 1.22
|
|
|
|
GODEBUG = "netdns=cgo+2";
|
|
|
|
|
2022-05-19 15:50:41 +00:00
|
|
|
preBuild = ''
|
|
|
|
pushd go/src/$goPackagePath
|
|
|
|
go run cmd/library/*.go > $NIX_BUILD_TOP/main.go
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Build the Go library
|
2024-05-29 15:53:24 +00:00
|
|
|
# ld flags and netgo tag are necessary for integration tests to work on MacOS
|
|
|
|
# https://github.com/status-im/status-mobile/issues/20135
|
2022-05-19 15:50:41 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2022-11-08 13:17:38 +00:00
|
|
|
go build \
|
|
|
|
-buildmode='c-archive' \
|
2024-05-29 15:53:24 +00:00
|
|
|
${lib.optionalString stdenv.isDarwin "-ldflags=-extldflags=-lresolv"} \
|
|
|
|
-tags='gowaku_skip_migrations gowaku_no_rln ${lib.optionalString stdenv.isDarwin "netgo"}' \
|
2022-11-08 13:17:38 +00:00
|
|
|
-o "$out/libstatus.a" \
|
|
|
|
$NIX_BUILD_TOP/main.go
|
2022-05-19 15:50:41 +00:00
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
}
|