mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
androidenv: Add the Android Instant Apps SDK
This commit is contained in:
parent
84e34d4d5d
commit
af78d76718
@ -305,4 +305,16 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
instant_apps = buildGoogleApis {
|
||||
name = "instant_apps_sdk";
|
||||
src = fetchurl {
|
||||
url = https://dl.google.com/android/repository/aiasdk-1.0.0.zip;
|
||||
sha1 = "50074a0f0312ee1d0d81d2cddc3d84a8a9e97a53";
|
||||
};
|
||||
meta = {
|
||||
description = "Android Instant Apps Development SDK";
|
||||
url = "https://developer.android.com/";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,8 @@
|
||||
, zlib, glxinfo, xkeyboardconfig
|
||||
, includeSources
|
||||
}:
|
||||
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false, useGooglePlayServices ? false }:
|
||||
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false
|
||||
, useGooglePlayServices ? false, useInstantApps ? false }:
|
||||
|
||||
let inherit (stdenv.lib) makeLibraryPath; in
|
||||
|
||||
@ -38,7 +39,7 @@ stdenv.mkDerivation rec {
|
||||
${stdenv.lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
|
||||
''
|
||||
# There are a number of native binaries. We must patch them to let them find the interpreter and libstdc++
|
||||
|
||||
|
||||
for i in mksdcard
|
||||
do
|
||||
patchelf --set-interpreter ${stdenv_32bit.cc.libc.out}/lib/ld-linux.so.2 $i
|
||||
@ -55,29 +56,29 @@ stdenv.mkDerivation rec {
|
||||
|
||||
${stdenv.lib.optionalString (stdenv.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 \
|
||||
--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.system == "x86_64-linux") ''
|
||||
@ -92,15 +93,15 @@ stdenv.mkDerivation rec {
|
||||
''}
|
||||
|
||||
patchShebangs .
|
||||
|
||||
|
||||
${if stdenv.system == "i686-linux" then
|
||||
''
|
||||
# The monitor requires some more patching
|
||||
|
||||
|
||||
cd lib/monitor-x86
|
||||
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux.so.2 monitor
|
||||
patchelf --set-rpath ${makeLibraryPath [ libX11 libXext libXrender freetype fontconfig ]} libcairo-swt.so
|
||||
|
||||
|
||||
wrapProgram `pwd`/monitor \
|
||||
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ gtk2 atk stdenv.cc.cc libXtst ]}
|
||||
|
||||
@ -109,30 +110,30 @@ stdenv.mkDerivation rec {
|
||||
else if stdenv.system == "x86_64-linux" then
|
||||
''
|
||||
# The monitor requires some more patching
|
||||
|
||||
|
||||
cd lib/monitor-x86_64
|
||||
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 monitor
|
||||
patchelf --set-rpath ${makeLibraryPath [ libX11 libXext libXrender freetype fontconfig ]} libcairo-swt.so
|
||||
|
||||
|
||||
wrapProgram `pwd`/monitor \
|
||||
--prefix LD_LIBRARY_PATH : ${makeLibraryPath [ gtk2 atk stdenv.cc.cc libXtst ]}
|
||||
|
||||
cd ../..
|
||||
''
|
||||
else ""}
|
||||
|
||||
|
||||
# Symlink the other sub packages
|
||||
|
||||
|
||||
cd ..
|
||||
ln -s ${platformTools}/platform-tools
|
||||
ln -s ${buildTools}/build-tools
|
||||
ln -s ${support}/support
|
||||
|
||||
|
||||
# Symlink required Google API add-ons
|
||||
|
||||
|
||||
mkdir -p add-ons
|
||||
cd add-ons
|
||||
|
||||
|
||||
${if useGoogleAPIs then
|
||||
stdenv.lib.concatMapStrings (platformVersion:
|
||||
if (builtins.hasAttr ("google_apis_"+platformVersion) addons) then
|
||||
@ -142,7 +143,7 @@ stdenv.mkDerivation rec {
|
||||
"ln -s ${googleApis}/* addon-google_apis-${platformVersion}\n"
|
||||
else "") platformVersions
|
||||
else ""}
|
||||
|
||||
|
||||
cd ..
|
||||
|
||||
# Symlink required extras
|
||||
@ -163,7 +164,10 @@ stdenv.mkDerivation rec {
|
||||
${if useGooglePlayServices then
|
||||
"ln -s ${addons.google_play_services}/google-play-services google_play_services"
|
||||
else ""}
|
||||
|
||||
|
||||
${stdenv.lib.optionalString useInstantApps
|
||||
"ln -s ${addons.instant_apps}/whsdk instantapps"}
|
||||
|
||||
cd ../..
|
||||
|
||||
# Symlink required sources
|
||||
@ -183,10 +187,10 @@ stdenv.mkDerivation rec {
|
||||
cd ..
|
||||
|
||||
# Symlink required platforms
|
||||
|
||||
|
||||
mkdir -p platforms
|
||||
cd platforms
|
||||
|
||||
|
||||
${stdenv.lib.concatMapStrings (platformVersion:
|
||||
if (builtins.hasAttr ("platform_"+platformVersion) platforms) then
|
||||
let
|
||||
@ -195,14 +199,14 @@ stdenv.mkDerivation rec {
|
||||
"ln -s ${platform}/* android-${platformVersion}\n"
|
||||
else ""
|
||||
) platformVersions}
|
||||
|
||||
|
||||
cd ..
|
||||
|
||||
|
||||
# Symlink required system images
|
||||
|
||||
|
||||
mkdir -p system-images
|
||||
cd system-images
|
||||
|
||||
|
||||
${stdenv.lib.concatMapStrings (abiVersion:
|
||||
stdenv.lib.concatMapStrings (platformVersion:
|
||||
if (builtins.hasAttr ("sysimg_" + abiVersion + "_" + platformVersion) sysimages) then
|
||||
@ -218,9 +222,9 @@ stdenv.mkDerivation rec {
|
||||
else ""
|
||||
) platformVersions
|
||||
) abiVersions}
|
||||
|
||||
|
||||
# Create wrappers to the most important tools and platform tools so that we can run them if the SDK is in our PATH
|
||||
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
for i in $out/libexec/tools/*
|
||||
@ -230,7 +234,7 @@ stdenv.mkDerivation rec {
|
||||
ln -sf $i $out/bin/$(basename $i)
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
for i in $out/libexec/platform-tools/*
|
||||
do
|
||||
if [ ! -d $i ] && [ -x $i ]
|
||||
@ -247,7 +251,7 @@ stdenv.mkDerivation rec {
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
|
||||
buildInputs = [ unzip makeWrapper ];
|
||||
|
||||
meta = {
|
||||
|
@ -165,6 +165,7 @@ rec {
|
||||
useGoogleAPIs = true;
|
||||
useExtraSupportLibs = true;
|
||||
useGooglePlayServices = true;
|
||||
useInstantApps = true;
|
||||
};
|
||||
|
||||
androidsdk_7_0 = androidsdk {
|
||||
@ -179,6 +180,7 @@ rec {
|
||||
useGoogleAPIs = true;
|
||||
useExtraSupportLibs = true;
|
||||
useGooglePlayServices = true;
|
||||
useInstantApps = true;
|
||||
};
|
||||
|
||||
androidsdk_7_1_1 = androidsdk {
|
||||
@ -193,6 +195,7 @@ rec {
|
||||
useGoogleAPIs = true;
|
||||
useExtraSupportLibs = true;
|
||||
useGooglePlayServices = true;
|
||||
useInstantApps = true;
|
||||
};
|
||||
|
||||
androidsdk_8_0 = androidsdk {
|
||||
@ -207,6 +210,7 @@ rec {
|
||||
useGoogleAPIs = true;
|
||||
useExtraSupportLibs = true;
|
||||
useGooglePlayServices = true;
|
||||
useInstantApps = true;
|
||||
};
|
||||
|
||||
androidndk = import ./androidndk.nix {
|
||||
|
@ -60,6 +60,22 @@ in
|
||||
};
|
||||
};
|
||||
</xsl:for-each>
|
||||
|
||||
<!-- Instant apps -->
|
||||
<xsl:for-each select="sdk:extra[sdk:path='instantapps']">
|
||||
instant_apps = buildGoogleApis {
|
||||
name = "instant_apps_sdk";
|
||||
src = fetchurl {
|
||||
url = https://dl.google.com/android/repository/<xsl:value-of select="sdk:archives/sdk:archive/sdk:url"/>;
|
||||
sha1 = "<xsl:value-of select="sdk:archives/sdk:archive/sdk:checksum[@type='sha1']" />";
|
||||
};
|
||||
meta = {
|
||||
description = "Android Instant Apps Development SDK";
|
||||
url = "https://developer.android.com/";
|
||||
};
|
||||
};
|
||||
</xsl:for-each>
|
||||
|
||||
}
|
||||
</xsl:template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user