-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gomobile: 2022-05-18 -> 0-unstable-2024-11-08
- Loading branch information
Showing
1 changed file
with
66 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,78 @@ | ||
{ | ||
stdenv, | ||
lib, | ||
fetchFromGitHub, | ||
fetchgit, | ||
buildGoModule, | ||
gitUpdater, | ||
zlib, | ||
makeWrapper, | ||
xcodeenv, | ||
androidenv, | ||
xcodeWrapperArgs ? { }, | ||
xcodeWrapper ? xcodeenv.composeXcodeWrapper xcodeWrapperArgs, | ||
withAndroidPkgs ? true, | ||
androidPkgs ? ( | ||
androidenv.composeAndroidPackages { | ||
includeNDK = true; | ||
} | ||
), | ||
}: | ||
let | ||
pname = "cast-text"; | ||
version = "0.1.3"; | ||
src = fetchFromGitHub { | ||
owner = "piqoni"; | ||
repo = "cast-text"; | ||
rev = "v${version}"; | ||
hash = "sha256-PU0haunPF2iAHehRT76wHXsdv5oWiBH7xVJUkQbr4QU="; | ||
}; | ||
in | ||
buildGoModule { | ||
inherit pname version src; | ||
pname = "gomobile"; | ||
version = "0-unstable-2024-11-08"; | ||
|
||
vendorHash = "sha256-rTrV8qzGHNNC8wTLJVerOHwFjjCGQmVuHOnBJxuYMAk="; | ||
vendorHash = "sha256-xTl8Hd1+GHRrUb5ktl1XkQa18HsHIeEvnujrcK0E1eU="; | ||
|
||
passthru.updateScript = gitUpdater { | ||
rev-prefix = "v"; | ||
src = fetchgit { | ||
rev = "fa514ef75a0ffd7d89e1b4c9b45485f7bb39cf83"; | ||
name = "gomobile"; | ||
url = "https://go.googlesource.com/mobile"; | ||
hash = "sha256-vuh6Rw27WA0BId+8JUqZdNCrvUH2sorvv15eIK/GFj0="; | ||
}; | ||
|
||
subPackages = [ | ||
"bind" | ||
"cmd/gobind" | ||
"cmd/gomobile" | ||
]; | ||
|
||
# Fails with: go: cannot find GOROOT directory | ||
doCheck = false; | ||
|
||
nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcodeWrapper ]; | ||
|
||
# Prevent a non-deterministic temporary directory from polluting the resulting object files | ||
postPatch = '' | ||
substituteInPlace cmd/gomobile/env.go --replace \ | ||
'tmpdir, err = ioutil.TempDir("", "gomobile-work-")' \ | ||
'tmpdir = filepath.Join(os.Getenv("NIX_BUILD_TOP"), "gomobile-work")' | ||
substituteInPlace cmd/gomobile/init.go --replace \ | ||
'tmpdir, err = ioutil.TempDir(gomobilepath, "work-")' \ | ||
'tmpdir = filepath.Join(os.Getenv("NIX_BUILD_TOP"), "work")' | ||
''; | ||
|
||
# Necessary for GOPATH when using gomobile. | ||
postInstall = '' | ||
mkdir -p $out/src/golang.org/x | ||
ln -s $src $out/src/golang.org/x/mobile | ||
''; | ||
|
||
postFixup = '' | ||
for prog in gomobile gobind; do | ||
wrapProgram $out/bin/$prog \ | ||
--suffix GOPATH : $out \ | ||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib ]}" \ | ||
${lib.optionalString withAndroidPkgs '' | ||
--prefix PATH : "${androidPkgs.androidsdk}/bin" \ | ||
--set-default ANDROID_HOME "${androidPkgs.androidsdk}/libexec/android-sdk" | ||
''} | ||
done | ||
''; | ||
|
||
meta = { | ||
description = "Zero latency, easy-to-use full-text news terminal reader"; | ||
homepage = "https://github.com/piqoni/cast-text"; | ||
license = with lib.licenses; [ mit ]; | ||
maintainers = with lib.maintainers; [ aucub ]; | ||
platforms = lib.platforms.all; | ||
description = "Tool for building and running mobile apps written in Go"; | ||
homepage = "https://pkg.go.dev/golang.org/x/mobile/cmd/gomobile"; | ||
mainProgram = "gomobile"; | ||
license = with lib.licenses; [ bsd3 ]; | ||
maintainers = with lib.maintainers; [ jakubgs ]; | ||
}; | ||
} |