From 2161192e7611ae9c418efe9f78476596b32706f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 5 Aug 2020 16:06:56 +0200 Subject: [PATCH] nix: simplify build of gomobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- nix/pkgs/gomobile/default.nix | 29 ++++++----------------------- nix/status-go/mobile/build.nix | 2 +- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/nix/pkgs/gomobile/default.nix b/nix/pkgs/gomobile/default.nix index 7a7646e379..9e72403c05 100644 --- a/nix/pkgs/gomobile/default.nix +++ b/nix/pkgs/gomobile/default.nix @@ -36,33 +36,18 @@ in buildGoPackage rec { --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 + # 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 { @@ -71,8 +56,6 @@ in buildGoPackage rec { 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."; diff --git a/nix/status-go/mobile/build.nix b/nix/status-go/mobile/build.nix index ff7daae0d3..13e60d4830 100644 --- a/nix/status-go/mobile/build.nix +++ b/nix/status-go/mobile/build.nix @@ -45,7 +45,7 @@ in buildGoPackage { mkdir ${NIX_GOWORKDIR} export GO111MODULE=off - export GOPATH=${gomobile.dev}:$GOPATH + export GOPATH=${gomobile.out}:$GOPATH export NIX_GOWORKDIR=${NIX_GOWORKDIR} '' + optionalString (platform == "android") ''