git.iko.soy/typeable/nixpkgs
on master help sign in
androidenv: Add the Android Instant Apps SDK
commitaf78d76718fdea0137940417266082413f121b0b authorMichael Weiss <dev.primeos@gmail.com> dateSat 9 Sep 2017, 16:23 (9 years ago) parent84e34d4
4 files changed+66−30
pkgs/development/mobile/androidenv/addons.nix+12 pkgs/development/mobile/androidenv/androidsdk.nix+34−30 pkgs/development/mobile/androidenv/default.nix+4 pkgs/development/mobile/androidenv/generate-addons.xsl+16
pkgs/development/mobile/androidenv/addons.nix+12
@@ -305,4 +305,16 @@ in
305305 };
306306 };
307307
308+ instant_apps = buildGoogleApis {
309+ name = "instant_apps_sdk";
310+ src = fetchurl {
311+ url = https://dl.google.com/android/repository/aiasdk-1.0.0.zip;
312+ sha1 = "50074a0f0312ee1d0d81d2cddc3d84a8a9e97a53";
313+ };
314+ meta = {
315+ description = "Android Instant Apps Development SDK";
316+ url = "https://developer.android.com/";
317+ };
318+ };
319+
308320}
pkgs/development/mobile/androidenv/androidsdk.nix+34−30
@@ -5,7 +5,8 @@
55, zlib, glxinfo, xkeyboardconfig
66, includeSources
77}:
8−{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false, useGooglePlayServices ? false }:
8+{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false
9+, useGooglePlayServices ? false, useInstantApps ? false }:
910
1011let inherit (stdenv.lib) makeLibraryPath; in
1112
@@ -38,7 +39,7 @@ stdenv.mkDerivation rec {
3839 ${stdenv.lib.optionalString (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux")
3940 ''
4041 # There are a number of native binaries. We must patch them to let them find the interpreter and libstdc++
41−
42+
4243 for i in mksdcard
4344 do
4445 patchelf --set-interpreter ${stdenv_32bit.cc.libc.out}/lib/ld-linux.so.2 $i
@@ -55,29 +56,29 @@ stdenv.mkDerivation rec {
5556
5657 ${stdenv.lib.optionalString (stdenv.system == "x86_64-linux") ''
5758 # We must also patch the 64-bit emulator instances, if needed
58−
59+
5960 for i in emulator emulator64-arm emulator64-mips emulator64-x86 emulator64-crash-service emulator-check qemu/linux-x86_64/qemu-system-*
6061 do
6162 patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
6263 patchelf --set-rpath ${stdenv.cc.cc.lib}/lib64 $i
6364 done
6465 ''}
65−
66+
6667 # The following scripts used SWT and wants to dynamically load some GTK+ stuff.
6768 # Creating these wrappers ensure that they can be found:
68−
69+
6970 wrapProgram `pwd`/android \
7071 --prefix PATH : ${jdk}/bin \
7172 --prefix LD_LIBRARY_PATH : ${makeLibraryPath [ glib gtk2 libXtst ]}
72−
73+
7374 wrapProgram `pwd`/uiautomatorviewer \
7475 --prefix PATH : ${jdk}/bin \
7576 --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
76−
77+
7778 wrapProgram `pwd`/hierarchyviewer \
7879 --prefix PATH : ${jdk}/bin \
7980 --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ glib gtk2 libXtst ]}
80−
81+
8182 # The emulators need additional libraries, which are dynamically loaded => let's wrap them
8283
8384 ${stdenv.lib.optionalString (stdenv.system == "x86_64-linux") ''
@@ -92,15 +93,15 @@ stdenv.mkDerivation rec {
9293 ''}
9394
9495 patchShebangs .
95−
96+
9697 ${if stdenv.system == "i686-linux" then
9798 ''
9899 # The monitor requires some more patching
99−
100+
100101 cd lib/monitor-x86
101102 patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux.so.2 monitor
102103 patchelf --set-rpath ${makeLibraryPath [ libX11 libXext libXrender freetype fontconfig ]} libcairo-swt.so
103−
104+
104105 wrapProgram `pwd`/monitor \
105106 --prefix LD_LIBRARY_PATH : ${makeLibraryPath [ gtk2 atk stdenv.cc.cc libXtst ]}
106107
@@ -109,30 +110,30 @@ stdenv.mkDerivation rec {
109110 else if stdenv.system == "x86_64-linux" then
110111 ''
111112 # The monitor requires some more patching
112−
113+
113114 cd lib/monitor-x86_64
114115 patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 monitor
115116 patchelf --set-rpath ${makeLibraryPath [ libX11 libXext libXrender freetype fontconfig ]} libcairo-swt.so
116−
117+
117118 wrapProgram `pwd`/monitor \
118119 --prefix LD_LIBRARY_PATH : ${makeLibraryPath [ gtk2 atk stdenv.cc.cc libXtst ]}
119120
120121 cd ../..
121122 ''
122123 else ""}
123−
124+
124125 # Symlink the other sub packages
125−
126+
126127 cd ..
127128 ln -s ${platformTools}/platform-tools
128129 ln -s ${buildTools}/build-tools
129130 ln -s ${support}/support
130−
131+
131132 # Symlink required Google API add-ons
132−
133+
133134 mkdir -p add-ons
134135 cd add-ons
135−
136+
136137 ${if useGoogleAPIs then
137138 stdenv.lib.concatMapStrings (platformVersion:
138139 if (builtins.hasAttr ("google_apis_"+platformVersion) addons) then
@@ -142,7 +143,7 @@ stdenv.mkDerivation rec {
142143 "ln -s ${googleApis}/* addon-google_apis-${platformVersion}\n"
143144 else "") platformVersions
144145 else ""}
145−
146+
146147 cd ..
147148
148149 # Symlink required extras
@@ -163,7 +164,10 @@ stdenv.mkDerivation rec {
163164 ${if useGooglePlayServices then
164165 "ln -s ${addons.google_play_services}/google-play-services google_play_services"
165166 else ""}
166−
167+
168+ ${stdenv.lib.optionalString useInstantApps
169+ "ln -s ${addons.instant_apps}/whsdk instantapps"}
170+
167171 cd ../..
168172
169173 # Symlink required sources
@@ -183,10 +187,10 @@ stdenv.mkDerivation rec {
183187 cd ..
184188
185189 # Symlink required platforms
186−
190+
187191 mkdir -p platforms
188192 cd platforms
189−
193+
190194 ${stdenv.lib.concatMapStrings (platformVersion:
191195 if (builtins.hasAttr ("platform_"+platformVersion) platforms) then
192196 let
@@ -195,14 +199,14 @@ stdenv.mkDerivation rec {
195199 "ln -s ${platform}/* android-${platformVersion}\n"
196200 else ""
197201 ) platformVersions}
198−
202+
199203 cd ..
200−
204+
201205 # Symlink required system images
202−
206+
203207 mkdir -p system-images
204208 cd system-images
205−
209+
206210 ${stdenv.lib.concatMapStrings (abiVersion:
207211 stdenv.lib.concatMapStrings (platformVersion:
208212 if (builtins.hasAttr ("sysimg_" + abiVersion + "_" + platformVersion) sysimages) then
@@ -218,9 +222,9 @@ stdenv.mkDerivation rec {
218222 else ""
219223 ) platformVersions
220224 ) abiVersions}
221−
225+
222226 # Create wrappers to the most important tools and platform tools so that we can run them if the SDK is in our PATH
223−
227+
224228 mkdir -p $out/bin
225229
226230 for i in $out/libexec/tools/*
@@ -230,7 +234,7 @@ stdenv.mkDerivation rec {
230234 ln -sf $i $out/bin/$(basename $i)
231235 fi
232236 done
233−
237+
234238 for i in $out/libexec/platform-tools/*
235239 do
236240 if [ ! -d $i ] && [ -x $i ]
@@ -247,7 +251,7 @@ stdenv.mkDerivation rec {
247251 fi
248252 done
249253 '';
250−
254+
251255 buildInputs = [ unzip makeWrapper ];
252256
253257 meta = {
pkgs/development/mobile/androidenv/default.nix+4
@@ -165,6 +165,7 @@ rec {
165165 useGoogleAPIs = true;
166166 useExtraSupportLibs = true;
167167 useGooglePlayServices = true;
168+ useInstantApps = true;
168169 };
169170
170171 androidsdk_7_0 = androidsdk {
@@ -179,6 +180,7 @@ rec {
179180 useGoogleAPIs = true;
180181 useExtraSupportLibs = true;
181182 useGooglePlayServices = true;
183+ useInstantApps = true;
182184 };
183185
184186 androidsdk_7_1_1 = androidsdk {
@@ -193,6 +195,7 @@ rec {
193195 useGoogleAPIs = true;
194196 useExtraSupportLibs = true;
195197 useGooglePlayServices = true;
198+ useInstantApps = true;
196199 };
197200
198201 androidsdk_8_0 = androidsdk {
@@ -207,6 +210,7 @@ rec {
207210 useGoogleAPIs = true;
208211 useExtraSupportLibs = true;
209212 useGooglePlayServices = true;
213+ useInstantApps = true;
210214 };
211215
212216 androidndk = import ./androidndk.nix {
pkgs/development/mobile/androidenv/generate-addons.xsl+16
@@ -60,6 +60,22 @@ in
6060 };
6161 };
6262</xsl:for-each>
63+
64+<!-- Instant apps -->
65+<xsl:for-each select="sdk:extra[sdk:path='instantapps']">
66+ instant_apps = buildGoogleApis {
67+ name = "instant_apps_sdk";
68+ src = fetchurl {
69+ url = https://dl.google.com/android/repository/<xsl:value-of select="sdk:archives/sdk:archive/sdk:url"/>;
70+ sha1 = "<xsl:value-of select="sdk:archives/sdk:archive/sdk:checksum[@type='sha1']" />";
71+ };
72+ meta = {
73+ description = "Android Instant Apps Development SDK";
74+ url = "https://developer.android.com/";
75+ };
76+ };
77+</xsl:for-each>
78+
6379}
6480</xsl:template>
6581