mirror of
https://github.com/status-im/status-react.git
synced 2025-01-13 04:24:40 +00:00
Jakub Sokołowski
aca703a011
Changes: - Adds a new `nix-gc` Makefile target for removing old packages - Moves all `nix/*.sh` files to `nix/scripts/*.sh` to make things more tidy - Renames `TARGET_OS` into `TARGET` and makes it effective only with `nix/scripts/shell.sh` - Renames `target-os` Nix argument to just `target` and makes it effective only with `shell.nix` - Drops `IN_CI_ENVIRONMENT` env variable which was useless - Drops use of `target-os` argument outside of `shell.nix` (with few exceptions, but just in naming) - `nix/platform.nix` has been made obsolete and removed - Moves the definition of all major targets to `nix/targets.nix` - Moves the definition of all major shells to `nix/shells.nix` - Makes `default.nix` and `shell.nix` just thin wrappers around `nix/default.nix` - `nix/nixpkgs-bootstrap.nix` has been moved to `nix/pkgs.nix` - All package and tool overrides have been moved to `nix/pkgs.nix` - Explicit passing of contents of `pkgs` has been removed in favor of `callPackage` doing it for us - `nix/bootstrapped-shell.nix` has been moved to `nix/tools/mkShell.nix` - A new `mergeSh` tool has been added to `pkgs` from `nix/tools/mergeSh.nix` - This tool is used to merge shells created using `mkShell` - `mobile/targets/jsbundle.nix` has been moved to `mobile/android/jsbundle/default.nix` - Moves `status-go` version sanitization to `nix/status-go/utils.nix` - Renames version to rawVersion and versionName to cleanVersion in status-go derivation - Ports nix/mobile/ios/install-pods-and-status-go.sh to Nix sub-shells - Moves adjustment of `inotify/max_user_watches` out into `scripts/inotify_fix.sh` - Makes iOS builds use the Nix version of Fastlane Signed-off-by: Jakub Sokołowski <jakub@status.im>
84 lines
2.7 KiB
Nix
84 lines
2.7 KiB
Nix
{ stdenv, callPackage, utils, fetchgit,
|
|
buildGoPackage, glibc, ncurses5, zlib, makeWrapper, patchelf,
|
|
platform-tools, xcodeWrapper
|
|
}:
|
|
|
|
let
|
|
inherit (stdenv) isDarwin;
|
|
inherit (stdenv.lib) optional optionalString strings;
|
|
in buildGoPackage rec {
|
|
pname = "gomobile";
|
|
version = "20190719-${strings.substring 0 7 rev}";
|
|
rev = "d2bd2a29d028cb94031e5e81788b19b371d00eb8";
|
|
sha256 = "1nv6vvhnjr01nx9y06q46ww87dppdwpbqrlsfg1xf2587wxl8xiv";
|
|
|
|
goPackagePath = "golang.org/x/mobile";
|
|
subPackages = [ "bind" "cmd/gobind" "cmd/gomobile" ];
|
|
|
|
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\`" "\`${platform-tools}/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\")"
|
|
|
|
echo "Creating $dev"
|
|
mkdir -p $dev/src/$goPackagePath
|
|
echo "Copying from $src"
|
|
cp -a $src/. $dev/src/$goPackagePath
|
|
'';
|
|
|
|
preBuild = ''
|
|
mkdir $NIX_BUILD_TOP/gomobile-work $NIX_BUILD_TOP/work
|
|
'';
|
|
|
|
postInstall =
|
|
let
|
|
inherit (stdenv.lib) makeBinPath makeLibraryPath;
|
|
in ''
|
|
mkdir -p $out $bin/lib
|
|
|
|
ln -s ${ncurses5}/lib/libncursesw.so.5 $bin/lib/libtinfo.so.5
|
|
${if isDarwin then ''
|
|
wrapProgram $bin/bin/gomobile \
|
|
--prefix "PATH" : "${makeBinPath [ xcodeWrapper ]}" \
|
|
--prefix "LD_LIBRARY_PATH" : "${makeLibraryPath [ ncurses5 zlib ]}:$bin/lib"
|
|
'' else ''
|
|
wrapProgram $bin/bin/gomobile \
|
|
--prefix "LD_LIBRARY_PATH" : "${makeLibraryPath [ ncurses5 zlib ]}:$bin/lib"
|
|
''}
|
|
$bin/bin/gomobile init
|
|
'';
|
|
|
|
src = fetchgit {
|
|
inherit rev sha256;
|
|
url = "https://go.googlesource.com/mobile";
|
|
};
|
|
|
|
outputs = [ "bin" "dev" "out" ];
|
|
|
|
meta = with stdenv.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;
|
|
};
|
|
}
|