nix: simplify build of gomobile
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
0319854e83
commit
2161192e76
|
@ -36,33 +36,18 @@ in buildGoPackage rec {
|
||||||
--replace \
|
--replace \
|
||||||
'tmpdir, err = ioutil.TempDir(gomobilepath, "work-")' \
|
'tmpdir, err = ioutil.TempDir(gomobilepath, "work-")' \
|
||||||
"tmpdir = filepath.Join(os.Getenv(\"NIX_BUILD_TOP\"), \"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 = ''
|
preBuild = ''
|
||||||
mkdir $NIX_BUILD_TOP/gomobile-work $NIX_BUILD_TOP/work
|
mkdir $NIX_BUILD_TOP/gomobile-work $NIX_BUILD_TOP/work
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall =
|
# Necessary for GOPATH when using gomobile.
|
||||||
let
|
postInstall = ''
|
||||||
inherit (stdenv.lib) makeBinPath makeLibraryPath;
|
echo "Creating $out"
|
||||||
in ''
|
mkdir -p $out/src/$goPackagePath
|
||||||
mkdir -p $out $bin/lib
|
echo "Copying from $src"
|
||||||
|
cp -a $src/. $out/src/$goPackagePath
|
||||||
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 {
|
src = fetchgit {
|
||||||
|
@ -71,8 +56,6 @@ in buildGoPackage rec {
|
||||||
url = "https://go.googlesource.com/mobile";
|
url = "https://go.googlesource.com/mobile";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = [ "bin" "dev" "out" ];
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "A tool for building and running mobile apps written in Go.";
|
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.";
|
longDescription = "Gomobile is a tool for building and running mobile apps written in Go.";
|
||||||
|
|
|
@ -45,7 +45,7 @@ in buildGoPackage {
|
||||||
mkdir ${NIX_GOWORKDIR}
|
mkdir ${NIX_GOWORKDIR}
|
||||||
|
|
||||||
export GO111MODULE=off
|
export GO111MODULE=off
|
||||||
export GOPATH=${gomobile.dev}:$GOPATH
|
export GOPATH=${gomobile.out}:$GOPATH
|
||||||
export NIX_GOWORKDIR=${NIX_GOWORKDIR}
|
export NIX_GOWORKDIR=${NIX_GOWORKDIR}
|
||||||
|
|
||||||
'' + optionalString (platform == "android") ''
|
'' + optionalString (platform == "android") ''
|
||||||
|
|
Loading…
Reference in New Issue