Skip to content

Commit

Permalink
gomobile: 2022-05-18 -> 0-unstable-2024-11-08
Browse files Browse the repository at this point in the history
  • Loading branch information
aucub committed Dec 9, 2024
1 parent 77190f4 commit 07841ec
Showing 1 changed file with 69 additions and 21 deletions.
90 changes: 69 additions & 21 deletions pkgs/development/mobile/gomobile/default.nix
Original file line number Diff line number Diff line change
@@ -1,33 +1,81 @@
{
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 bin in $(ls $out/bin); do
# wrapProgram $out/bin/$bin \
# --suffix GOPATH : $out \
# ''
# + lib.optionalString withAndroidPkgs ''
# --prefix PATH : "${androidPkgs.androidsdk}/bin" \
# --set-default ANDROID_HOME "${androidPkgs.androidsdk}/libexec/android-sdk" \
# ''
# + ''
# --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ zlib ]}"
# 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 ];
};
}

0 comments on commit 07841ec

Please sign in to comment.