Jakub Sokołowski 0652d18653
nix: upgrade nixpkgs, keep Go at 1.14.15
Notable software upgrades:

- Go `1.14.13` to `1.14.15`
- Clojure `1.10.1.763` to `1.10.3.855`
- NodeJS `12.20.1` to `12.22.1`
- Git `2.29.2` to `2.31.1`
- CMake `3.10.2` to `3.18.1`
- Curl `7.74.0` to `7.76.1`
- Android NDK `21.3.6528147` to `22.1.7171670`
- Android Platform Tools `30.0.5` to `31.0.2`

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2021-06-15 17:49:33 +02:00

69 lines
2.3 KiB
Nix

{ stdenv, lib, utils, callPackage, fetchgit, buildGo114Package,
ncurses5, zlib, makeWrapper, patchelf, androidPkgs, xcodeWrapper
}:
let
inherit (stdenv) isDarwin;
inherit (lib) optional optionalString strings;
in buildGo114Package rec {
pname = "gomobile";
version = "20200622-${strings.substring 0 7 rev}";
# WARNING: Next commit removes support for ARM 32 bit builds for iOS
rev = "33b80540585f2b31e503da24d6b2a02de3c53ff5";
sha256 = "0c9map2vrv34wmaycsv71k4day3b0z5p16yzxmlp8amvqb38zwlm";
goPackagePath = "golang.org/x/mobile";
subPackages = [ "bind" "cmd/gobind" "cmd/gomobile" ];
goDeps = ./deps.nix;
buildInputs = [ makeWrapper ]
++ optional isDarwin xcodeWrapper;
# Ensure XCode and the iPhone SDK are present, instead of failing at the end of the build
preConfigure = optionalString isDarwin utils.enforceiPhoneSDKAvailable;
patches = [ ./resolve-nix-android-sdk.patch ];
postPatch = ''
substituteInPlace cmd/gomobile/install.go --replace "\`adb\`" "\`${androidPkgs}/bin/adb\`"
# Prevent a non-deterministic temporary directory from polluting the resulting object files
substituteInPlace cmd/gomobile/env.go \
--replace \
'tmpdir, err = ioutil.TempDir("", "gomobile-work-")' \
"tmpdir = filepath.Join(os.Getenv(\"NIX_BUILD_TOP\"), \"gomobile-work\")" \
--replace '"io/ioutil"' ""
substituteInPlace cmd/gomobile/init.go \
--replace \
'tmpdir, err = ioutil.TempDir(gomobilepath, "work-")' \
"tmpdir = filepath.Join(os.Getenv(\"NIX_BUILD_TOP\"), \"work\")"
'';
preBuild = ''
mkdir $NIX_BUILD_TOP/gomobile-work $NIX_BUILD_TOP/work
'';
# Necessary for GOPATH when using gomobile.
postInstall = ''
echo "Creating $out"
mkdir -p $out/src/$goPackagePath
echo "Copying from $src"
cp -a $src/. $out/src/$goPackagePath
'';
src = fetchgit {
inherit rev sha256;
name = "gomobile";
url = "https://go.googlesource.com/mobile";
};
meta = with lib; {
description = "A tool for building and running mobile apps written in Go.";
longDescription = "Gomobile is a tool for building and running mobile apps written in Go.";
homepage = https://go.googlesource.com/mobile;
license = licenses.bsdOriginal;
maintainers = with maintainers; [ sheenobu pombeirp ];
platforms = with platforms; linux ++ darwin;
};
}