From 4fe64efbf7556e1f0f376b676be3c9aa7b5acba4 Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:49:05 +0800 Subject: [PATCH] gomobile: 2022-05-18 -> 0-unstable-2024-11-08 --- pkgs/development/mobile/gomobile/default.nix | 90 +++++++++++++++----- 1 file changed, 69 insertions(+), 21 deletions(-) diff --git a/pkgs/development/mobile/gomobile/default.nix b/pkgs/development/mobile/gomobile/default.nix index caeb524af94e0..724ce8cb6ea4f 100644 --- a/pkgs/development/mobile/gomobile/default.nix +++ b/pkgs/development/mobile/gomobile/default.nix @@ -1,33 +1,81 @@ { + stdenv, lib, - fetchFromGitHub, + fetchgit, buildGoModule, - gitUpdater, + zlib, + makeWrapper, + xcodeenv, + androidenv, + xcodeWrapperArgs ? { }, + xcodeWrapper ? xcodeenv.composeXcodeWrapper xcodeWrapperArgs, + withAndroidPkgs ? true, + androidsdk ? ( + (androidenv.composeAndroidPackages { + includeNDK = true; + }).androidsdk + ), }: -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 : "${androidsdk}/bin" \ + # --set-default ANDROID_HOME "${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 ]; }; }