Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 55 additions & 77 deletions pkgs/development/mobile/androidenv/addon.xml

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions pkgs/development/mobile/androidenv/addons.nix
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ in
google_play_services = buildGoogleApis {
name = "google_play_services";
src = fetchurl {
url = https://dl.google.com/android/repository/google_play_services_v12_1_rc11.zip;
sha1 = "d2bb583a3f62b068d448df10544c1852d910526f";
url = https://dl.google.com/android/repository/google_play_services_v16_1_rc09.zip;
sha1 = "f95bf19634e2ab0430923247fe2c50246432d2e9";
};
meta = {
description = "Google Play services client library and sample code";
Expand All @@ -308,13 +308,14 @@ in
instant_apps = buildGoogleApis {
name = "instant_apps_sdk";
src = fetchurl {
url = https://dl.google.com/android/repository/aiasdk-1.0.0.zip;
sha1 = "50074a0f0312ee1d0d81d2cddc3d84a8a9e97a53";
url = https://dl.google.com/android/repository/iasdk-1.5.0-1538000167.zip;
sha1 = "6c282b9c686e819fe7f5ac8f2249d2479acb63b4";
};
meta = {
description = "Android Instant Apps Development SDK";
url = "https://developer.android.com/";
};
};


}
10 changes: 10 additions & 0 deletions pkgs/development/mobile/androidenv/androidndk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ let
do
wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
done

${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
for i in ${pkg_path}/prebuilt/linux-x86_64/bin/*
do
if ! isELF $i; then continue; fi
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
done
''}

# make some executables available in PATH
mkdir -pv ${bin_path}
for i in \
Expand Down
73 changes: 40 additions & 33 deletions pkgs/development/mobile/androidenv/androidsdk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
, freetype, fontconfig, glib, gtk2, atk, file, jdk, coreutils, libpulseaudio, dbus
, zlib, glxinfo, xkeyboardconfig
, includeSources
, licenseAccepted
}:
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false
{ platformVersions, abiVersions, useGoogleAPIs, buildToolsVersions ? [], useExtraSupportLibs ? false
, useGooglePlayServices ? false, useInstantApps ? false }:

if !licenseAccepted then throw ''
You must accept the Android Software Development Kit License Agreement at
https://developer.android.com/studio/terms
by setting nixpkgs config option 'android_sdk.accept_license = true;'
''
else assert licenseAccepted;

let inherit (stdenv.lib) makeLibraryPath;

googleRepository = let version = "gms_v9_rc41_wear_2_0_rc6";
Expand All @@ -20,16 +28,16 @@ in

stdenv.mkDerivation rec {
name = "android-sdk-${version}";
version = "25.2.5";
version = "26.1.1";

src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
then fetchurl {
url = "https://dl.google.com/android/repository/tools_r${version}-linux.zip";
sha256 = "0gnk49pkwy4m0nqwm1xnf3w4mfpi9w0kk7841xlawpwbkj0icxap";
url = "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip";
sha256 = "1yfy0qqxz1ixpsci1pizls1nrncmi8p16wcb9rimdn4q3mdfxzwj";
}
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
url = "http://dl.google.com/android/repository/tools_r${version}-macosx.zip";
sha256 = "0yg7wjmyw70xsh8k4hgbqb5rilam2a94yc8dwbh7fjwqcmpxgwqb";
url = "https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip";
sha256 = "0gl5c30m40kx0vvrpbaa8cw8wq2vb89r14hgzb1df4qgpic97cpc";
}
else throw "platform not ${stdenv.hostPlatform.system} supported!";

Expand All @@ -39,7 +47,7 @@ stdenv.mkDerivation rec {
unpackFile $src
cd tools

for f in android traceview draw9patch hierarchyviewer monitor ddms screenshot2 uiautomatorviewer monkeyrunner jobb lint
for f in monitor bin/monkeyrunner bin/uiautomatorviewer
do
sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f"
done
Expand All @@ -54,47 +62,25 @@ stdenv.mkDerivation rec {
patchelf --set-rpath ${stdenv_32bit.cc.cc.lib}/lib $i
done

${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
for i in bin64/{mkfs.ext4,fsck.ext4,e2fsck,tune2fs,resize2fs}
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
done
''}

${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
# We must also patch the 64-bit emulator instances, if needed

for i in emulator emulator64-arm emulator64-mips emulator64-x86 emulator64-crash-service emulator-check qemu/linux-x86_64/qemu-system-*
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
done
''}

# The following scripts used SWT and wants to dynamically load some GTK+ stuff.
# Creating these wrappers ensure that they can be found:

wrapProgram `pwd`/android \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ glib gtk2 libXtst ]}

wrapProgram `pwd`/uiautomatorviewer \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}

wrapProgram `pwd`/hierarchyviewer \
wrapProgram `pwd`/bin/uiautomatorviewer \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}

# The emulators need additional libraries, which are dynamically loaded => let's wrap them

${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") ''
for i in emulator emulator64-arm emulator64-mips emulator64-x86 emulator64-crash-service
for i in emulator emulator-check
do
wrapProgram `pwd`/$i \
--prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \
--suffix LD_LIBRARY_PATH : `pwd`/lib64:`pwd`/lib64/qt/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext libGLU_combined alsaLib zlib libpulseaudio dbus.lib ]} \
--suffix LD_LIBRARY_PATH : `pwd`/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext libGLU_combined alsaLib zlib libpulseaudio dbus.lib ]} \
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboardconfig}/share/X11/xkb
done
''}
Expand Down Expand Up @@ -134,9 +120,17 @@ stdenv.mkDerivation rec {

cd ..
ln -s ${platformTools}/platform-tools
ln -s ${buildTools}/build-tools
ln -s ${support}/support

mkdir -p build-tools
cd build-tools

${stdenv.lib.concatMapStrings
(v: "ln -s ${builtins.getAttr "v${builtins.replaceStrings ["."] ["_"] v}" buildTools}/build-tools/*")
(if (builtins.length buildToolsVersions) == 0 then platformVersions else buildToolsVersions)}

cd ..

# Symlink required Google API add-ons

mkdir -p add-ons
Expand Down Expand Up @@ -245,6 +239,14 @@ stdenv.mkDerivation rec {
fi
done

for i in $out/libexec/tools/bin/*
do
if [ ! -d $i ] && [ -x $i ]
then
ln -sf $i $out/bin/$(basename $i)
fi
done

for i in $out/libexec/platform-tools/*
do
if [ ! -d $i ] && [ -x $i ]
Expand All @@ -260,6 +262,11 @@ stdenv.mkDerivation rec {
ln -sf $i $out/bin/$(basename $i)
fi
done

wrapProgram $out/bin/sdkmanager \
--set JAVA_HOME ${jdk}

yes | ANDROID_SDK_HOME=$(mktemp -d) $out/bin/sdkmanager --licenses || true
'';

buildInputs = [ unzip makeWrapper ];
Expand Down
Loading