Merge pull request #50596 from svanderburg/mobile-updates

Mobile updates
This commit is contained in:
Sander van der Burg 2018-12-24 15:52:33 +01:00 committed by GitHub
commit a27aa247c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 6464 additions and 9984 deletions

3
.gitignore vendored
View File

@ -13,4 +13,5 @@ result-*
.DS_Store
/pkgs/development/libraries/qt-5/*/tmp/
/pkgs/desktops/kde-5/*/tmp/
/pkgs/desktops/kde-5/*/tmp/
/pkgs/development/mobile/androidenv/xml/*

View File

@ -0,0 +1,240 @@
---
title: Android
author: Sander van der Burg
date: 2018-11-18
---
# Android
The Android build environment provides three major features and a number of
supporting features.
Deploying an Android SDK installation with plugins
--------------------------------------------------
The first use case is deploying the SDK with a desired set of plugins or subsets
of an SDK.
```nix
with import <nixpkgs> {};
let
androidComposition = androidenv.composeAndroidPackages {
toolsVersion = "25.2.5";
platformToolsVersion = "27.0.1";
buildToolsVersions = [ "27.0.3" ];
includeEmulator = false;
emulatorVersion = "27.2.0";
platformVersions = [ "24" ];
includeSources = false;
includeDocs = false;
includeSystemImages = false;
systemImageTypes = [ "default" ];
abiVersions = [ "armeabi-v7a" ];
lldbVersions = [ "2.0.2558144" ];
cmakeVersions = [ "3.6.4111459" ];
includeNDK = false;
ndkVersion = "16.1.4479499";
useGoogleAPIs = false;
useGoogleTVAddOns = false;
includeExtras = [
"extras;google;gcm"
];
};
in
androidComposition.androidsdk
```
The above function invocation states that we want an Android SDK with the above
specified plugin versions. By default, most plugins are disabled. Notable
exceptions are the tools, platform-tools and build-tools sub packages.
The following parameters are supported:
* `toolsVersion`, specifies the version of the tools package to use
* `platformsToolsVersion` specifies the version of the `platform-tools` plugin
* `buildToolsVersion` specifies the versions of the `build-tools` plugins to
use.
* `includeEmulator` specifies whether to deploy the emulator package (`false`
by default). When enabled, the version of the emulator to deploy can be
specified by setting the `emulatorVersion` parameter.
* `includeDocs` specifies whether the documentation catalog should be included.
* `lldbVersions` specifies what LLDB versions should be deployed.
* `cmakeVersions` specifies which CMake versions should be deployed.
* `includeNDK` specifies that the Android NDK bundle should be included.
Defaults to: `false`.
* `ndkVersion` specifies the NDK version that we want to use.
* `includeExtras` is an array of identifier strings referring to arbitrary
add-on packages that should be installed.
* `platformVersions` specifies which platform SDK versions should be included.
For each platform version that has been specified, we can apply the following
options:
* `includeSystemImages` specifies whether a system image for each platform SDK
should be included.
* `includeSources` specifies whether the sources for each SDK version should be
included.
* `useGoogleAPIs` specifies that for each selected platform version the
Google API should be included.
* `useGoogleTVAddOns` specifies that for each selected platform version the
Google TV add-on should be included.
For each requested system image we can specify the following options:
* `systemImageTypes` specifies what kind of system images should be included.
Defaults to: `default`.
* `abiVersions` specifies what kind of ABI version of each system image should
be included. Defaults to: `armeabi-v7a`.
Most of the function arguments have reasonable default settings.
When building the above expression with:
```bash
$ nix-build
```
The Android SDK gets deployed with all desired plugin versions.
We can also deploy subsets of the Android SDK. For example, to only the the
`platform-tools` package, you can evaluate the following expression:
```nix
with import <nixpkgs> {};
let
androidComposition = androidenv.composeAndroidPackages {
# ...
};
in
androidComposition.platform-tools
```
Using predefine Android package compositions
--------------------------------------------
In addition to composing an Android package set manually, it is also possible
to use a predefined composition that contains all basic packages for a specific
Android version, such as version 9.0 (API-level 28).
The following Nix expression can be used to deploy the entire SDK with all basic
plugins:
```nix
with import <nixpkgs> {};
androidenv.androidPkgs_9_0.androidsdk
```
It is also possible to use one plugin only:
```nix
with import <nixpkgs> {};
androidenv.androidPkgs_9_0.platform-tools
```
Building an Android application
-------------------------------
In addition to the SDK, it is also possible to build an Ant-based Android
project and automatically deploy all the Android plugins that a project
requires.
```nix
with import <nixpkgs> {};
androidenv.buildApp {
name = "MyAndroidApp";
src = ./myappsources;
release = true;
# If release is set to true, you need to specify the following parameters
keyStore = ./keystore;
keyAlias = "myfirstapp";
keyStorePassword = "mykeystore";
keyAliasPassword = "myfirstapp";
# Any Android SDK parameters that install all the relevant plugins that a
# build requires
platformVersions = [ "24" ];
# When we include the NDK, then ndk-build is invoked before Ant gets invoked
includeNDK = true;
}
```
Aside from the app-specific build parameters (`name`, `src`, `release` and
keystore parameters), the `buildApp {}` function supports all the function
parameters that the SDK composition function (the function shown in the
previous section) supports.
This build function is particularly useful when it is desired to use
[Hydra](http://nixos.org/hydra): the Nix-based continuous integration solution
to build Android apps. An Android APK gets exposed as a build product and can be
installed on any Android device with a web browser by navigating to the build
result page.
Spawning emulator instances
---------------------------
For testing purposes, it can also be quite convenient to automatically generate
scripts that spawn emulator instances with all desired configuration settings.
An emulator spawn script can be configured by invoking the `emulateApp {}`
function:
```nix
with import <nixpkgs> {};
androidenv.emulateApp {
name = "emulate-MyAndroidApp";
platformVersion = "24";
abiVersion = "armeabi-v7a"; # mips, x86 or x86_64
systemImageType = "default";
useGoogleAPIs = false;
}
```
It is also possible to specify an APK to deploy inside the emulator
and the package and activity names to launch it:
```nix
with import <nixpkgs> {};
androidenv.emulateApp {
name = "emulate-MyAndroidApp";
platformVersion = "24";
abiVersion = "armeabi-v7a"; # mips, x86 or x86_64
systemImageType = "default";
useGoogleAPIs = false;
app = ./MyApp.apk;
package = "MyApp";
activity = "MainActivity";
}
```
In addition to prebuilt APKs, you can also bind the APK parameter to a
`buildApp {}` function invocation shown in the previous example.
Querying the available versions of each plugin
----------------------------------------------
When using any of the previously shown functions, it may be a bit inconvenient
to find out what options are supported, since the Android SDK provides many
plugins.
A shell script in the `pkgs/development/mobile/androidenv/` sub directory can be used to retrieve all
possible options:
```bash
sh ./querypackages.sh packages build-tools
```
The above command-line instruction queries all build-tools versions in the
generated `packages.nix` expression.
Updating the generated expressions
----------------------------------
Most of the Nix expressions are generated from XML files that the Android
package manager uses. To update the expressions run the `generate.sh` script
that is stored in the `pkgs/development/mobile/androidenv/` sub directory:
```bash
sh ./generate.sh
```

View File

@ -10,12 +10,14 @@
Nixpkgs to easily build packages for other programming languages, such as
Perl or Haskell. These are described in this chapter.
</para>
<xi:include href="android.section.xml" />
<xi:include href="beam.xml" />
<xi:include href="bower.xml" />
<xi:include href="coq.xml" />
<xi:include href="go.xml" />
<xi:include href="haskell.section.xml" />
<xi:include href="idris.section.xml" />
<xi:include href="ios.section.xml" />
<xi:include href="java.xml" />
<xi:include href="lua.xml" />
<xi:include href="node.section.xml" />
@ -27,6 +29,7 @@
<xi:include href="ruby.xml" />
<xi:include href="rust.section.xml" />
<xi:include href="texlive.xml" />
<xi:include href="titanium.section.xml" />
<xi:include href="vim.section.xml" />
<xi:include href="emscripten.section.xml" />
</chapter>

View File

@ -0,0 +1,219 @@
---
title: iOS
author: Sander van der Burg
date: 2018-11-18
---
# iOS
This component is basically a wrapper/workaround that makes it possible to
expose an Xcode installation as a Nix package by means of symlinking to the
relevant executables on the host system.
Since Xcode can't be packaged with Nix, nor we can publish it as a Nix package
(because of its license) this is basically the only integration strategy
making it possible to do iOS application builds that integrate with other
components of the Nix ecosystem
The primary objective of this project is to use the Nix expression language to
specify how iOS apps can be built from source code, and to automatically spawn
iOS simulator instances for testing.
This component also makes it possible to use [Hydra](http://nixos.org/hydra),
the Nix-based continuous integration server to regularly build iOS apps and to
do wireless ad-hoc installations of enterprise IPAs on iOS devices through
Hydra.
The Xcode build environment implements a number of features.
Deploying a proxy component wrapper exposing Xcode
--------------------------------------------------
The first use case is deploying a Nix package that provides symlinks to the Xcode
installation on the host system. This package can be used as a build input to
any build function implemented in the Nix expression language that requires
Xcode.
```nix
let
pkgs = import <nixpkgs> {};
xcodeenv = import ./xcodeenv {
inherit (pkgs) stdenv;
};
in
xcodeenv.composeXcodeWrapper {
version = "9.2";
xcodeBaseDir = "/Applications/Xcode.app";
}
```
By deploying the above expression with `nix-build` and inspecting its content
you will notice that several Xcode-related executables are exposed as a Nix
package:
```bash
$ ls result/bin
lrwxr-xr-x 1 sander staff 94 1 jan 1970 Simulator -> /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
lrwxr-xr-x 1 sander staff 17 1 jan 1970 codesign -> /usr/bin/codesign
lrwxr-xr-x 1 sander staff 17 1 jan 1970 security -> /usr/bin/security
lrwxr-xr-x 1 sander staff 21 1 jan 1970 xcode-select -> /usr/bin/xcode-select
lrwxr-xr-x 1 sander staff 61 1 jan 1970 xcodebuild -> /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
lrwxr-xr-x 1 sander staff 14 1 jan 1970 xcrun -> /usr/bin/xcrun
```
Building an iOS application
---------------------------
We can build an iOS app executable for the simulator, or an IPA/xcarchive file
for release purposes, e.g. ad-hoc, enterprise or store installations, by
executing the `xcodeenv.buildApp {}` function:
```nix
let
pkgs = import <nixpkgs> {};
xcodeenv = import ./xcodeenv {
inherit (pkgs) stdenv;
};
in
xcodeenv.buildApp {
name = "MyApp";
src = ./myappsources;
sdkVersion = "11.2";
target = null; # Corresponds to the name of the app by default
configuration = null; # Release for release builds, Debug for debug builds
scheme = null; # -scheme will correspond to the app name by default
sdk = null; # null will set it to 'iphonesimulator` for simulator builds or `iphoneos` to real builds
xcodeFlags = "";
release = true;
certificateFile = ./mycertificate.p12;
certificatePassword = "secret";
provisioningProfile = ./myprovisioning.profile;
signMethod = "ad-hoc"; # 'enterprise' or 'store'
generateIPA = true;
generateXCArchive = false;
enableWirelessDistribution = true;
installURL = "/installipa.php";
bundleId = "mycompany.myapp";
appVersion = "1.0";
# Supports all xcodewrapper parameters as well
xcodeBaseDir = "/Applications/Xcode.app";
}
```
The above function takes a variety of parameters:
* The `name` and `src` parameters are mandatory and specify the name of the app
and the location where the source code resides
* `sdkVersion` specifies which version of the iOS SDK to use.
It also possile to adjust the `xcodebuild` parameters. This is only needed in
rare circumstances. In most cases the default values should suffice:
* Specifies which `xcodebuild` target to build. By default it takes the target
that has the same name as the app.
* The `configuration` parameter can be overridden if desired. By default, it
will do a debug build for the simulator and a release build for real devices.
* The `scheme` parameter specifies which `-scheme` parameter to propagate to
`xcodebuild`. By default, it corresponds to the app name.
* The `sdk` parameter specifies which SDK to use. By default, it picks
`iphonesimulator` for simulator builds and `iphoneos` for release builds.
* The `xcodeFlags` parameter specifies arbitrary command line parameters that
should be propagated to `xcodebuild`.
By default, builds are carried out for the iOS simulator. To do release builds
(builds for real iOS devices), you must set the `release` parameter to `true`.
In addition, you need to set the following parameters:
* `certificateFile` refers to a P12 certificate file.
* `certificatePassword` specifies the password of the P12 certificate.
* `provisioningProfile` refers to the provision profile needed to sign the app
* `signMethod` should refer to `ad-hoc` for signing the app with an ad-hoc
certificate, `enterprise` for enterprise certificates and `app-store` for App
store certificates.
* `generateIPA` specifies that we want to produce an IPA file (this is probably
what you want)
* `generateXCArchive` specifies thet we want to produce an xcarchive file.
When building IPA files on Hydra and when it is desired to allow iOS devices to
install IPAs by browsing to the Hydra build products page, you can enable the
`enableWirelessDistribution` parameter.
When enabled, you need to configure the following options:
* The `installURL` parameter refers to the URL of a PHP script that composes the
`itms-services://` URL allowing iOS devices to install the IPA file.
* `bundleId` refers to the bundle ID value of the app
* `appVersion` refers to the app's version number
To use wireless adhoc distributions, you must also install the corresponding
PHP script on a web server (see section: 'Installing the PHP script for wireless
ad hoc installations from Hydra' for more information).
In addition to the build parameters, you can also specify any parameters that
the `xcodeenv.composeXcodeWrapper {}` function takes. For example, the
`xcodeBaseDir` parameter can be overridden to refer to a different Xcode
version.
Spawning simulator instances
----------------------------
In addition to building iOS apps, we can also automatically spawn simulator
instances:
```nix
let
pkgs = import <nixpkgs> {};
xcodeenv = import ./xcodeenv {
inherit (pkgs) stdenv;
};
in
xcode.simulateApp {
name = "simulate";
# Supports all xcodewrapper parameters as well
xcodeBaseDir = "/Applications/Xcode.app";
}
```
The above expression produces a script that starts the simulator from the
provided Xcode installation. The script can be started as follows:
```bash
./result/bin/run-test-simulator
```
By default, the script will show an overview of UDID for all available simulator
instances and asks you to pick one. You can also provide a UDID as a
command-line parameter to launch an instance automatically:
```bash
./result/bin/run-test-simulator 5C93129D-CF39-4B1A-955F-15180C3BD4B8
```
You can also extend the simulator script to automatically deploy and launch an
app in the requested simulator instance:
```nix
let
pkgs = import <nixpkgs> {};
xcodeenv = import ./xcodeenv {
inherit (pkgs) stdenv;
};
in
xcode.simulateApp {
name = "simulate";
bundleId = "mycompany.myapp";
app = xcode.buildApp {
# ...
};
# Supports all xcodewrapper parameters as well
xcodeBaseDir = "/Applications/Xcode.app";
}
```
By providing the result of an `xcode.buildApp {}` function and configuring the
app bundle id, the app gets deployed automatically and started.

View File

@ -0,0 +1,115 @@
---
title: Titanium
author: Sander van der Burg
date: 2018-11-18
---
# Titanium
The Nixpkgs repository contains facilities to deploy a variety of versions of
the [Titanium SDK](https://www.appcelerator.com) versions, a cross-platform
mobile app development framework using JavaScript as an implementation language,
and includes a function abstraction making it possible to build Titanium
applications for Android and iOS devices from source code.
Not all Titanium features supported -- currently, it can only be used to build
Android and iOS apps.
Building a Titanium app
-----------------------
We can build a Titanium app from source for Android or iOS and for debugging or
release purposes by invoking the `titaniumenv.buildApp {}` function:
```nix
titaniumenv.buildApp {
name = "myapp";
src = ./myappsource;
preBuild = "";
target = "android"; # or 'iphone'
tiVersion = "7.1.0.GA";
release = true;
androidsdkArgs = {
platformVersions = [ "25" "26" ];
};
androidKeyStore = ./keystore;
androidKeyAlias = "myfirstapp";
androidKeyStorePassword = "secret";
xcodeBaseDir = "/Applications/Xcode.app";
xcodewrapperArgs = {
version = "9.3";
};
iosMobileProvisioningProfile = ./myprovisioning.profile;
iosCertificateName = "My Company";
iosCertificate = ./mycertificate.p12;
iosCertificatePassword = "secret";
iosVersion = "11.3";
iosBuildStore = false;
enableWirelessDistribution = true;
installURL = "/installipa.php";
}
```
The `titaniumenv.buildApp {}` function takes the following parameters:
* The `name` parameter refers to the name in the Nix store.
* The `src` parameter refers to the source code location of the app that needs
to be built.
* `preRebuild` contains optional build instructions that are carried out before
the build starts.
* `target` indicates for which device the app must be built. Currently only
'android' and 'iphone' (for iOS) are supported.
* `tiVersion` can be used to optionally override the requested Titanium version
in `tiapp.xml`. If not specified, it will use the version in `tiapp.xml`.
* `release` should be set to true when building an app for submission to the
Google Playstore or Apple Appstore. Otherwise, it should be false.
When the `target` has been set to `android`, we can configure the following
parameters:
* The `androidSdkArgs` parameter refers to an attribute set that propagates all
parameters to the `androidenv.composeAndroidPackages {}` function. This can
be used to install all relevant Android plugins that may be needed to perform
the Android build. If no parameters are given, it will deploy the platform
SDKs for API-levels 25 and 26 by default.
When the `release` parameter has been set to true, you need to provide
parameters to sign the app:
* `androidKeyStore` is the path to the keystore file
* `androidKeyAlias` is the key alias
* `androidKeyStorePassword` refers to the password to open the keystore file.
When the `target` has been set to `iphone`, we can configure the following
parameters:
* The `xcodeBaseDir` parameter refers to the location where Xcode has been
installed. When none value is given, the above value is the default.
* The `xcodewrapperArgs` parameter passes arbitrary parameters to the
`xcodeenv.composeXcodeWrapper {}` function. This can, for example, be used
to adjust the default version of Xcode.
When `release` has been set to true, you also need to provide the following
parameters:
* `iosMobileProvisioningProfile` refers to a mobile provisioning profile needed
for signing.
* `iosCertificateName` refers to the company name in the P12 certificate.
* `iosCertificate` refers to the path to the P12 file.
* `iosCertificatePassword` contains the password to open the P12 file.
* `iosVersion` refers to the iOS SDK version to use. It defaults to the latest
version.
* `iosBuildStore` should be set to `true` when building for the Apple Appstore
submission. For enterprise or ad-hoc builds it should be set to `false`.
When `enableWirelessDistribution` has been enabled, you must also provide the
path of the PHP script (`installURL`) (that is included with the iOS build
environment) to enable wireless ad-hoc installations.
Emulating or simulating the app
-------------------------------
It is also possible to simulate the correspond iOS simulator build by using
`xcodeenv.simulateApp {}` and emulate an Android APK by using
`androidenv.emulateApp {}`.

View File

@ -47,7 +47,7 @@ rec {
armv5te-android-prebuilt = rec {
config = "armv5tel-unknown-linux-androideabi";
sdkVer = "21";
ndkVer = "10e";
ndkVer = "18b";
platform = platforms.armv5te-android;
useAndroidPrebuilt = true;
};
@ -55,7 +55,7 @@ rec {
armv7a-android-prebuilt = rec {
config = "armv7a-unknown-linux-androideabi";
sdkVer = "24";
ndkVer = "17c";
ndkVer = "18b";
platform = platforms.armv7a-android;
useAndroidPrebuilt = true;
};
@ -63,7 +63,7 @@ rec {
aarch64-android-prebuilt = rec {
config = "aarch64-unknown-linux-android";
sdkVer = "24";
ndkVer = "17c";
ndkVer = "18b";
platform = platforms.aarch64-multiplatform;
useAndroidPrebuilt = true;
};

View File

@ -16,7 +16,6 @@ with lib;
To grant access to a user, it must be part of adbusers group:
<code>users.users.alice.extraGroups = ["adbusers"];</code>
'';
relatedPackages = [ ["androidenv" "platformTools"] ];
};
};
};
@ -24,7 +23,7 @@ with lib;
###### implementation
config = mkIf config.programs.adb.enable {
services.udev.packages = [ pkgs.android-udev-rules ];
environment.systemPackages = [ pkgs.androidenv.platformTools ];
environment.systemPackages = [ pkgs.androidenv.androidPkgs_9_0.platform-tools ];
users.groups.adbusers = {};
};
}

View File

@ -38,14 +38,16 @@ let
hostInfo = ndkInfoFun stdenv.hostPlatform;
targetInfo = ndkInfoFun stdenv.targetPlatform;
in
rec {
# Misc tools
binaries = let
ndkBinDir =
"${androidndk}/libexec/${androidndk.name}/toolchains/${targetInfo.triple}-${targetInfo.gccVer}/prebuilt/${hostInfo.double}/bin";
"${androidndk}/libexec/android-sdk/ndk-bundle/toolchains/${targetInfo.triple}-${targetInfo.gccVer}/prebuilt/${hostInfo.double}/bin";
ndkGCCLibDir =
"${androidndk}/libexec/android-sdk/ndk-bundle/toolchains/${targetInfo.triple}-${targetInfo.gccVer}/prebuilt/${hostInfo.double}/lib/gcc/${targetInfo.triple}/4.9.x";
in runCommand "ndk-gcc-binutils" {
isGNU = true; # for cc-wrapper
nativeBuildInputs = [ makeWrapper ];
@ -54,8 +56,15 @@ rec {
mkdir -p $out/bin
for prog in ${ndkBinDir}/${targetInfo.triple}-*; do
prog_suffix=$(basename $prog | sed 's/${targetInfo.triple}-//')
ln -s $prog $out/bin/${stdenv.targetPlatform.config}-$prog_suffix
cat > $out/bin/${stdenv.targetPlatform.config}-$prog_suffix <<EOF
#! ${stdenv.shell} -e
$prog "\$@"
EOF
chmod +x $out/bin/${stdenv.targetPlatform.config}-$prog_suffix
done
ln -s $out/bin/${stdenv.targetPlatform.config}-ld $out/bin/ld
ln -s ${ndkGCCLibDir} $out/lib
'';
binutils = wrapBintoolsWith {
@ -109,18 +118,15 @@ rec {
# anyways.
libraries =
let
includePath = if buildAndroidndk.version == "10e" then
"${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${stdenv.hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/include/"
else
"${buildAndroidndk}/libexec/${buildAndroidndk.name}/sysroot/usr/include";
libPath = "${buildAndroidndk}/libexec/${buildAndroidndk.name}/platforms/android-${stdenv.hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/lib/";
includePath = "${buildAndroidndk}/libexec/android-sdk/ndk-bundle/sysroot/usr/include";
asmIncludePath = "${buildAndroidndk}/libexec/android-sdk/ndk-bundle/sysroot/usr/include/${targetInfo.triple}";
libPath = "${buildAndroidndk}/libexec/android-sdk/ndk-bundle/platforms/android-${stdenv.hostPlatform.sdkVer}/arch-${hostInfo.arch}/usr/lib/";
in
runCommand "bionic-prebuilt" {} ''
mkdir -p $out
cp -r ${includePath} $out/include
chmod +w $out/include
${lib.optionalString (lib.versionOlder "10e" buildAndroidndk.version)
"ln -s $out/include/${hostInfo.triple}/asm $out/include/asm"}
cp -r ${asmIncludePath}/* $out/include
ln -s ${libPath} $out/lib
'';
}

View File

@ -0,0 +1,34 @@
{ androidenv, buildPackages, pkgs, targetPackages
, includeSources ? true, licenseAccepted ? false
}:
rec {
"18b" =
let
ndkVersion = "18.1.5063045";
buildAndroidComposition = buildPackages.buildPackages.androidenv.composeAndroidPackages {
includeNDK = true;
inherit ndkVersion;
};
androidComposition = androidenv.composeAndroidPackages {
includeNDK = true;
inherit ndkVersion;
};
in
import ./androidndk-pkgs.nix {
inherit (buildPackages)
makeWrapper;
inherit (pkgs)
lib stdenv
runCommand wrapBintoolsWith wrapCCWith;
# buildPackages.foo rather than buildPackages.buildPackages.foo would work,
# but for splicing messing up on infinite recursion for the variants we
# *dont't* use. Using this workaround, but also making a test to ensure
# these two really are the same.
buildAndroidndk = buildAndroidComposition.ndk-bundle;
androidndk = androidComposition.ndk-bundle;
targetAndroidndkPkgs = targetPackages.androidndkPkgs_18b;
};
}

View File

@ -1,4 +1,4 @@
{ stdenv, fetchgit, python3, androidsdk, makeWrapper }:
{ stdenv, fetchgit, python3, platform-tools, makeWrapper }:
stdenv.mkDerivation rec {
name = "adb-sync-${version}";
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "1y016bjky5sn58v91jyqfz7vw8qfqnfhb9s9jd32k8y29hy5vy4d";
};
buildInputs = [ python3 androidsdk makeWrapper ];
buildInputs = [ python3 platform-tools makeWrapper ];
phases = "installPhase";
@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin
cp $src/adb-channel $src/adb-sync $out/bin/
patchShebangs $out/bin
wrapProgram $out/bin/adb-sync --suffix PATH : ${androidsdk}/bin
wrapProgram $out/bin/adb-sync --suffix PATH : ${platform-tools}/bin
'';
meta = with stdenv.lib; {

View File

@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
postPatch = ''
# very ugly way of replacing the adb calls
sed -e 's|"adb |"${stdenv.lib.getBin adb}/bin/adb |g' \
sed -e 's|"adb |"${adb}/bin/adb |g' \
-i adbfs.cpp
'';

File diff suppressed because it is too large Load Diff

View File

@ -1,321 +0,0 @@
# This file is generated from generate-addons.sh. DO NOT EDIT.
# Execute generate-addons.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildGoogleApis = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
google_apis_3 = buildGoogleApis {
name = "google_apis-3";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-3-r03.zip;
sha1 = "1f92abf3a76be66ae8032257fc7620acbd2b2e3a";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_4 = buildGoogleApis {
name = "google_apis-4";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-4_r02.zip;
sha1 = "9b6e86d8568558de4d606a7debc4f6049608dbd0";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_5 = buildGoogleApis {
name = "google_apis-5";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-5_r01.zip;
sha1 = "46eaeb56b645ee7ffa24ede8fa17f3df70db0503";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_6 = buildGoogleApis {
name = "google_apis-6";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-6_r01.zip;
sha1 = "5ff545d96e031e09580a6cf55713015c7d4936b2";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_7 = buildGoogleApis {
name = "google_apis-7";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-7_r01.zip;
sha1 = "2e7f91e0fe34fef7f58aeced973c6ae52361b5ac";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_8 = buildGoogleApis {
name = "google_apis-8";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-8_r02.zip;
sha1 = "3079958e7ec87222cac1e6b27bc471b27bf2c352";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_9 = buildGoogleApis {
name = "google_apis-9";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-9_r02.zip;
sha1 = "78664645a1e9accea4430814f8694291a7f1ea5d";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_10 = buildGoogleApis {
name = "google_apis-10";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-10_r02.zip;
sha1 = "cc0711857c881fa7534f90cf8cc09b8fe985484d";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_11 = buildGoogleApis {
name = "google_apis-11";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-11_r01.zip;
sha1 = "5eab5e81addee9f3576d456d205208314b5146a5";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_12 = buildGoogleApis {
name = "google_apis-12";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-12_r01.zip;
sha1 = "e9999f4fa978812174dfeceec0721c793a636e5d";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_13 = buildGoogleApis {
name = "google_apis-13";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-13_r01.zip;
sha1 = "3b153edd211c27dc736c893c658418a4f9041417";
};
meta = {
description = "Android + Google APIs";
url = http://developer.android.com/;
};
};
google_apis_14 = buildGoogleApis {
name = "google_apis-14";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-14_r02.zip;
sha1 = "f8eb4d96ad0492b4c0db2d7e4f1a1a3836664d39";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_15 = buildGoogleApis {
name = "google_apis-15";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-15_r03.zip;
sha1 = "d0d2bf26805eb271693570a1aaec33e7dc3f45e9";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_16 = buildGoogleApis {
name = "google_apis-16";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-16_r04.zip;
sha1 = "ee6acf1b01020bfa8a8e24725dbc4478bee5e792";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_17 = buildGoogleApis {
name = "google_apis-17";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-17_r04.zip;
sha1 = "a076be0677f38df8ca5536b44dfb411a0c808c4f";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_18 = buildGoogleApis {
name = "google_apis-18";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-18_r04.zip;
sha1 = "6109603409debdd40854d4d4a92eaf8481462c8b";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_19 = buildGoogleApis {
name = "google_apis-19";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-19_r20.zip;
sha1 = "5b933abe830b2f25b4c0f171d45e9e0651e56311";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_21 = buildGoogleApis {
name = "google_apis-21";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-21_r01.zip;
sha1 = "66a754efb24e9bb07cc51648426443c7586c9d4a";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_22 = buildGoogleApis {
name = "google_apis-22";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-22_r01.zip;
sha1 = "5def0f42160cba8acff51b9c0c7e8be313de84f5";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_23 = buildGoogleApis {
name = "google_apis-23";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-23_r01.zip;
sha1 = "04c5cc1a7c88967250ebba9561d81e24104167db";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_24 = buildGoogleApis {
name = "google_apis-24";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-24_r1.zip;
sha1 = "31361c2868f27343ee917fbd259c1463821b6145";
};
meta = {
description = "Android + Google APIs";
};
};
google_apis_25 = buildGoogleApis {
name = "google_apis-25";
src = fetchurl {
url = https://dl.google.com/android/repository/google_apis-25_r1.zip;
sha1 = "550e83eea9513ab11c44919ac6da54b36084a9f3";
};
meta = {
description = "Android + Google APIs";
};
};
android_support_extra = buildGoogleApis {
name = "android_support_extra";
src = fetchurl {
url = https://dl.google.com/android/repository/support_r23.2.1.zip;
sha1 = "41121bbc412c2fce0be170d589d20cfa3e78e857";
};
meta = {
description = "Android Support Library";
url = http://developer.android.com/;
};
};
google_play_services = buildGoogleApis {
name = "google_play_services";
src = fetchurl {
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";
url = http://developer.android.com/;
};
};
instant_apps = buildGoogleApis {
name = "instant_apps_sdk";
src = fetchurl {
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/";
};
};
}

View File

@ -1,120 +0,0 @@
{ stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools, python3, libcxx, version, sha1s, bash, runCommand
, fullNDK ? false # set to true if you want other parts of the NDK
# that is not used by Nixpkgs like sources,
# examples, docs, or LLVM toolchains
}:
let
makeStandaloneToolchain = api: arch: let
full_ndk = (ndk true);
in runCommand "makeStandaloneToolchain-${version}" {} ''
${full_ndk}/libexec/${full_ndk.name}/build/tools/make_standalone_toolchain.py --api ${toString api} --arch ${arch} --install-dir $out
'';
ndk = fullNDK: stdenv.mkDerivation rec {
name = "android-ndk-r${version}";
inherit version;
src = fetchurl {
url = "https://dl.google.com/android/repository/${name}-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}.zip";
sha1 = sha1s.${stdenv.hostPlatform.system} or (throw "platform ${stdenv.hostPlatform.system} not supported!");
};
phases = "buildPhase";
nativeBuildInputs = [ unzip makeWrapper file ];
buildCommand = let
bin_path = "$out/bin";
pkg_path = "$out/libexec/${name}";
sed_script_1 =
"'s|^PROGDIR=`dirname $0`" +
"|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
runtime_paths = (lib.makeBinPath [
coreutils file findutils
gawk gnugrep gnused
jdk python3 which
]) + ":${platformTools}/platform-tools";
in ''
mkdir -pv $out/libexec
cd $out/libexec
unzip -qq $src
# so that it doesn't fail because of read-only permissions set
cd -
${if (version == "10e") then
''
patch -p1 \
--no-backup-if-mismatch \
-d $out/libexec/${name} < ${ ./make-standalone-toolchain_r10e.patch }
''
else
''
patch -p1 \
--no-backup-if-mismatch \
-d $out/libexec/${name} < ${ ./. + "/make_standalone_toolchain.py_" + "${version}" + ".patch" }
sed -i 's,#!/usr/bin/env python,#!${python3}/bin/python,g' ${pkg_path}/build/tools/make_standalone_toolchain.py
sed -i 's,#!/bin/bash,#!${bash}/bin/bash,g' ${pkg_path}/build/tools/make_standalone_toolchain.py
wrapProgram ${pkg_path}/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}"
''
}
patchShebangs ${pkg_path}
cd ${pkg_path}
'' + lib.optionalString (!fullNDK) ''
# Steps to reduce output size
rm -rf docs sources tests
# We only support cross compiling with gcc for now
rm -rf toolchains/*-clang* toolchains/llvm*
'' +
''
find ${pkg_path}/toolchains \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm -0100 \) \
\) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \
--set-rpath ${stdenv.lib.makeLibraryPath [ libcxx zlib ncurses5 ]} {} \;
# fix ineffective PROGDIR / MYNDKDIR determination
for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py"}
do
sed -i -e ${sed_script_1} $i
done
# wrap
for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py ndk-which"}
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 \
ndk-build ${lib.optionalString (version == "10e") "ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which"}
do
ln -sf ${pkg_path}/$i ${bin_path}/$i
done
'';
meta = {
platforms = builtins.attrNames sha1s;
hydraPlatforms = [];
license = stdenv.lib.licenses.asl20;
};
};
passthru = {
inherit makeStandaloneToolchain;
};
in lib.extendDerivation true passthru (ndk fullNDK)

View File

@ -1,88 +0,0 @@
{ stdenv, fetchurl, zlib, ncurses, lib, makeWrapper
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
, platformTools
, fullNDK ? false # set to true if you want other parts of the NDK
# that is not used by Nixpkgs like sources,
# examples, docs, or LLVM toolchains
}:
stdenv.mkDerivation rec {
name = "android-ndk-r8e";
src = if stdenv.hostPlatform.system == "i686-linux"
then fetchurl {
url = "http://dl.google.com/android/ndk/${name}-linux-x86.tar.bz2";
sha256 = "c2c4e0c8b3037149a0f5dbb08d72f814a52af4da9fff9d80328c675457e95a98";
}
else if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
url = "http://dl.google.com/android/ndk/${name}-linux-x86_64.tar.bz2";
sha256 = "093gf55zbh38p2gk5bdykj1vg9p5l774wjdzw5mhk4144jm1wdq7";
}
else throw "platform ${stdenv.hostPlatform.system} not supported!";
phases = "buildPhase";
nativeBuildInputs = [ makeWrapper ];
buildCommand = let
bin_path = "$out/bin";
pkg_path = "$out/libexec/${name}";
sed_script_1 =
"'s|^PROGDIR=`dirname $0`" +
"|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
sed_script_2 =
"'s|^MYNDKDIR=`dirname $0`" +
"|MYNDKDIR=`dirname $(readlink -f $(which $0))`|'";
runtime_paths = (lib.makeBinPath [
coreutils file findutils
gawk gnugrep gnused
jdk
which
]) + ":${platformTools}/platform-tools";
in ''
set -x
mkdir -pv $out/libexec
cd $out/libexec
tar -xjf $src
# so that it doesn't fail because of read-only permissions set
cd -
patch -p1 \
--no-backup-if-mismatch \
-d $out/libexec/${name} < ${ ./make-standalone-toolchain_r8e.patch }
cd ${pkg_path}
'' + lib.optionalString (!fullNDK) ''
# Steps to reduce output size
rm -rf docs sources tests
# We only support cross compiling with gcc for now
rm -rf toolchains/*-clang* toolchains/llvm-*
'' + ''
find ${pkg_path}/toolchains \( \
\( -type f -a -name "*.so*" \) -o \
\( -type f -a -perm -0100 \) \
\) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \
--set-rpath ${stdenv.lib.makeLibraryPath [ zlib ncurses ]} {} \;
# fix ineffective PROGDIR / MYNDKDIR determination
for i in ndk-build ndk-gdb ndk-gdb-py
do
sed -i -e ${sed_script_1} $i
done
sed -i -e ${sed_script_2} ndk-which
# a bash script
patchShebangs ndk-which
# wrap
for i in ndk-build ndk-gdb ndk-gdb-py ndk-which
do
wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
done
# make some executables available in PATH
mkdir -pv ${bin_path}
for i in \
ndk-build ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which
do
ln -sf ${pkg_path}/$i ${bin_path}/$i
done
'';
}

View File

@ -1,296 +0,0 @@
{ stdenv, stdenv_32bit, fetchurl, fetchzip, unzip, makeWrapper
, platformTools, buildTools, support, supportRepository, platforms, sysimages, addons, sources
, libX11, libXext, libXrender, libxcb, libXau, libXdmcp, libXtst, libGLU_combined, alsaLib
, freetype, fontconfig, glib, gtk2, atk, file, jdk, coreutils, libpulseaudio, dbus
, zlib, glxinfo, xkeyboardconfig
, includeSources
, licenseAccepted
}:
{ 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";
in fetchzip rec {
url = "https://dl-ssl.google.com/android/repository/google_m2repository_${version}.zip";
sha256 = "0k99xmynv0k62d301zx5jnjkddflr51i5lb02l9incg7m5cn8kzx";
};
in
stdenv.mkDerivation rec {
name = "android-sdk-${version}";
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/sdk-tools-linux-4333796.zip";
sha256 = "1yfy0qqxz1ixpsci1pizls1nrncmi8p16wcb9rimdn4q3mdfxzwj";
}
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
url = "https://dl.google.com/android/repository/sdk-tools-darwin-4333796.zip";
sha256 = "0gl5c30m40kx0vvrpbaa8cw8wq2vb89r14hgzb1df4qgpic97cpc";
}
else throw "platform not ${stdenv.hostPlatform.system} supported!";
emulator = fetchurl {
url = "https://dl.google.com/android/repository/emulator-linux-4969155.zip";
sha256 = "0iw0j6j3w9zpfalsa7xq2czz4vzgq96zk2zddjhanwwx4p8fhrfd";
};
buildCommand = ''
mkdir -p $out/libexec
cd $out/libexec
unpackFile $src
unpackFile $emulator
cd tools
for f in monitor bin/monkeyrunner bin/uiautomatorviewer
do
sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f"
done
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.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
patchelf --set-rpath ${stdenv_32bit.cc.cc.lib}/lib $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`/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") ''
cd ..
for i in emulator/emulator* emulator/qemu/linux-x86_64/qemu-system-*
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
wrapProgram `pwd`/$i \
--prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \
--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
cd tools
''}
''}
patchShebangs .
${if stdenv.hostPlatform.system == "i686-linux" then
''
# The monitor requires some more patching
cd lib/monitor-x86
patchelf --set-interpreter ${stdenv_32bit.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 ]}
cd ../..
''
else if stdenv.hostPlatform.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 ${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
cd add-ons
${if useGoogleAPIs then
stdenv.lib.concatMapStrings (platformVersion:
if (builtins.hasAttr ("google_apis_"+platformVersion) addons) then
let
googleApis = builtins.getAttr ("google_apis_"+platformVersion) addons;
in
"ln -s ${googleApis}/* addon-google_apis-${platformVersion}\n"
else "") platformVersions
else ""}
cd ..
# Symlink required extras
mkdir -p extras/android
cd extras/android
ln -s ${supportRepository}/m2repository
${if useExtraSupportLibs then
"ln -s ${addons.android_support_extra}/support ."
else ""}
cd ..
mkdir -p google
cd google
${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"}
ln -s ${googleRepository} m2repository
cd ../..
# Symlink required sources
mkdir -p sources
cd sources
${if includeSources then
stdenv.lib.concatMapStrings (platformVersion:
if (builtins.hasAttr ("source_"+platformVersion) sources) then
let
source = builtins.getAttr ("source_"+platformVersion) sources;
in
"ln -s ${source}/* android-${platformVersion}\n"
else "") platformVersions
else ""}
cd ..
# Symlink required platforms
mkdir -p platforms
cd platforms
${stdenv.lib.concatMapStrings (platformVersion:
if (builtins.hasAttr ("platform_"+platformVersion) platforms) then
let
platform = builtins.getAttr ("platform_"+platformVersion) platforms;
in
"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
let
sysimg = builtins.getAttr ("sysimg_" + abiVersion + "_" + platformVersion) sysimages;
in
''
mkdir -p android-${platformVersion}
cd android-${platformVersion}
ln -s ${sysimg}/*
cd ..
''
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/*
do
if [ ! -d $i ] && [ -x $i ]
then
ln -sf $i $out/bin/$(basename $i)
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 ]
then
ln -sf $i $out/bin/$(basename $i)
fi
done
for i in $out/libexec/build-tools/*/*
do
if [ ! -d $i ] && [ -x $i ]
then
ln -sf $i $out/bin/$(basename $i)
fi
done
for i in $out/libexec/emulator/*
do
if [ ! -d $i ] && [ -x $i ]
then
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 ];
meta = {
platforms = stdenv.lib.platforms.unix;
hydraPlatforms = [];
license = stdenv.lib.licenses.unfree;
};
}

View File

@ -1,28 +1,26 @@
{ stdenv, androidsdk, jdk, ant, androidndk, gnumake, gawk, file, which }:
args@{ name, src, platformVersions ? [ "8" ], useGoogleAPIs ? false, antFlags ? ""
{ composeAndroidPackages, stdenv, ant, jdk, gnumake, gawk }:
{ name
, release ? false, keyStore ? null, keyAlias ? null, keyStorePassword ? null, keyAliasPassword ? null
, useNDK ? false, ...
}:
, antFlags ? ""
, ...
}@args:
assert release -> keyStore != null && keyAlias != null && keyStorePassword != null && keyAliasPassword != null;
let
androidsdkComposition = androidsdk {
inherit platformVersions useGoogleAPIs;
abiVersions = [];
};
androidSdkFormalArgs = builtins.functionArgs composeAndroidPackages;
androidArgs = builtins.intersectAttrs androidSdkFormalArgs args;
androidsdk = (composeAndroidPackages androidArgs).androidsdk;
extraArgs = removeAttrs args ([ "name" ] ++ builtins.attrNames androidSdkFormalArgs);
in
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name;
ANDROID_HOME = "${androidsdkComposition}/libexec";
buildInputs = [ jdk ant ] ++
stdenv.lib.optional useNDK [ androidndk gnumake gawk file which ];
name = stdenv.lib.replaceChars [" "] [""] name; # Android APKs may contain white spaces in their names, but Nix store paths cannot
ANDROID_HOME = "${androidsdk}/libexec/android-sdk";
buildInputs = [ jdk ant ];
buildPhase = ''
${stdenv.lib.optionalString release ''
# Provide key singing attributes
( echo "key.store=${keyStore}"
echo "key.alias=${keyAlias}"
@ -32,20 +30,19 @@ stdenv.mkDerivation ({
''}
export ANDROID_SDK_HOME=`pwd` # Key files cannot be stored in the user's home directory. This overrides it.
${if useNDK then ''
export GNUMAKE=${gnumake}/bin/make
export NDK_HOST_AWK=${gawk}/bin/gawk
${androidndk}/bin/ndk-build
'' else ""}
${stdenv.lib.optionalString (args ? includeNDK && args.includeNDK) ''
export GNUMAKE=${gnumake}/bin/make
export NDK_HOST_AWK=${gawk}/bin/gawk
${androidsdk}/libexec/android-sdk/ndk-bundle/ndk-build
''}
ant ${antFlags} ${if release then "release" else "debug"}
'';
installPhase = ''
mkdir -p $out
mv bin/*-${if release then "release" else "debug"}.apk $out
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.apk)\"" > $out/nix-support/hydra-build-products
'';
} //
builtins.removeAttrs args ["name"])
} // extraArgs)

View File

@ -1,108 +0,0 @@
{ stdenv, androidsdk, jdk, androidndk, gnumake, gawk, file
, which, gradle, fetchurl, buildEnv, runCommand }:
args@{ name, src, platformVersions ? [ "8" ], useGoogleAPIs ? false
, useExtraSupportLibs ? false, useGooglePlayServices ? false
, release ? false, keyStore ? null, keyAlias ? null
, keyStorePassword ? null, keyAliasPassword ? null
, useNDK ? false, buildInputs ? [], mavenDeps, gradleTask
, buildDirectory ? "./.", acceptAndroidSdkLicenses ? false }:
assert release -> keyStore != null;
assert release -> keyAlias != null;
assert release -> keyStorePassword != null;
assert release -> keyAliasPassword != null;
assert acceptAndroidSdkLicenses;
let
inherit (stdenv.lib) optionalString;
m2install = { repo, version, artifactId, groupId
, jarSha256, pomSha256, aarSha256, suffix ? "" }:
let m2Name = "${artifactId}-${version}";
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
in runCommand m2Name {} (''
mkdir -p $out/m2/${m2Path}
'' + optionalString (jarSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.jar";
sha256 = jarSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.jar
'' + optionalString (pomSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.pom";
sha256 = pomSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.pom
'' + optionalString (aarSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.aar";
sha256 = aarSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.aar
'');
androidsdkComposition = androidsdk {
inherit platformVersions useGoogleAPIs
useExtraSupportLibs useGooglePlayServices;
abiVersions = [ "armeabi-v7a" ];
};
in
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name;
ANDROID_HOME = "${androidsdkComposition}/libexec";
ANDROID_NDK_HOME = "${androidndk}/libexec/${androidndk.name}";
buildInputs = [ jdk gradle ] ++
stdenv.lib.optional useNDK [ androidndk gnumake gawk file which ] ++
buildInputs;
DEPENDENCIES = buildEnv { name = "${name}-maven-deps";
paths = map m2install mavenDeps;
};
buildPhase = ''
${optionalString release ''
# Provide key signing attributes
( echo "RELEASE_STORE_FILE=${keyStore}"
echo "RELEASE_KEY_ALIAS=${keyAlias}"
echo "RELEASE_STORE_PASSWORD=${keyStorePassword}"
echo "RELEASE_KEY_PASSWORD=${keyAliasPassword}"
) >> gradle.properties
''}
buildDir=`pwd`
cp -r $ANDROID_HOME $buildDir/local_sdk
chmod -R 755 local_sdk
export ANDROID_HOME=$buildDir/local_sdk
# Key files cannot be stored in the user's home directory. This
# overrides it.
export ANDROID_SDK_HOME=`pwd`
mkdir -p "$ANDROID_HOME/licenses"
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
export APP_HOME=`pwd`
mkdir -p .m2/repository
if [ -d "$DEPENDENCIES/m2" ] ; then
cp -RL "$DEPENDENCIES"/m2/* .m2/repository/
fi
chmod -R 755 .m2
mkdir -p .m2/repository/com/android/support
cp -RL local_sdk/extras/android/m2repository/com/android/support/* .m2/repository/com/android/support/
cp -RL local_sdk/extras/google/m2repository/* .m2/repository/
gradle ${gradleTask} --offline --no-daemon -g ./tmp -Dmaven.repo.local=`pwd`/.m2/repository
'';
installPhase = ''
mkdir -p $out
mv ${buildDirectory}/build/outputs/apk/*.apk $out
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.apk)\"" > $out/nix-support/hydra-build-products
'';
meta = {
license = stdenv.lib.licenses.unfree;
};
} // builtins.removeAttrs args ["name" "mavenDeps"])

View File

@ -1,376 +0,0 @@
# This file is generated from generate-tools.sh. DO NOT EDIT.
# Execute generate-tools.sh or fetch.sh to update the file.
{ fetchurl }:
{
v17 = {
version = "17.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r17-linux.zip;
sha1 = "2c2872bc3806aabf16a12e3959c2183ddc866e6d";
};
};
v18_0_1 = {
version = "18.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.0.1-linux.zip;
sha1 = "f11618492b0d2270c332325d45d752d3656a9640";
};
};
v18_1_0 = {
version = "18.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.1-linux.zip;
sha1 = "f314a0599e51397f0886fe888b50dd98f2f050d8";
};
};
v18_1_1 = {
version = "18.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.1.1-linux.zip;
sha1 = "68c9acbfc0cec2d51b19efaed39831a17055d998";
};
};
v19 = {
version = "19.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19-linux.zip;
sha1 = "55c1a6cf632e7d346f0002b275ec41fd3137fd83";
};
};
v19_0_1 = {
version = "19.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.1-linux.zip;
sha1 = "18d2312dc4368858914213087f4e61445aca4517";
};
};
v19_0_2 = {
version = "19.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.2-linux.zip;
sha1 = "a03a6bdea0091aea32e1b35b90a7294c9f04e3dd";
};
};
v19_0_3 = {
version = "19.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.3-linux.zip;
sha1 = "c2d6055478e9d2d4fba476ee85f99181ddd1160c";
};
};
v19_1_0 = {
version = "19.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.1-linux.zip;
sha1 = "1ff20ac15fa47a75d00346ec12f180d531b3ca89";
};
};
v20 = {
version = "20.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r20-linux.zip;
sha1 = "b688905526a5584d1327a662d871a635ff502758";
};
};
v21 = {
version = "21.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21-linux.zip;
sha1 = "4933328fdeecbd554a29528f254f4993468e1cf4";
};
};
v21_0_1 = {
version = "21.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.0.1-linux.zip;
sha1 = "e573069eea3e5255e7a65bedeb767f4fd0a5f49a";
};
};
v21_0_2 = {
version = "21.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.0.2-linux.zip;
sha1 = "e1236ab8897b62b57414adcf04c132567b2612a5";
};
};
v21_1_0 = {
version = "21.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1-linux.zip;
sha1 = "b7455e543784d52a8925f960bc880493ed1478cb";
};
};
v21_1_1 = {
version = "21.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1.1-linux.zip;
sha1 = "1c712ee3a1ba5a8b0548f9c32f17d4a0ddfd727d";
};
};
v21_1_2 = {
version = "21.1.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1.2-linux.zip;
sha1 = "5e35259843bf2926113a38368b08458735479658";
};
};
v22 = {
version = "22.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r22-linux.zip;
sha1 = "a8a1619dd090e44fac957bce6842e62abf87965b";
};
};
v22_0_1 = {
version = "22.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r22.0.1-linux.zip;
sha1 = "da8b9c5c3ede39298e6cf0283c000c2ee9029646";
};
};
v23 = {
version = "23.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23-linux.zip;
sha1 = "c1d6209212b01469f80fa804e0c1d39a06bc9060";
};
};
v23_0_1 = {
version = "23.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.1-linux.zip;
sha1 = "b6ba7c399d5fa487d95289d8832e4ad943aed556";
};
};
v23_0_2 = {
version = "23.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.2-linux.zip;
sha1 = "8a9f2b37f6fcf7a9fa784dc21aeaeb41bbb9f2c3";
};
};
v23_0_3 = {
version = "23.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.3-linux.zip;
sha1 = "368f2600feac7e9b511b82f53d1f2240ae4a91a3";
};
};
v24 = {
version = "24.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24-linux.zip;
sha1 = "c6271c4d78a5612ea6c7150688bcd5b7313de8d1";
};
};
v24_0_1 = {
version = "24.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.1-linux.zip;
sha1 = "84f18c392919a074fcbb9b1d967984e6b2fef8b4";
};
};
v24_0_2 = {
version = "24.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.2-linux.zip;
sha1 = "f199a7a788c3fefbed102eea34d6007737b803cf";
};
};
v24_0_3 = {
version = "24.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.3-linux.zip;
sha1 = "9e8cc49d66e03fa1a8ecc1ac3e58f1324f5da304";
};
};
v25 = {
version = "25.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25-linux.zip;
sha1 = "f2bbda60403e75cabd0f238598c3b4dfca56ea44";
};
};
v25_0_1 = {
version = "25.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.1-linux.zip;
sha1 = "ff063d252ab750d339f5947d06ff782836f22bac";
};
};
v25_0_2 = {
version = "25.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.2-linux.zip;
sha1 = "ff953c0177e317618fda40516f3e9d95fd43c7ae";
};
};
v25_0_3 = {
version = "25.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.3-linux.zip;
sha1 = "db95f3a0ae376534d4d69f4cdb6fad20649f3509";
};
};
v26 = {
version = "26.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-linux.zip;
sha1 = "1cbe72929876f8a872ab1f1b1040a9f720261f59";
};
};
v26_rc1 = {
version = "26.0.0-rc1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-rc1-linux.zip;
sha1 = "8cd6388dc96db2d7a49d06159cf990d3bbc78d04";
};
};
v26_rc2 = {
version = "26.0.0-rc2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-rc2-linux.zip;
sha1 = "629bbd8d2e415bf64871fb0b4c0540fd6d0347a0";
};
};
v26_0_1 = {
version = "26.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip;
sha1 = "5378c2c78091b414d0eac40a6bd37f2faa31a365";
};
};
v26_0_2 = {
version = "26.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip;
sha1 = "5b2b7b66c7bf2151f2af183b5b50a17808850592";
};
};
v26_0_3 = {
version = "26.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.3-linux.zip;
sha1 = "8a2e6c1bcd845844523a68aa17e5442f0dce328c";
};
};
v27 = {
version = "27.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27-linux.zip;
sha1 = "28542332ba97cf4a08c3eddfcf5edd70e3cf1260";
};
};
v27_0_1 = {
version = "27.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27.0.1-linux.zip;
sha1 = "7f4eedb1077ef948b848040dcd15de9e8a759f4a";
};
};
v27_0_2 = {
version = "27.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27.0.2-linux.zip;
sha1 = "b687ddf6be84f11607871138aad32cf857d0b837";
};
};
v27_0_3 = {
version = "27.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27.0.3-linux.zip;
sha1 = "d85e7a6320eddffe7eeace3437605079dac938ca";
};
};
v28 = {
version = "28.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28-linux.zip;
sha1 = "d9f8a754d833ccd334f56fcc6089c5925cd82abb";
};
};
v28_rc1 = {
version = "28.0.0-rc1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28-rc1-linux.zip;
sha1 = "1601977fae25fd478bcfaa0481ca5ea3c609d840";
};
};
v28_rc2 = {
version = "28.0.0-rc2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28-rc2-linux.zip;
sha1 = "efe9c0dde0646a07544c864276390ca6e96b24dc";
};
};
v28_0_1 = {
version = "28.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28.0.1-linux.zip;
sha1 = "ee70dfa1fccb58b37cebc9544830511f36a137a0";
};
};
v28_0_2 = {
version = "28.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28.0.2-linux.zip;
sha1 = "b4492209810a3fd48deaa982f9852fef12433d55";
};
};
v28_0_3 = {
version = "28.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28.0.3-linux.zip;
sha1 = "ea6f2f7103cd9da9ff0bdf6e37fbbba548fa4165";
};
};
}

View File

@ -1,376 +0,0 @@
# This file is generated from generate-tools.sh. DO NOT EDIT.
# Execute generate-tools.sh or fetch.sh to update the file.
{ fetchurl }:
{
v17 = {
version = "17.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r17-macosx.zip;
sha1 = "602ee709be9dbb8f179b1e4075148a57f9419930";
};
};
v18_0_1 = {
version = "18.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.0.1-macosx.zip;
sha1 = "d84f5692fb44d60fc53e5b2507cebf9f24626902";
};
};
v18_1_0 = {
version = "18.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.1-macosx.zip;
sha1 = "16ddb299b8b43063e5bb3387ec17147c5053dfd8";
};
};
v18_1_1 = {
version = "18.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r18.1.1-macosx.zip;
sha1 = "a9d9d37f6ddf859e57abc78802a77aaa166e48d4";
};
};
v19 = {
version = "19.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19-macosx.zip;
sha1 = "86ec1c12db1bc446b7bcaefc5cc14eb361044e90";
};
};
v19_0_1 = {
version = "19.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.1-macosx.zip;
sha1 = "efaf50fb19a3edb8d03efbff76f89a249ad2920b";
};
};
v19_0_2 = {
version = "19.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.2-macosx.zip;
sha1 = "145bc43065d45f756d99d87329d899052b9a9288";
};
};
v19_0_3 = {
version = "19.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.0.3-macosx.zip;
sha1 = "651cf8754373b2d52e7f6aab2c52eabffe4e9ea4";
};
};
v19_1_0 = {
version = "19.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r19.1-macosx.zip;
sha1 = "0d11aae3417de1efb4b9a0e0a7855904a61bcec1";
};
};
v20 = {
version = "20.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r20-macosx.zip;
sha1 = "1240f629411c108a714c4ddd756937c7fab93f83";
};
};
v21 = {
version = "21.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21-macosx.zip;
sha1 = "9bef7989b51436bd4e5114d8a0330359f077cbfa";
};
};
v21_0_1 = {
version = "21.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.0.1-macosx.zip;
sha1 = "b60c8f9b810c980abafa04896706f3911be1ade7";
};
};
v21_0_2 = {
version = "21.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.0.2-macosx.zip;
sha1 = "f17471c154058f3734729ef3cc363399b1cd3de1";
};
};
v21_1_0 = {
version = "21.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1-macosx.zip;
sha1 = "df619356c2359aa5eacdd48699d15b335d9bd246";
};
};
v21_1_1 = {
version = "21.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1.1-macosx.zip;
sha1 = "836a146eab0504aa9387a5132e986fe7c7381571";
};
};
v21_1_2 = {
version = "21.1.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r21.1.2-macosx.zip;
sha1 = "e7c906b4ba0eea93b32ba36c610dbd6b204bff48";
};
};
v22 = {
version = "22.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r22-macosx.zip;
sha1 = "af95429b24088d704bc5db9bd606e34ac1b82c0d";
};
};
v22_0_1 = {
version = "22.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r22.0.1-macosx.zip;
sha1 = "53dad7f608e01d53b17176ba11165acbfccc5bbf";
};
};
v23 = {
version = "23.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23-macosx.zip;
sha1 = "90ba6e716f7703a236cd44b2e71c5ff430855a03";
};
};
v23_0_1 = {
version = "23.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.1-macosx.zip;
sha1 = "d96ec1522721e9a179ae2c591c99f75d31d39718";
};
};
v23_0_2 = {
version = "23.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.2-macosx.zip;
sha1 = "482c4cbceef8ff58aefd92d8155a38610158fdaf";
};
};
v23_0_3 = {
version = "23.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r23.0.3-macosx.zip;
sha1 = "fbc98cd303fd15a31d472de6c03bd707829f00b0";
};
};
v24 = {
version = "24.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24-macosx.zip;
sha1 = "97fc4ed442f23989cc488d02c1d1de9bdde241de";
};
};
v24_0_1 = {
version = "24.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.1-macosx.zip;
sha1 = "5c6457fcdfa07724fb086d8ff4e8316fc0742848";
};
};
v24_0_2 = {
version = "24.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.2-macosx.zip;
sha1 = "8bb8fc575477491d5957de743089df412de55cda";
};
};
v24_0_3 = {
version = "24.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r24.0.3-macosx.zip;
sha1 = "a01c15f1b105c34595681075e1895d58b3fff48c";
};
};
v25 = {
version = "25.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25-macosx.zip;
sha1 = "273c5c29a65cbed00e44f3aa470bbd7dce556606";
};
};
v25_0_1 = {
version = "25.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.1-macosx.zip;
sha1 = "7bf7f22d7d48ef20b6ab0e3d7a2912e5c088340f";
};
};
v25_0_2 = {
version = "25.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.2-macosx.zip;
sha1 = "12a5204bb3b6e39437535469fde7ddf42da46b16";
};
};
v25_0_3 = {
version = "25.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r25.0.3-macosx.zip;
sha1 = "160d2fefb5ce68e443427fc30a793a703b63e26e";
};
};
v26 = {
version = "26.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-macosx.zip;
sha1 = "d01a1aeca03747245f1f5936b3cb01759c66d086";
};
};
v26_rc1 = {
version = "26.0.0-rc1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-rc1-macosx.zip;
sha1 = "5c5a1de7d5f4f000d36ae349229fe0be846d6137";
};
};
v26_rc2 = {
version = "26.0.0-rc2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26-rc2-macosx.zip;
sha1 = "cb1eb738a1f7003025af267a9b8cc2d259533c70";
};
};
v26_0_1 = {
version = "26.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.1-macosx.zip;
sha1 = "cbde59de198916b390777dd0227921bfa2120832";
};
};
v26_0_2 = {
version = "26.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.2-macosx.zip;
sha1 = "d9ed7c7f149ce38be5dc08979aea8acec1459ca0";
};
};
v26_0_3 = {
version = "26.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r26.0.3-macosx.zip;
sha1 = "5bb90ed935d99e5bc90686f43b852e68c5ad40df";
};
};
v27 = {
version = "27.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27-macosx.zip;
sha1 = "fb4e8d7e6b8d29a77090e34024077a80458d5ae1";
};
};
v27_0_1 = {
version = "27.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27.0.1-macosx.zip;
sha1 = "1edd07bfdbadd95652d093040e16d858f7489594";
};
};
v27_0_2 = {
version = "27.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27.0.2-macosx.zip;
sha1 = "6d5d9cf2a47877f273f4b742b19e712a051a31be";
};
};
v27_0_3 = {
version = "27.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r27.0.3-macosx.zip;
sha1 = "61d9fb18790c68d66ff73bf1e7ad56bc1f1eef2d";
};
};
v28 = {
version = "28.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28-macosx.zip;
sha1 = "72088d32d1d82cc3c2cf7cf6618b6130c0c84ade";
};
};
v28_rc1 = {
version = "28.0.0-rc1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28-rc1-macosx.zip;
sha1 = "2c77821967a2330b7b227072d0b1c02ef19fe2fc";
};
};
v28_rc2 = {
version = "28.0.0-rc2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28-rc2-macosx.zip;
sha1 = "0d0314b353589feb10e528b44c5a685b6658d797";
};
};
v28_0_1 = {
version = "28.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28.0.1-macosx.zip;
sha1 = "aeef42ad953f1630dd6f5d71eefdc0b825211462";
};
};
v28_0_2 = {
version = "28.0.2";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28.0.2-macosx.zip;
sha1 = "c10dd5a7825578622fb362a8a34f76eb3ba0c0a9";
};
};
v28_0_3 = {
version = "28.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/build-tools_r28.0.3-macosx.zip;
sha1 = "f8c333a2991b1ab05a671bc6248b78e00edcd83a";
};
};
}

View File

@ -1,53 +1,19 @@
{stdenv, lib, stdenv_32bit, fetchurl, unzip, zlib_32bit, ncurses_32bit, file, zlib, ncurses, coreutils, buildToolsSources}:
{deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgs_i686}:
let buildBuildTools = name: { version, src }:
stdenv.mkDerivation rec {
inherit version src;
name = "android-build-tools-r${version}";
buildCommand = ''
mkdir -p $out/build-tools
cd $out/build-tools
unzip $src
mv android-* ${version}
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook makeWrapper ] ++
lib.optional (os == "linux") [ pkgs.glibc pkgs.zlib pkgs.ncurses5 pkgs_i686.glibc pkgs_i686.zlib pkgs_i686.ncurses5 ];
patchInstructions = ''
${lib.optionalString (os == "linux") ''
addAutoPatchelfSearchPath $packageBaseDir/lib
addAutoPatchelfSearchPath $packageBaseDir/lib64
autoPatchelf --no-recurse $packageBaseDir/lib64
autoPatchelf --no-recurse $packageBaseDir
''}
cd ${version}
for f in $(grep -Rl /bin/ls .); do
sed -i -e "s|/bin/ls|${coreutils}/bin/ls|" "$f"
done
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
''
ln -s ${ncurses.out}/lib/libncurses.so.5 `pwd`/lib64/libtinfo.so.5
find . -type f -print0 | while IFS= read -r -d "" file
do
type=$(file "$file")
## Patch 64-bit binaries
if grep -q "ELF 64-bit" <<< "$type"
then
if grep -q "interpreter" <<< "$type"
then
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 "$file"
fi
patchelf --set-rpath `pwd`/lib64:${stdenv.cc.cc.lib.out}/lib:${zlib.out}/lib:${ncurses.out}/lib "$file"
## Patch 32-bit binaries
elif grep -q "ELF 32-bit" <<< "$type"
then
if grep -q "interpreter" <<< "$type"
then
patchelf --set-interpreter ${stdenv_32bit.cc.libc.out}/lib/ld-linux.so.2 "$file"
fi
patchelf --set-rpath ${stdenv_32bit.cc.cc.lib.out}/lib:${zlib_32bit.out}/lib:${ncurses_32bit.out}/lib "$file"
fi
done
''}
patchShebangs .
'';
buildInputs = [ unzip file ];
};
in
lib.mapAttrs buildBuildTools buildToolsSources
wrapProgram $PWD/mainDexClasses \
--prefix PATH : ${pkgs.jdk8}/bin
'';
noAuditTmpdir = true; # The checker script gets confused by the build-tools path that is incorrectly identified as a reference to /build
}

View File

@ -0,0 +1,10 @@
{deployAndroidPackage, lib, package, os, autoPatchelfHook, pkgs}:
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook ]
++ lib.optional (os == "linux") [ pkgs.stdenv.glibc pkgs.stdenv.cc.cc ];
patchInstructions = lib.optionalString (os == "linux") ''
autoPatchelf $packageBaseDir/bin
'';
}

View File

@ -0,0 +1,262 @@
{stdenv, fetchurl, requireFile, makeWrapper, unzip, autoPatchelfHook, pkgs, pkgs_i686, licenseAccepted ? false}:
{ toolsVersion ? "25.2.5"
, platformToolsVersion ? "28.0.1"
, buildToolsVersions ? [ "28.0.3" ]
, includeEmulator ? false
, emulatorVersion ? "28.0.14"
, platformVersions ? []
, includeSources ? false
, includeDocs ? false
, includeSystemImages ? false
, systemImageTypes ? [ "default" ]
, abiVersions ? [ "armeabi-v7a" ]
, lldbVersions ? [ ]
, cmakeVersions ? [ ]
, includeNDK ? false
, ndkVersion ? "18.1.5063045"
, useGoogleAPIs ? false
, useGoogleTVAddOns ? false
, includeExtras ? []
}:
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 (pkgs) stdenv fetchurl makeWrapper unzip;
# Determine the Android os identifier from Nix's system identifier
os = if stdenv.system == "x86_64-linux" then "linux"
else if stdenv.system == "x86_64-darwin" then "macosx"
else "No tarballs found for system architecture: ${stdenv.system}";
# Generated Nix packages
packages = import ./generated/packages.nix {
inherit fetchurl;
};
# Generated system images
system-images-packages-android = import ./generated/system-images-android.nix {
inherit fetchurl;
};
system-images-packages-android-tv = import ./generated/system-images-android-tv.nix {
inherit fetchurl;
};
system-images-packages-android-wear = import ./generated/system-images-android-wear.nix {
inherit fetchurl;
};
system-images-packages-android-wear-cn = import ./generated/system-images-android-wear-cn.nix {
inherit fetchurl;
};
system-images-packages-google_apis = import ./generated/system-images-google_apis.nix {
inherit fetchurl;
};
system-images-packages-google_apis_playstore = import ./generated/system-images-google_apis_playstore.nix {
inherit fetchurl;
};
system-images-packages =
stdenv.lib.recursiveUpdate
system-images-packages-android
(stdenv.lib.recursiveUpdate system-images-packages-android-tv
(stdenv.lib.recursiveUpdate system-images-packages-android-wear
(stdenv.lib.recursiveUpdate system-images-packages-android-wear-cn
(stdenv.lib.recursiveUpdate system-images-packages-google_apis system-images-packages-google_apis_playstore))));
# Generated addons
addons = import ./generated/addons.nix {
inherit fetchurl;
};
in
rec {
deployAndroidPackage = import ./deploy-androidpackage.nix {
inherit stdenv unzip;
};
platform-tools = import ./platform-tools.nix {
inherit deployAndroidPackage os autoPatchelfHook pkgs;
inherit (stdenv) lib;
package = packages.platform-tools."${platformToolsVersion}";
};
build-tools = map (version:
import ./build-tools.nix {
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgs_i686;
inherit (stdenv) lib;
package = packages.build-tools."${version}";
}
) buildToolsVersions;
docs = deployAndroidPackage {
inherit os;
package = packages.docs."1";
};
emulator = import ./emulator.nix {
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs pkgs_i686;
inherit (stdenv) lib;
package = packages.emulator."${emulatorVersion}"."${os}";
};
platforms = map (version:
deployAndroidPackage {
inherit os;
package = packages.platforms."${version}";
}
) platformVersions;
sources = map (version:
deployAndroidPackage {
inherit os;
package = packages.sources."${version}";
}
) platformVersions;
system-images = stdenv.lib.flatten (map (apiVersion:
map (type:
map (abiVersion:
deployAndroidPackage {
inherit os;
package = system-images-packages.${apiVersion}.${type}.${abiVersion};
}
) abiVersions
) systemImageTypes
) platformVersions);
lldb = map (version:
import ./lldb.nix {
inherit deployAndroidPackage os autoPatchelfHook pkgs;
inherit (stdenv) lib;
package = packages.lldb."${version}";
}
) lldbVersions;
cmake = map (version:
import ./cmake.nix {
inherit deployAndroidPackage os autoPatchelfHook pkgs;
inherit (stdenv) lib;
package = packages.cmake."${version}";
}
) cmakeVersions;
ndk-bundle = import ./ndk-bundle {
inherit deployAndroidPackage os autoPatchelfHook makeWrapper pkgs platform-tools;
inherit (stdenv) lib;
package = packages.ndk-bundle."${ndkVersion}";
};
google-apis = map (version:
deployAndroidPackage {
inherit os;
package = addons.addons."${version}".google_apis;
}
) (builtins.filter (platformVersion: platformVersion < "26") platformVersions); # API level 26 and higher include Google APIs by default
google-tv-addons = map (version:
deployAndroidPackage {
inherit os;
package = addons.addons."${version}".google_tv_addon;
}
) platformVersions;
# Function that automatically links all plugins for which multiple versions can coexist
linkPlugins = {name, plugins}:
stdenv.lib.optionalString (plugins != []) ''
mkdir -p ${name}
${stdenv.lib.concatMapStrings (plugin: ''
ln -s ${plugin}/libexec/android-sdk/${name}/* ${name}
'') plugins}
'';
# Function that automatically links a plugin for which only one version exists
linkPlugin = {name, plugin, check ? true}:
stdenv.lib.optionalString check ''
ln -s ${plugin}/libexec/android-sdk/* ${name}
'';
# Links all plugins related to a requested platform
linkPlatformPlugins = {name, plugins, check}:
stdenv.lib.optionalString check ''
mkdir -p ${name}
${stdenv.lib.concatMapStrings (plugin: ''
ln -s ${plugin}/libexec/android-sdk/${name}/* ${name}
'') plugins}
''; # */
# This derivation deploys the tools package and symlinks all the desired
# plugins that we want to use.
androidsdk = import ./tools.nix {
inherit deployAndroidPackage requireFile packages toolsVersion autoPatchelfHook makeWrapper os pkgs pkgs_i686;
inherit (stdenv) lib;
postInstall = ''
# Symlink all requested plugins
${linkPlugin { name = "platform-tools"; plugin = platform-tools; }}
${linkPlugins { name = "build-tools"; plugins = build-tools; }}
${linkPlugin { name = "emulator"; plugin = emulator; check = includeEmulator; }}
${linkPlugin { name = "docs"; plugin = docs; check = includeDocs; }}
${linkPlugins { name = "platforms"; plugins = platforms; }}
${linkPlatformPlugins { name = "sources"; plugins = sources; check = includeSources; }}
${linkPlugins { name = "lldb"; plugins = lldb; }}
${linkPlugins { name = "cmake"; plugins = cmake; }}
${linkPlugin { name = "ndk-bundle"; plugin = ndk-bundle; check = includeNDK; }}
${stdenv.lib.optionalString includeSystemImages ''
mkdir -p system-images
${stdenv.lib.concatMapStrings (system-image: ''
apiVersion=$(basename $(echo ${system-image}/libexec/android-sdk/system-images/*))
type=$(basename $(echo ${system-image}/libexec/android-sdk/system-images/*/*))
mkdir -p system-images/$apiVersion/$type
ln -s ${system-image}/libexec/android-sdk/system-images/$apiVersion/$type/* system-images/$apiVersion/$type
'') system-images}
''}
${linkPlatformPlugins { name = "add-ons"; plugins = google-apis; check = useGoogleAPIs; }}
${linkPlatformPlugins { name = "add-ons"; plugins = google-apis; check = useGoogleTVAddOns; }}
# Link extras
${stdenv.lib.concatMapStrings (identifier:
let
path = addons.extras."${identifier}".path;
addon = deployAndroidPackage {
inherit os;
package = addons.extras."${identifier}";
};
in
''
targetDir=$(dirname ${path})
mkdir -p $targetDir
ln -s ${addon}/libexec/android-sdk/${path} $targetDir
'') includeExtras}
# Expose common executables in bin/
mkdir -p $out/bin
find $PWD/tools -not -path '*/\.*' -type f -executable -mindepth 1 -maxdepth 1 | while read i
do
ln -s $i $out/bin
done
find $PWD/tools/bin -not -path '*/\.*' -type f -executable -mindepth 1 -maxdepth 1 | while read i
do
ln -s $i $out/bin
done
for i in ${platform-tools}/bin/*
do
ln -s $i $out/bin
done
'';
};
}

View File

@ -0,0 +1,128 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:addon="http://schemas.android.com/sdk/android/repo/addon2/01"
xmlns:sdk="http://schemas.android.com/repository/android/common/01"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output omit-xml-declaration="yes" indent="no" />
<!-- Template that puts a google HTTP prefix in front of relative URLs -->
<xsl:template name="repository-url">
<xsl:variable name="raw-url" select="complete/url"/>
<xsl:choose>
<xsl:when test="starts-with($raw-url, 'http')">
<xsl:value-of select="$raw-url"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>https://dl.google.com/android/repository/</xsl:text>
<xsl:value-of select="$raw-url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/addon:sdk-addon">
{fetchurl}:
{
addons = {
<!-- Convert all addons, but skip the entry for google APIs version 25 because it is inconsistent with the spec -->
<xsl:for-each select="remotePackage[type-details/@xsi:type='addon:addonDetailsType' and archives/archive/complete/url != 'google_apis-25_r1.zip' ]"><xsl:sort select="@path" />
"<xsl:value-of select="type-details/api-level" />"."<xsl:value-of select="type-details/tag/id" />" = {
name = "<xsl:value-of select="type-details/tag/id" />";
path = "<xsl:value-of select="translate(@path, ';', '/')" />";
revision = "<xsl:value-of select="type-details/api-level" />";
displayName = "<xsl:value-of select="display-name" />";
archives = {
<xsl:for-each select="archives/archive[not(host-os)]">
all = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
<xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]">
<xsl:value-of select="host-os" /> = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
};
};
</xsl:for-each>
<!-- Workaround to make google APIs version 25 work. Hopefully, we can get rid of this at some point -->
<xsl:for-each select="remotePackage[type-details/@xsi:type='addon:addonDetailsType' and archives/archive/complete/url = 'google_apis-25_r1.zip' ]">
"<xsl:value-of select="25" />"."<xsl:value-of select="type-details/tag/id" />" = {
name = "<xsl:value-of select="type-details/tag/id" />";
path = "add-ons/addon-google_apis-google-25";
revision = "<xsl:value-of select="25" />";
displayName = "<xsl:value-of select="display-name" />";
archives = {
<xsl:for-each select="archives/archive[not(host-os)]">
all = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
<xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]">
<xsl:value-of select="host-os" /> = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
};
};
</xsl:for-each>
};
extras = {
<!-- Convert all extras and maven artefacts -->
<xsl:for-each select="remotePackage[type-details/@xsi:type='addon:extraDetailsType' or type-details/@xsi:type='addon:mavenType']"><xsl:sort select="@path" />
<!-- Compose revision string from revision attributes -->
<xsl:variable name="revision">
<xsl:choose>
<xsl:when test="revision/major">
<xsl:value-of select="revision/major" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="revision/minor">.<xsl:value-of select="revision/minor" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="revision/micro">.<xsl:value-of select="revision/micro" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="revision/preview">-rc<xsl:value-of select="revision/preview" />
</xsl:when>
</xsl:choose>
</xsl:variable>
"<xsl:value-of select="@path" />" = {
name = "<xsl:value-of select="translate(@path, ';', '-')" />";
path = "<xsl:value-of select="translate(@path, ';', '/')" />";
revision = "<xsl:value-of select="$revision" />";
displayName = "<xsl:value-of select="display-name" />";
archives = {
<xsl:for-each select="archives/archive[not(host-os)]">
all = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
<xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]">
<xsl:value-of select="host-os" /> = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
};
};
</xsl:for-each>
};
}
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,116 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:common="http://schemas.android.com/repository/android/common/01"
xmlns:generic="http://schemas.android.com/repository/android/generic/01"
xmlns:sdk="http://schemas.android.com/sdk/android/repo/repository2/01"
xmlns:sdk-common="http://schemas.android.com/sdk/android/repo/common/01"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output omit-xml-declaration="yes" indent="no" />
<!-- Template that puts a google HTTP prefix in front of relative URLs -->
<xsl:template name="repository-url">
<xsl:variable name="raw-url" select="complete/url"/>
<xsl:choose>
<xsl:when test="starts-with($raw-url, 'http')">
<xsl:value-of select="$raw-url"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>https://dl.google.com/android/repository/</xsl:text>
<xsl:value-of select="$raw-url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/sdk:sdk-repository">
{fetchurl}:
{
<!-- Convert all remote packages -->
<xsl:for-each select="remotePackage"><xsl:sort select="@path" />
<!-- Extract the package name from the path -->
<xsl:variable name="name">
<xsl:choose>
<xsl:when test="contains(@path, ';')">
<xsl:value-of select="substring-before(@path, ';')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@path" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Compose version string from version attributes -->
<xsl:variable name="revision">
<xsl:choose>
<!-- Compose revision for a generic package from the revision attributes -->
<xsl:when test="type-details/@xsi:type='generic:genericDetailsType'">
<xsl:choose>
<xsl:when test="revision/major">
<xsl:value-of select="revision/major" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="revision/minor">.<xsl:value-of select="revision/minor" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="revision/micro">.<xsl:value-of select="revision/micro" />
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="revision/preview">-rc<xsl:value-of select="revision/preview" />
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- Compose revision of a platform SDK from the API-level or codename if the latter exists -->
<xsl:when test="type-details/@xsi:type='sdk:platformDetailsType'">
<xsl:choose>
<xsl:when test="not(type-details/codename='')">
<xsl:value-of select="type-details/codename" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="type-details/api-level" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Compose revision of a source SDK from the API-level -->
<xsl:when test="type-details/@xsi:type='sdk:sourceDetailsType'">
<xsl:value-of select="type-details/api-level" />
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="@path='emulator'"> <!-- An emulator package provides one archive per operating system but the same versions -->
"<xsl:value-of select="$name" />"."<xsl:value-of select="$revision" />".<xsl:value-of select="archives/archive/host-os" /> = {
</xsl:when>
<xsl:otherwise>
"<xsl:value-of select="$name" />"."<xsl:value-of select="$revision" />" = {
</xsl:otherwise>
</xsl:choose>
name = "<xsl:value-of select="$name" />";
path = "<xsl:value-of select="translate(@path, ';', '/')" />";
revision = "<xsl:value-of select="$revision" />";
displayName = "<xsl:value-of select="display-name" />";
archives = {
<xsl:for-each select="archives/archive[not(host-os)]">
all = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
<xsl:for-each select="archives/archive[host-os and not(host-os = 'windows')]">
<xsl:value-of select="host-os" /> = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
};
</xsl:for-each>
};
};
</xsl:for-each>
}
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,47 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sys-img="http://schemas.android.com/sdk/android/repo/sys-img2/01"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:param name="imageType" />
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:template name="repository-url">
<xsl:variable name="raw-url" select="complete/url"/>
<xsl:choose>
<xsl:when test="starts-with($raw-url, 'http')">
<xsl:value-of select="$raw-url"/>
</xsl:when>
<xsl:otherwise>
https://dl.google.com/android/repository/sys-img/<xsl:value-of select="$imageType" />/<xsl:value-of select="$raw-url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/sys-img:sdk-sys-img">
{fetchurl}:
{
<xsl:for-each select="remotePackage[starts-with(@path, 'system-images;')]">
<xsl:variable name="revision">
<xsl:value-of select="type-details/api-level" />-<xsl:value-of select="type-details/tag/id" />-<xsl:value-of select="type-details/abi" />
</xsl:variable>
"<xsl:value-of select="type-details/api-level" />".<xsl:value-of select="type-details/tag/id" />."<xsl:value-of select="type-details/abi" />" = {
name = "system-image-<xsl:value-of select="$revision" />";
path = "<xsl:value-of select="translate(@path, ';', '/')" />";
revision = "<xsl:value-of select="$revision" />";
displayName = "<xsl:value-of select="display-name" />";
archives.all = fetchurl {
<xsl:for-each select="archives/archive">
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="complete/checksum" />";
</xsl:for-each>
};
};
</xsl:for-each>
}
</xsl:template>
</xsl:stylesheet>

View File

@ -1,380 +1,26 @@
{ buildPackages, pkgs, pkgs_i686, targetPackages
, includeSources ? true, licenseAccepted ? false
{ pkgs ? import <nixpkgs> {}
, pkgs_i686 ? import <nixpkgs> { system = "i686-linux"; }
, licenseAccepted ? false
}:
# TODO: use callPackage instead of import to avoid so many inherits
rec {
platformTools = import ./platform-tools.nix {
inherit buildPackages pkgs;
};
buildToolsSources = let
system = pkgs.stdenv.hostPlatform.system;
path = if (system == "i686-linux" || system == "x86_64-linux")
then ./build-tools-srcs-linux.nix
else if system == "x86_64-darwin"
then ./build-tools-srcs-macosx.nix
else throw "System: ${system} not supported!";
in
import path { inherit (pkgs) fetchurl; };
buildTools = import ./build-tools.nix {
inherit (pkgs) stdenv lib fetchurl unzip zlib file coreutils;
inherit buildToolsSources;
stdenv_32bit = pkgs_i686.stdenv;
zlib_32bit = pkgs_i686.zlib;
ncurses_32bit = pkgs_i686.ncurses5;
ncurses = pkgs.ncurses5;
};
support = import ./support.nix {
inherit (pkgs) stdenv fetchurl unzip;
};
supportRepository = import ./support-repository.nix {
inherit (pkgs) stdenv fetchurl unzip;
};
platforms = if (pkgs.stdenv.hostPlatform.system == "i686-linux" || pkgs.stdenv.hostPlatform.system == "x86_64-linux")
then import ./platforms-linux.nix {
inherit (pkgs) stdenv fetchurl unzip;
}
else if pkgs.stdenv.hostPlatform.system == "x86_64-darwin"
then import ./platforms-macosx.nix {
inherit (pkgs) stdenv fetchurl unzip;
}
else throw "Platform: ${pkgs.stdenv.hostPlatform.system} not supported!";
sysimages = import ./sysimages.nix {
inherit (pkgs) stdenv fetchurl unzip;
};
addons = import ./addons.nix {
inherit (pkgs) stdenv fetchurl unzip;
};
sources = import ./sources.nix {
inherit (pkgs) stdenv fetchurl unzip;
};
androidsdk = import ./androidsdk.nix {
inherit (pkgs) stdenv fetchurl unzip makeWrapper zlib
glxinfo freetype fontconfig glib gtk2 atk
libGLU_combined file alsaLib jdk coreutils
libpulseaudio dbus fetchzip;
inherit (pkgs.xorg) libX11 libXext libXrender
libxcb libXau libXdmcp libXtst xkeyboardconfig;
inherit platformTools buildTools support
supportRepository platforms sysimages
addons sources includeSources licenseAccepted;
stdenv_32bit = pkgs_i686.stdenv;
};
androidsdk_2_1 = androidsdk {
platformVersions = [ "7" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_2_2 = androidsdk {
platformVersions = [ "8" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_2_3_3 = androidsdk {
platformVersions = [ "10" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_3_0 = androidsdk {
platformVersions = [ "11" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_3_1 = androidsdk {
platformVersions = [ "12" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_3_2 = androidsdk {
platformVersions = [ "13" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_4_0 = androidsdk {
platformVersions = [ "14" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_4_0_3 = androidsdk {
platformVersions = [ "15" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_4_1 = androidsdk {
platformVersions = [ "16" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_4_2 = androidsdk {
platformVersions = [ "17" ];
abiVersions = [ "armeabi-v7a" ];
useGoogleAPIs = true;
};
androidsdk_4_3 = androidsdk {
platformVersions = [ "18" ];
abiVersions = [ "armeabi-v7a" "x86" ];
useGoogleAPIs = true;
};
androidsdk_4_4 = androidsdk {
platformVersions = [ "19" ];
abiVersions = [ "armeabi-v7a" "x86" ];
useGoogleAPIs = true;
};
androidsdk_5_0_1 = androidsdk {
platformVersions = [ "21" ];
abiVersions = [ "armeabi-v7a" "x86" ];
useGoogleAPIs = true;
};
androidsdk_5_0_1_extras = androidsdk {
platformVersions = [ "21" ];
abiVersions = [ "armeabi-v7a" "x86" ];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
};
androidsdk_5_1_1 = androidsdk {
platformVersions = [ "22" ];
abiVersions = [ "armeabi-v7a" "x86" "x86_64"];
useGoogleAPIs = true;
};
androidsdk_5_1_1_extras = androidsdk {
platformVersions = [ "22" ];
abiVersions = [ "armeabi-v7a" "x86" "x86_64"];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
};
androidsdk_6_0 = androidsdk {
platformVersions = [ "23" ];
abiVersions = [ "armeabi-v7a" "x86" "x86_64"];
useGoogleAPIs = true;
};
androidsdk_6_0_extras = androidsdk {
platformVersions = [ "23" ];
abiVersions = [ "armeabi-v7a" "x86" "x86_64"];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
useInstantApps = true;
};
androidsdk_7_0 = androidsdk {
platformVersions = [ "24" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
};
androidsdk_7_0_extras = androidsdk {
platformVersions = [ "24" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
useInstantApps = true;
};
androidsdk_7_1_1 = androidsdk {
platformVersions = [ "25" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
};
androidsdk_7_1_1_extras = androidsdk {
platformVersions = [ "25" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
useInstantApps = true;
};
androidsdk_8_0 = androidsdk {
platformVersions = [ "26" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
};
androidsdk_8_0_extras = androidsdk {
platformVersions = [ "26" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
useInstantApps = true;
};
androidsdk_8_1 = androidsdk {
platformVersions = [ "27" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
};
androidsdk_8_1_extras = androidsdk {
platformVersions = [ "27" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
useInstantApps = true;
};
androidsdk_9_0 = androidsdk {
platformVersions = [ "28" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
};
androidsdk_9_0_extras = androidsdk {
platformVersions = [ "28" ];
abiVersions = [ "x86" "x86_64"];
useGoogleAPIs = true;
useExtraSupportLibs = true;
useGooglePlayServices = true;
useInstantApps = true;
};
androidsdk_latest = androidsdk_9_0;
androidndk_10e = pkgs.callPackage ./androidndk.nix {
inherit (buildPackages)
unzip makeWrapper;
inherit (pkgs)
stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools;
version = "10e";
sha1s = {
x86_64-darwin = "6be8598e4ed3d9dd42998c8cb666f0ee502b1294";
x86_64-linux = "f692681b007071103277f6edc6f91cb5c5494a32";
};
};
androidndk_16b = pkgs.callPackage ./androidndk.nix {
inherit (buildPackages)
unzip makeWrapper;
inherit (pkgs)
stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools;
version = "16b";
sha1s = {
x86_64-darwin = "e51e615449b98c716cf912057e2682e75d55e2de";
x86_64-linux = "42aa43aae89a50d1c66c3f9fdecd676936da6128";
};
};
androidndk_17c = pkgs.callPackage ./androidndk.nix {
inherit (buildPackages)
unzip makeWrapper;
inherit (pkgs)
stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools;
version = "17c";
sha1s = {
x86_64-darwin = "f97e3d7711497e3b4faf9e7b3fa0f0da90bb649c";
x86_64-linux = "12cacc70c3fd2f40574015631c00f41fb8a39048";
};
};
androidndk_18b = pkgs.callPackage ./androidndk.nix {
inherit (buildPackages)
unzip makeWrapper;
inherit (pkgs)
stdenv fetchurl zlib ncurses5 lib python3 libcxx
coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools;
version = "18b";
sha1s = {
x86_64-darwin = "98cb9909aa8c2dab32db188bbdc3ac6207e09440";
x86_64-linux = "500679655da3a86aecf67007e8ab230ea9b4dd7b";
};
};
androidndk = androidndk_18b;
androidndk_r8e = import ./androidndk_r8e.nix {
inherit (buildPackages)
makeWrapper;
inherit (pkgs)
stdenv fetchurl zlib ncurses lib
coreutils file findutils gawk gnugrep gnused jdk which;
inherit platformTools;
composeAndroidPackages = import ./compose-android-packages.nix {
inherit (pkgs) stdenv fetchurl requireFile makeWrapper unzip autoPatchelfHook;
inherit pkgs pkgs_i686 licenseAccepted;
};
buildApp = import ./build-app.nix {
inherit (pkgs) stdenv jdk ant gnumake gawk file which;
inherit androidsdk androidndk;
inherit (pkgs) stdenv jdk ant gnumake gawk;
inherit composeAndroidPackages;
};
emulateApp = import ./emulate-app.nix {
inherit (pkgs) stdenv;
inherit androidsdk;
inherit composeAndroidPackages;
};
androidndkPkgs_17c = import ./androidndk-pkgs.nix {
inherit (buildPackages)
makeWrapper;
inherit (pkgs)
lib stdenv
runCommand wrapBintoolsWith wrapCCWith;
# buildPackages.foo rather than buildPackages.buildPackages.foo would work,
# but for splicing messing up on infinite recursion for the variants we
# *dont't* use. Using this workaround, but also making a test to ensure
# these two really are the same.
buildAndroidndk = buildPackages.buildPackages.androidenv.androidndk_17c;
androidndk = androidndk_17c;
targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs_17c;
};
androidndkPkgs = androidndkPkgs_17c;
androidndkPkgs_10e = import ./androidndk-pkgs.nix {
inherit (buildPackages)
makeWrapper;
inherit (pkgs)
lib stdenv
runCommand wrapBintoolsWith wrapCCWith;
# buildPackages.foo rather than buildPackages.buildPackages.foo would work,
# but for splicing messing up on infinite recursion for the variants we
# *dont't* use. Using this workaround, but also making a test to ensure
# these two really are the same.
buildAndroidndk = buildPackages.buildPackages.androidenv.androidndk_10e;
androidndk = androidndk_10e;
targetAndroidndkPkgs = targetPackages.androidenv.androidndkPkgs_10e;
};
buildGradleApp = import ./build-gradle-app.nix {
inherit (pkgs) stdenv jdk gnumake gawk file runCommand
which gradle fetchurl buildEnv;
inherit androidsdk androidndk;
androidPkgs_9_0 = composeAndroidPackages {
platformVersions = [ "28" ];
abiVersions = [ "x86" "x86_64"];
};
}

View File

@ -0,0 +1,44 @@
{stdenv, unzip}:
{package, os ? null, buildInputs ? [], patchInstructions ? "", meta ? {}, ...}@args:
let
extraParams = removeAttrs args [ "package" "os" "buildInputs" "patchInstructions" ];
in
stdenv.mkDerivation ({
name = package.name + "-" + package.revision;
src = if os != null && builtins.hasAttr os package.archives then package.archives.${os} else package.archives.all;
buildInputs = [ unzip ] ++ buildInputs;
# Most Android Zip packages have a root folder, but some don't. We unpack
# the zip file in a folder and we try to discover whether it has a single root
# folder. If this is the case, we adjust the current working folder.
unpackPhase = ''
mkdir extractedzip
cd extractedzip
unpackFile "$src"
if [ "$(find . -mindepth 1 -maxdepth 1 -type d | wc -l)" -eq 1 ]
then
cd "$(find . -mindepth 1 -maxdepth 1 -type d)"
fi
sourceRoot="$PWD"
'';
installPhase = ''
packageBaseDir=$out/libexec/android-sdk/${package.path}
mkdir -p $packageBaseDir
cd $packageBaseDir
cp -av $sourceRoot/* .
${patchInstructions}
'';
# We never attempt to strip. This is not required since we're doing binary
# deployments. Moreover, some executables that have been patched with patchelf
# may not work any longer after they have been stripped.
dontStrip = true;
dontPatchELF = true;
dontAutoPatchelf = true;
meta = {
description = package.displayName;
} // meta;
} // extraParams)

View File

@ -1,33 +1,41 @@
{stdenv, androidsdk}:
{ composeAndroidPackages, stdenv }:
{ name, app ? null
, platformVersion ? "8", abiVersion ? "armeabi-v7a", useGoogleAPIs ? false
, platformVersion ? "16", abiVersion ? "armeabi-v7a", systemImageType ? "default", useGoogleAPIs ? false
, enableGPU ? false, extraAVDFiles ? []
, package ? null, activity ? null
, avdHomeDir ? null
}:
}@args:
let
androidsdkComposition = androidsdk {
inherit useGoogleAPIs;
androidSdkArgNames = builtins.attrNames (builtins.functionArgs composeAndroidPackages);
extraParams = removeAttrs args ([ "name" ] ++ androidSdkArgNames);
# Extract the parameters meant for the Android SDK
androidParams = {
platformVersions = [ platformVersion ];
includeEmulator = true;
includeSystemImages = true;
systemImageTypes = [ systemImageType ];
abiVersions = [ abiVersion ];
};
androidsdkComposition = (composeAndroidPackages androidParams).androidsdk;
in
stdenv.mkDerivation {
inherit name;
buildCommand = ''
mkdir -p $out/bin
cat > $out/bin/run-test-emulator << "EOF"
#! ${stdenv.shell} -e
# We need a TMPDIR
if [ "$TMPDIR" = "" ]
then
export TMPDIR=/tmp
fi
${if avdHomeDir == null then ''
# Store the virtual devices somewhere else, instead of polluting a user's HOME directory
export ANDROID_SDK_HOME=$(mktemp -d $TMPDIR/nix-android-vm-XXXX)
@ -35,20 +43,23 @@ stdenv.mkDerivation {
mkdir -p "${avdHomeDir}"
export ANDROID_SDK_HOME="${avdHomeDir}"
''}
# We need to specify the location of the Android SDK root folder
export ANDROID_SDK_ROOT=${androidsdkComposition}/libexec/android-sdk
# We have to look for a free TCP port
echo "Looking for a free TCP port in range 5554-5584" >&2
for i in $(seq 5554 2 5584)
do
if [ -z "$(${androidsdkComposition}/libexec/platform-tools/adb devices | grep emulator-$i)" ]
if [ -z "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb devices | grep emulator-$i)" ]
then
port=$i
break
fi
done
if [ -z "$port" ]
then
echo "Unfortunately, the emulator port space is exhausted!" >&2
@ -56,57 +67,57 @@ stdenv.mkDerivation {
else
echo "We have a free TCP port: $port" >&2
fi
export ANDROID_SERIAL="emulator-$port"
# Create a virtual android device for testing if it does not exists
if [ "$(${androidsdkComposition}/libexec/tools/android list avd | grep 'Name: device')" = "" ]
${androidsdkComposition}/libexec/android-sdk/tools/android list targets
if [ "$(${androidsdkComposition}/libexec/android-sdk/tools/android list avd | grep 'Name: device')" = "" ]
then
# Create a virtual android device
yes "" | ${androidsdkComposition}/libexec/tools/android create avd -n device -t ${if useGoogleAPIs then "'Google Inc.:Google APIs:"+platformVersion+"'" else "android-"+platformVersion} $NIX_ANDROID_AVD_FLAGS
yes "" | ${androidsdkComposition}/libexec/android-sdk/tools/android create avd -n device -t 1 --abi ${systemImageType}/${abiVersion} $NIX_ANDROID_AVD_FLAGS
${stdenv.lib.optionalString enableGPU ''
# Enable GPU acceleration
echo "hw.gpu.enabled=yes" >> $ANDROID_SDK_HOME/.android/avd/device.avd/config.ini
''}
${stdenv.lib.concatMapStrings (extraAVDFile: ''
ln -sf ${extraAVDFile} $ANDROID_SDK_HOME/.android/avd/device.avd
'') extraAVDFiles}
fi
# Launch the emulator
${androidsdkComposition}/libexec/tools/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
${androidsdkComposition}/libexec/android-sdk/emulator/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
# Wait until the device has completely booted
echo "Waiting until the emulator has booted the device and the package manager is ready..." >&2
${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port wait-for-device
${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port wait-for-device
echo "Device state has been reached" >&2
while [ -z "$(${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
while [ -z "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
do
sleep 5
done
echo "dev.bootcomplete property is 1" >&2
#while [ -z "$(${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
#while [ -z "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
#do
#sleep 5
#done
#echo "sys.boot_completed property is 1" >&2
echo "ready" >&2
${stdenv.lib.optionalString (app != null) ''
# Install the App through the debugger, if it has not been installed yet
if [ -z "${package}" ] || [ "$(${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port shell pm list packages | grep package:${package})" = "" ]
if [ -z "${package}" ] || [ "$(${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell pm list packages | grep package:${package})" = "" ]
then
if [ -d "${app}" ]
then
@ -114,13 +125,13 @@ stdenv.mkDerivation {
else
appPath="${app}"
fi
${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port install "$appPath"
${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port install "$appPath"
fi
# Start the application
${stdenv.lib.optionalString (package != null && activity != null) ''
${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
${androidsdkComposition}/libexec/android-sdk/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
''}
''}
EOF

View File

@ -0,0 +1,20 @@
{deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, pkgs_i686}:
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook makeWrapper ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.xlibs.libX11 pkgs.xlibs.libXext pkgs.xlibs.libXdamage pkgs.xlibs.libXfixes pkgs.xlibs.libxcb pkgs.libGL pkgs.libpulseaudio pkgs.zlib pkgs.ncurses5 pkgs.stdenv.cc.cc pkgs_i686.glibc ];
patchInstructions = lib.optionalString (os == "linux") ''
addAutoPatchelfSearchPath $packageBaseDir/lib
addAutoPatchelfSearchPath $packageBaseDir/lib64
addAutoPatchelfSearchPath $packageBaseDir/lib64/qt/lib
autoPatchelf $out
# Wrap emulator so that it can load libdbus-1.so at runtime and it no longer complains about XKB keymaps
wrapProgram $out/libexec/android-sdk/emulator/emulator \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ pkgs.dbus ]} \
--set QT_XKB_CONFIG_ROOT ${pkgs.xkeyboard_config}/share/X11/xkb \
--set QTCOMPOSE ${pkgs.xorg.libX11.out}/share/X11/locale
'';
dontMoveLib64 = true;
}

View File

@ -1,14 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash --pure -p curl libxslt
# we skip the intel addons, as they are Windows+osX only
# we skip the default sys-img (arm?) because it is empty
curl -o repository-11.xml https://dl.google.com/android/repository/repository-11.xml
curl -o addon.xml https://dl.google.com/android/repository/addon.xml
curl -o sys-img.xml https://dl.google.com/android/repository/sys-img/android/sys-img.xml
./generate-addons.sh
./generate-platforms.sh
./generate-sysimages.sh
./generate-sources.sh
./generate-tools.sh

View File

@ -1,3 +0,0 @@
#!/bin/sh -e
xsltproc generate-addons.xsl addon.xml > addons.nix

View File

@ -1,82 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sdk="http://schemas.android.com/sdk/android/addon/7">
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:template match="/sdk:sdk-addon">
# This file is generated from generate-addons.sh. DO NOT EDIT.
# Execute generate-addons.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildGoogleApis = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
<xsl:for-each select="sdk:add-on[sdk:name-id='google_apis']"><xsl:sort select="sdk:api-level" data-type="number"/><xsl:sort select="sdk:revision" data-type="number"/>
google_apis_<xsl:value-of select="sdk:api-level" /> = buildGoogleApis {
name = "<xsl:value-of select="sdk:name-id" />-<xsl:value-of select="sdk:api-level" />";
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 = "<xsl:value-of select="sdk:description" />";
<xsl:for-each select="sdk:desc-url"> url = <xsl:value-of select="." />;</xsl:for-each>
};
};
</xsl:for-each>
<xsl:for-each select="sdk:extra[sdk:path='support']">
android_support_extra = buildGoogleApis {
name = "android_support_extra";
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 Support Library";
url = http://developer.android.com/;
};
};
</xsl:for-each><xsl:for-each select="sdk:extra[sdk:path='google_play_services']">
google_play_services = buildGoogleApis {
name = "google_play_services";
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 = "Google Play services client library and sample code";
url = http://developer.android.com/;
};
};
</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>
</xsl:stylesheet>

View File

@ -1,4 +0,0 @@
#!/bin/sh -e
xsltproc --stringparam os linux generate-platforms.xsl repository-11.xml > platforms-linux.nix
xsltproc --stringparam os macosx generate-platforms.xsl repository-11.xml > platforms-macosx.nix

View File

@ -1,54 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sdk="http://schemas.android.com/sdk/android/repository/11">
<xsl:param name="os" />
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:template name="repository-url">
<xsl:variable name="raw-url" select="sdk:archives/sdk:archive[sdk:host-os=$os or count(sdk:host-os) = 0]/sdk:url"/>
<xsl:choose>
<xsl:when test="starts-with($raw-url, 'http')">
<xsl:value-of select="$raw-url"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>https://dl.google.com/android/repository/</xsl:text>
<xsl:value-of select="$raw-url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/sdk:sdk-repository">
# This file is generated from generate-platforms.sh. DO NOT EDIT.
# Execute generate-platforms.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildPlatform = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
<xsl:for-each select="sdk:platform"><xsl:sort select="sdk:api-level" data-type="number"/>
platform_<xsl:value-of select="sdk:api-level" /> = buildPlatform {
name = "android-platform-<xsl:value-of select="sdk:version" />";
src = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="sdk:archives/sdk:archive[sdk:host-os=$os or count(sdk:host-os) = 0]/sdk:checksum[@type='sha1']" />";
};
meta = {
description = "<xsl:value-of select="sdk:description" />";
<xsl:for-each select="sdk:desc-url"> homepage = <xsl:value-of select="." />;</xsl:for-each>
};
};
</xsl:for-each>
}
</xsl:template>
</xsl:stylesheet>

View File

@ -1,3 +0,0 @@
#!/bin/sh -e
xsltproc generate-sources.xsl repository-11.xml > sources.nix

View File

@ -1,52 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sdk="http://schemas.android.com/sdk/android/repository/11">
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:template name="repository-url">
<xsl:variable name="raw-url" select="sdk:archives/sdk:archive/sdk:url"/>
<xsl:choose>
<xsl:when test="starts-with($raw-url, 'http')">
<xsl:value-of select="$raw-url"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>https://dl.google.com/android/repository/</xsl:text>
<xsl:value-of select="$raw-url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/sdk:sdk-repository">
# This file is generated from generate-sources.sh. DO NOT EDIT.
# Execute generate-sources.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildSource = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
<xsl:for-each select="sdk:source"><xsl:sort select="sdk:api-level" data-type="number"/>
source_<xsl:value-of select="sdk:api-level" /> = buildSource {
name = "android-source-<xsl:value-of select="sdk:api-level" />";
src = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="sdk:archives/sdk:archive/sdk:checksum[@type='sha1']" />";
};
meta = {
description = "Source code for Android API <xsl:value-of select="sdk:api-level" />";
};
};
</xsl:for-each>
}
</xsl:template>
</xsl:stylesheet>

View File

@ -1,26 +0,0 @@
#!/bin/sh -e
cat > sysimages.nix << "EOF"
# This file is generated from generate-sysimages.sh. DO NOT EDIT.
# Execute generate-sysimages.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildSystemImage = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
EOF
xsltproc generate-sysimages.xsl sys-img.xml >> sysimages.nix
cat >> sysimages.nix << "EOF"
}
EOF

View File

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
xmlns:sdk="http://schemas.android.com/sdk/android/sys-img/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:template match="/sdk:sdk-sys-img">
<xsl:for-each select="sdk:system-image"><xsl:sort select="sdk:api-level" data-type="number"/><xsl:sort select="sdk:abi"/>
sysimg_<xsl:value-of select="sdk:abi" />_<xsl:value-of select="sdk:api-level" /> = buildSystemImage {
name = "sysimg-<xsl:value-of select="sdk:abi" />-<xsl:value-of select="sdk:api-level" />";
src = fetchurl {
url = <xsl:if test="not(starts-with(sdk:archives/sdk:archive/sdk:url, 'https://'))">https://dl.google.com/android/repository/sys-img/android/</xsl:if><xsl:value-of select="sdk:archives/sdk:archive/sdk:url" />;
sha1 = "<xsl:value-of select="sdk:archives/sdk:archive/sdk:checksum[@type='sha1']" />";
};
};
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,4 +0,0 @@
#!/bin/sh -e
xsltproc --stringparam os linux generate-tools.xsl repository-11.xml > build-tools-srcs-linux.nix
xsltproc --stringparam os macosx generate-tools.xsl repository-11.xml > build-tools-srcs-macosx.nix

View File

@ -1,43 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sdk="http://schemas.android.com/sdk/android/repository/11">
<xsl:param name="os" />
<xsl:output omit-xml-declaration="yes" indent="no" />
<xsl:template name="repository-url">
<xsl:variable name="raw-url" select="sdk:archives/sdk:archive[sdk:host-os=$os or count(sdk:host-os) = 0]/sdk:url"/>
<xsl:choose>
<xsl:when test="starts-with($raw-url, 'http')">
<xsl:value-of select="$raw-url"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>https://dl.google.com/android/repository/</xsl:text>
<xsl:value-of select="$raw-url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/sdk:sdk-repository">
# This file is generated from generate-tools.sh. DO NOT EDIT.
# Execute generate-tools.sh or fetch.sh to update the file.
{ fetchurl }:
{
<xsl:for-each select="sdk:build-tool">
<xsl:sort select="sdk:revision/sdk:major" data-type="number"/>
<xsl:sort select="sdk:revision/sdk:minor" data-type="number"/>
<xsl:sort select="sdk:revision/sdk:micro" data-type="number"/>
<xsl:sort select="sdk:revision/sdk:preview" data-type="number"/>
v<xsl:value-of select="sdk:revision/sdk:major"/><xsl:if test="sdk:revision/sdk:minor + sdk:revision/sdk:micro > 0">_<xsl:value-of select="sdk:revision/sdk:minor" />_<xsl:value-of select="sdk:revision/sdk:micro"/></xsl:if><xsl:if test="sdk:revision/sdk:preview > 0">_rc<xsl:value-of select="sdk:revision/sdk:preview"/></xsl:if> = {
version = "<xsl:value-of select="sdk:revision/sdk:major"/>.<xsl:value-of select="sdk:revision/sdk:minor" />.<xsl:value-of select="sdk:revision/sdk:micro"/><xsl:if test="sdk:revision/sdk:preview > 0">-rc<xsl:value-of select="sdk:revision/sdk:preview"/></xsl:if>";
src = fetchurl {
url = <xsl:call-template name="repository-url"/>;
sha1 = "<xsl:value-of select="sdk:archives/sdk:archive[sdk:host-os=$os or count(sdk:host-os) = 0]/sdk:checksum[@type='sha1']" />";
};
};
</xsl:for-each>
}
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,16 @@
#!/bin/sh -e
# Convert base packages
curl https://dl.google.com/android/repository/repository2-1.xml -o xml/repository2-1.xml
xsltproc convertpackages.xsl xml/repository2-1.xml > generated/packages.nix
# Convert system images
for img in android android-tv android-wear android-wear-cn google_apis google_apis_playstore
do
curl https://dl.google.com/android/repository/sys-img/$img/sys-img2-1.xml -o xml/$img-sys-img2-1.xml
xsltproc --stringparam imageType $img convertsystemimages.xsl xml/$img-sys-img2-1.xml > generated/system-images-$img.nix
done
# Convert system addons
curl https://dl.google.com/android/repository/addon2-1.xml -o xml/addon2-1.xml
xsltproc convertaddons.xsl xml/addon2-1.xml > generated/addons.nix

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,157 @@
{fetchurl}:
{
"21".android-tv."x86" = {
name = "system-image-21-android-tv-x86";
path = "system-images/android-21/android-tv/x86";
revision = "21-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-21_r03.zip;
sha1 = "2f8a1988188d6abfd6c6395baeb4471a034dc1e8";
};
};
"21".android-tv."armeabi-v7a" = {
name = "system-image-21-android-tv-armeabi-v7a";
path = "system-images/android-21/android-tv/armeabi-v7a";
revision = "21-android-tv-armeabi-v7a";
displayName = "Android TV ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/armeabi-v7a-21_r03.zip;
sha1 = "b63e28a47f11b639dd94981a458b7abfa89ac331";
};
};
"22".android-tv."x86" = {
name = "system-image-22-android-tv-x86";
path = "system-images/android-22/android-tv/x86";
revision = "22-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-22_r03.zip;
sha1 = "c78efd5a155622eb490be9d326f5783993375c35";
};
};
"23".android-tv."x86" = {
name = "system-image-23-android-tv-x86";
path = "system-images/android-23/android-tv/x86";
revision = "23-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-23_r17.zip;
sha1 = "6d42eb8f07e1c49c000e530fdb7de894144ea19b";
};
};
"23".android-tv."armeabi-v7a" = {
name = "system-image-23-android-tv-armeabi-v7a";
path = "system-images/android-23/android-tv/armeabi-v7a";
revision = "23-android-tv-armeabi-v7a";
displayName = "Android TV ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/armeabi-v7a-23_r12.zip;
sha1 = "bd84678ae8caf71d584f5210e866b2807e7b4b52";
};
};
"24".android-tv."x86" = {
name = "system-image-24-android-tv-x86";
path = "system-images/android-24/android-tv/x86";
revision = "24-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-24_r19.zip;
sha1 = "478e7073f9fcd588bcce89946aa632fbf302ac6a";
};
};
"25".android-tv."x86" = {
name = "system-image-25-android-tv-x86";
path = "system-images/android-25/android-tv/x86";
revision = "25-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-25_r13.zip;
sha1 = "fda1743a87331b43b1ff35cd70f3276ae0b1836d";
};
};
"26".android-tv."x86" = {
name = "system-image-26-android-tv-x86";
path = "system-images/android-26/android-tv/x86";
revision = "26-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-26_r11.zip;
sha1 = "5c4b0b3c0b9d04a3364956a7ba31d30c33ea57e7";
};
};
"27".android-tv."x86" = {
name = "system-image-27-android-tv-x86";
path = "system-images/android-27/android-tv/x86";
revision = "27-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-27_r06.zip;
sha1 = "6b69f1e95a3db3d973e19a95ab5da1adc7750d54";
};
};
"28".android-tv."x86" = {
name = "system-image-28-android-tv-x86";
path = "system-images/android-28/android-tv/x86";
revision = "28-android-tv-x86";
displayName = "Android TV Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-tv/x86-28_r07.zip;
sha1 = "3ed7e51036957cf350db7fa128cb485b61cbd061";
};
};
}

View File

@ -0,0 +1,67 @@
{fetchurl}:
{
"25".android-wear."armeabi-v7a" = {
name = "system-image-25-android-wear-armeabi-v7a";
path = "system-images/android-25/android-wear-cn/armeabi-v7a";
revision = "25-android-wear-armeabi-v7a";
displayName = "China version of Android Wear ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear-cn/armeabi-v7a-25_r04.zip;
sha1 = "02d7bc86df054d1e89fe5856b3af1d2c142cab41";
};
};
"25".android-wear."x86" = {
name = "system-image-25-android-wear-x86";
path = "system-images/android-25/android-wear-cn/x86";
revision = "25-android-wear-x86";
displayName = "China version of Android Wear Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear-cn/x86-25_r04.zip;
sha1 = "73eab14c7cf2f6941e1fee61e0038ead7a2c7f4d";
};
};
"26".android-wear."x86" = {
name = "system-image-26-android-wear-x86";
path = "system-images/android-26/android-wear-cn/x86";
revision = "26-android-wear-x86";
displayName = "China version of Android Wear Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear-cn/x86-26_r04.zip;
sha1 = "fdc8a313f889a2d6522de1fbc00ee9e13547d096";
};
};
"28".android-wear."x86" = {
name = "system-image-28-android-wear-x86";
path = "system-images/android-P/android-wear-cn/x86";
revision = "28-android-wear-x86";
displayName = "China version of Wear OS Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear-cn/x86-P_r02.zip;
sha1 = "a61a2e453a11f77ab15b3e0bf1e017e0bb9d1bcc";
};
};
}

View File

@ -0,0 +1,97 @@
{fetchurl}:
{
"23".android-wear."armeabi-v7a" = {
name = "system-image-23-android-wear-armeabi-v7a";
path = "system-images/android-23/android-wear/armeabi-v7a";
revision = "23-android-wear-armeabi-v7a";
displayName = "Android Wear ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear/armeabi-v7a-23_r06.zip;
sha1 = "0df5d34b1cdaaaa3805a2f06bb889901eabe2e71";
};
};
"23".android-wear."x86" = {
name = "system-image-23-android-wear-x86";
path = "system-images/android-23/android-wear/x86";
revision = "23-android-wear-x86";
displayName = "Android Wear Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear/x86-23_r06.zip;
sha1 = "3b15c123f3f71459d5b60c1714d49c5d90a5525e";
};
};
"25".android-wear."armeabi-v7a" = {
name = "system-image-25-android-wear-armeabi-v7a";
path = "system-images/android-25/android-wear/armeabi-v7a";
revision = "25-android-wear-armeabi-v7a";
displayName = "Android Wear ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear/armeabi-v7a-25_r03.zip;
sha1 = "76d3568a4e08023047af7d13025a35c9bf1d7e5c";
};
};
"25".android-wear."x86" = {
name = "system-image-25-android-wear-x86";
path = "system-images/android-25/android-wear/x86";
revision = "25-android-wear-x86";
displayName = "Android Wear Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear/x86-25_r03.zip;
sha1 = "693fce7b487a65491a4e88e9f740959688c9dbe6";
};
};
"26".android-wear."x86" = {
name = "system-image-26-android-wear-x86";
path = "system-images/android-26/android-wear/x86";
revision = "26-android-wear-x86";
displayName = "Android Wear Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear/x86-26_r04.zip;
sha1 = "fbffa91b936ca18fcc1e0bab2b52a8b0835cbb1c";
};
};
"28".android-wear."x86" = {
name = "system-image-28-android-wear-x86";
path = "system-images/android-P/android-wear/x86";
revision = "28-android-wear-x86";
displayName = "Wear OS Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android-wear/x86-P_r02.zip;
sha1 = "cd0d3a56e114dbb0a2a77d58942d344db464b514";
};
};
}

View File

@ -0,0 +1,547 @@
{fetchurl}:
{
"10".default."armeabi-v7a" = {
name = "system-image-10-default-armeabi-v7a";
path = "system-images/android-10/default/armeabi-v7a";
revision = "10-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armv7-10_r04.zip;
sha1 = "54680383118eb5c95a11e1cc2a14aa572c86ee69";
};
};
"14".default."armeabi-v7a" = {
name = "system-image-14-default-armeabi-v7a";
path = "system-images/android-14/default/armeabi-v7a";
revision = "14-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-14_r02.zip;
sha1 = "d8991b0c06b18d7d6ed4169d67460ee1add6661b";
};
};
"15".default."armeabi-v7a" = {
name = "system-image-15-default-armeabi-v7a";
path = "system-images/android-15/default/armeabi-v7a";
revision = "15-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-15_r04.zip;
sha1 = "363223bd62f5afc0b2bd760b54ce9d26b31eacf1";
};
};
"16".default."armeabi-v7a" = {
name = "system-image-16-default-armeabi-v7a";
path = "system-images/android-16/default/armeabi-v7a";
revision = "16-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-16_r04.zip;
sha1 = "39c093ea755098f0ee79f607be7df9e54ba4943f";
};
};
"17".default."armeabi-v7a" = {
name = "system-image-17-default-armeabi-v7a";
path = "system-images/android-17/default/armeabi-v7a";
revision = "17-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-17_r05.zip;
sha1 = "7460e8110f4a87f9644f1bdb5511a66872d50fd9";
};
};
"18".default."armeabi-v7a" = {
name = "system-image-18-default-armeabi-v7a";
path = "system-images/android-18/default/armeabi-v7a";
revision = "18-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-18_r04.zip;
sha1 = "0bf34ecf4ddd53f6b1b7fe7dfa12f2887c17e642";
};
};
"19".default."armeabi-v7a" = {
name = "system-image-19-default-armeabi-v7a";
path = "system-images/android-19/default/armeabi-v7a";
revision = "19-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-19_r05.zip;
sha1 = "d1a5fd4f2e1c013c3d3d9bfe7e9db908c3ed56fa";
};
};
"21".default."armeabi-v7a" = {
name = "system-image-21-default-armeabi-v7a";
path = "system-images/android-21/default/armeabi-v7a";
revision = "21-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-21_r04.zip;
sha1 = "8c606f81306564b65e41303d2603e4c42ded0d10";
};
};
"22".default."armeabi-v7a" = {
name = "system-image-22-default-armeabi-v7a";
path = "system-images/android-22/default/armeabi-v7a";
revision = "22-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-22_r02.zip;
sha1 = "2114ec015dbf3a16cbcb4f63e8a84a1b206a07a1";
};
};
"23".default."armeabi-v7a" = {
name = "system-image-23-default-armeabi-v7a";
path = "system-images/android-23/default/armeabi-v7a";
revision = "23-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-23_r06.zip;
sha1 = "7cf2ad756e54a3acfd81064b63cb0cb9dff2798d";
};
};
"24".default."armeabi-v7a" = {
name = "system-image-24-default-armeabi-v7a";
path = "system-images/android-24/default/armeabi-v7a";
revision = "24-default-armeabi-v7a";
displayName = "ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-24_r07.zip;
sha1 = "3454546b4eed2d6c3dd06d47757d6da9f4176033";
};
};
"24".default."arm64-v8a" = {
name = "system-image-24-default-arm64-v8a";
path = "system-images/android-24/default/arm64-v8a";
revision = "24-default-arm64-v8a";
displayName = "ARM 64 v8a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/arm64-v8a-24_r07.zip;
sha1 = "e8ab2e49e4efe4b064232b33b5eeaded61437d7f";
};
};
"16".default."mips" = {
name = "system-image-16-default-mips";
path = "system-images/android-16/default/mips";
revision = "16-default-mips";
displayName = "MIPS System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/sysimg_mips-16_r04.zip;
sha1 = "67943c54fb3943943ffeb05fdd39c0b753681f6e";
};
};
"17".default."mips" = {
name = "system-image-17-default-mips";
path = "system-images/android-17/default/mips";
revision = "17-default-mips";
displayName = "MIPS System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/sysimg_mips-17_r01.zip;
sha1 = "f0c6e153bd584c29e51b5c9723cfbf30f996a05d";
};
};
"10".default."x86" = {
name = "system-image-10-default-x86";
path = "system-images/android-10/default/x86";
revision = "10-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-10_r04.zip;
sha1 = "655ffc5cc89dd45a3aca154b254009016e473aeb";
};
};
"15".default."x86" = {
name = "system-image-15-default-x86";
path = "system-images/android-15/default/x86";
revision = "15-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-15_r04.zip;
sha1 = "e45c728b64881c0e86529a8f7ea9c103a3cd14c1";
};
};
"16".default."x86" = {
name = "system-image-16-default-x86";
path = "system-images/android-16/default/x86";
revision = "16-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-16_r06.zip;
sha1 = "bf1bf8c5591346118d2235da1ad20e7be8a3e9cd";
};
};
"17".default."x86" = {
name = "system-image-17-default-x86";
path = "system-images/android-17/default/x86";
revision = "17-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-17_r04.zip;
sha1 = "03c6d022ab2dcbbcf655d78ba5ccb0431cadcaec";
};
};
"18".default."x86" = {
name = "system-image-18-default-x86";
path = "system-images/android-18/default/x86";
revision = "18-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-18_r03.zip;
sha1 = "03a0cb23465c3de15215934a1dbc9715b56e9458";
};
};
"19".default."x86" = {
name = "system-image-19-default-x86";
path = "system-images/android-19/default/x86";
revision = "19-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-19_r06.zip;
sha1 = "2ac82153aae97f7eae4c5a0761224fe04321d03d";
};
};
"21".default."x86" = {
name = "system-image-21-default-x86";
path = "system-images/android-21/default/x86";
revision = "21-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-21_r05.zip;
sha1 = "00f0eb0a1003efe3316347f762e20a85d8749cff";
};
};
"22".default."x86" = {
name = "system-image-22-default-x86";
path = "system-images/android-22/default/x86";
revision = "22-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-22_r06.zip;
sha1 = "e33e2a6cc3f1cc56b2019dbef3917d2eeb26f54e";
};
};
"23".default."x86" = {
name = "system-image-23-default-x86";
path = "system-images/android-23/default/x86";
revision = "23-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-23_r10.zip;
sha1 = "f6c3e3dd7bd951454795aa75c3a145fd05ac25bb";
};
};
"24".default."x86" = {
name = "system-image-24-default-x86";
path = "system-images/android-24/default/x86";
revision = "24-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-24_r08.zip;
sha1 = "c1cae7634b0216c0b5990f2c144eb8ca948e3511";
};
};
"25".default."x86" = {
name = "system-image-25-default-x86";
path = "system-images/android-25/default/x86";
revision = "25-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-25_r01.zip;
sha1 = "78ce7eb1387d598685633b9f7cbb300c3d3aeb5f";
};
};
"26".default."x86" = {
name = "system-image-26-default-x86";
path = "system-images/android-26/default/x86";
revision = "26-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-26_r01.zip;
sha1 = "e613d6e0da668e30daf547f3c6627a6352846f90";
};
};
"27".default."x86" = {
name = "system-image-27-default-x86";
path = "system-images/android-27/default/x86";
revision = "27-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-27_r01.zip;
sha1 = "4ec990fac7b62958decd12e18a4cd389dfe7c582";
};
};
"28".default."x86" = {
name = "system-image-28-default-x86";
path = "system-images/android-28/default/x86";
revision = "28-default-x86";
displayName = "Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86-28_r04.zip;
sha1 = "ce03c42d80c0fc6dc47f6455dbee7aa275d02780";
};
};
"21".default."x86_64" = {
name = "system-image-21-default-x86_64";
path = "system-images/android-21/default/x86_64";
revision = "21-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-21_r05.zip;
sha1 = "9078a095825a69e5e215713f0866c83cef65a342";
};
};
"22".default."x86_64" = {
name = "system-image-22-default-x86_64";
path = "system-images/android-22/default/x86_64";
revision = "22-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-22_r06.zip;
sha1 = "5db3b27f78cd9c4c5092b1cad5a5dd479fb5b2e4";
};
};
"23".default."x86_64" = {
name = "system-image-23-default-x86_64";
path = "system-images/android-23/default/x86_64";
revision = "23-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-23_r10.zip;
sha1 = "7cbc291483ca07dc67b71268c5f08a5755f50f51";
};
};
"24".default."x86_64" = {
name = "system-image-24-default-x86_64";
path = "system-images/android-24/default/x86_64";
revision = "24-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-24_r08.zip;
sha1 = "f6559e1949a5879f31a9662f4f0e50ad60181684";
};
};
"25".default."x86_64" = {
name = "system-image-25-default-x86_64";
path = "system-images/android-25/default/x86_64";
revision = "25-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-25_r01.zip;
sha1 = "7093d7b39216020226ff430a3b7b81c94d31ad37";
};
};
"26".default."x86_64" = {
name = "system-image-26-default-x86_64";
path = "system-images/android-26/default/x86_64";
revision = "26-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-26_r01.zip;
sha1 = "432f149c048bffce7f9de526ec65b336daf7a0a3";
};
};
"27".default."x86_64" = {
name = "system-image-27-default-x86_64";
path = "system-images/android-27/default/x86_64";
revision = "27-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-27_r01.zip;
sha1 = "2878261011a59ca3de29dc5b457a495fdb268d60";
};
};
"28".default."x86_64" = {
name = "system-image-28-default-x86_64";
path = "system-images/android-28/default/x86_64";
revision = "28-default-x86_64";
displayName = "Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/android/x86_64-28_r04.zip;
sha1 = "d47a85c8f4e9fd57df97814ad8884eeb0f3a0ef0";
};
};
}

View File

@ -0,0 +1,502 @@
{fetchurl}:
{
"10".google_apis."armeabi-v7a" = {
name = "system-image-10-google_apis-armeabi-v7a";
path = "system-images/android-10/google_apis/armeabi-v7a";
revision = "10-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-10_r05.zip;
sha1 = "cb60221d4ff6686ae96560970d48d9aa60e80b3f";
};
};
"10".google_apis."x86" = {
name = "system-image-10-google_apis-x86";
path = "system-images/android-10/google_apis/x86";
revision = "10-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-10_r05.zip;
sha1 = "b8e8a4ab26890c4a395fb796bf9cb7ceb51c880e";
};
};
"15".google_apis."armeabi-v7a" = {
name = "system-image-15-google_apis-armeabi-v7a";
path = "system-images/android-15/google_apis/armeabi-v7a";
revision = "15-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-15_r05.zip;
sha1 = "1ec4e6f9014fcbe694511280f5b497aaf7dd750f";
};
};
"15".google_apis."x86" = {
name = "system-image-15-google_apis-x86";
path = "system-images/android-15/google_apis/x86";
revision = "15-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-15_r05.zip;
sha1 = "f2b98baaf847ff5b82b82fdc6c396b229067307b";
};
};
"16".google_apis."x86" = {
name = "system-image-16-google_apis-x86";
path = "system-images/android-16/google_apis/x86";
revision = "16-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-16_r05.zip;
sha1 = "7edc5c0836fa32f8d453788c002ca0ee1bc5a0a2";
};
};
"17".google_apis."armeabi-v7a" = {
name = "system-image-17-google_apis-armeabi-v7a";
path = "system-images/android-17/google_apis/armeabi-v7a";
revision = "17-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-17_r05.zip;
sha1 = "c990f2a81c24a61f9f1da5d5d205f2924ce548ae";
};
};
"17".google_apis."x86" = {
name = "system-image-17-google_apis-x86";
path = "system-images/android-17/google_apis/x86";
revision = "17-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-17_r06.zip;
sha1 = "7864c34faf0402b8923d8c6e609a5339f74cc8d6";
};
};
"18".google_apis."armeabi-v7a" = {
name = "system-image-18-google_apis-armeabi-v7a";
path = "system-images/android-18/google_apis/armeabi-v7a";
revision = "18-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-18_r05.zip;
sha1 = "c4e69a96d4584f7e311e358fe4ad0e5d1bf1605b";
};
};
"18".google_apis."x86" = {
name = "system-image-18-google_apis-x86";
path = "system-images/android-18/google_apis/x86";
revision = "18-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-18_r05.zip;
sha1 = "2b34741693eba9419cb6bf1a467596783234d37a";
};
};
"19".google_apis."x86" = {
name = "system-image-19-google_apis-x86";
path = "system-images/android-19/google_apis/x86";
revision = "19-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-19_r37.zip;
sha1 = "f02473420a166b3df7821d8ae5a623524058b4b8";
};
};
"19".google_apis."armeabi-v7a" = {
name = "system-image-19-google_apis-armeabi-v7a";
path = "system-images/android-19/google_apis/armeabi-v7a";
revision = "19-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-19_r37.zip;
sha1 = "b388072493ed010fe2ddf607c8c4239f54ce1a0b";
};
};
"21".google_apis."x86" = {
name = "system-image-21-google_apis-x86";
path = "system-images/android-21/google_apis/x86";
revision = "21-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-21_r29.zip;
sha1 = "1f5ac49e0ae603b0bfeda0c94cd7e0b850b9b50e";
};
};
"21".google_apis."x86_64" = {
name = "system-image-21-google_apis-x86_64";
path = "system-images/android-21/google_apis/x86_64";
revision = "21-google_apis-x86_64";
displayName = "Google APIs Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-21_r29.zip;
sha1 = "74ac387aec286fcee01259dcccd4762cbdb4b517";
};
};
"21".google_apis."armeabi-v7a" = {
name = "system-image-21-google_apis-armeabi-v7a";
path = "system-images/android-21/google_apis/armeabi-v7a";
revision = "21-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-21_r29.zip;
sha1 = "1d0c428ac7f5eb49c7389ad0beb09f07cb989b45";
};
};
"22".google_apis."x86" = {
name = "system-image-22-google_apis-x86";
path = "system-images/android-22/google_apis/x86";
revision = "22-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-22_r23.zip;
sha1 = "4ceda9ffd69d5b827a8cc2f56ccac62e72982b33";
};
};
"22".google_apis."armeabi-v7a" = {
name = "system-image-22-google_apis-armeabi-v7a";
path = "system-images/android-22/google_apis/armeabi-v7a";
revision = "22-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-22_r23.zip;
sha1 = "0a11bdffa6132303baf87e4a531987a74d5f0792";
};
};
"22".google_apis."x86_64" = {
name = "system-image-22-google_apis-x86_64";
path = "system-images/android-22/google_apis/x86_64";
revision = "22-google_apis-x86_64";
displayName = "Google APIs Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-22_r23.zip;
sha1 = "1dfee1c382574c18e3aa2bc2047793169f3ab125";
};
};
"23".google_apis."x86" = {
name = "system-image-23-google_apis-x86";
path = "system-images/android-23/google_apis/x86";
revision = "23-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-23_r30.zip;
sha1 = "1b8fd61e7e7c76d8c05a41b19370edfb015ed240";
};
};
"23".google_apis."x86_64" = {
name = "system-image-23-google_apis-x86_64";
path = "system-images/android-23/google_apis/x86_64";
revision = "23-google_apis-x86_64";
displayName = "Google APIs Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-23_r30.zip;
sha1 = "69a17c23c4e05e81a2820fe49884807fcebba546";
};
};
"23".google_apis."armeabi-v7a" = {
name = "system-image-23-google_apis-armeabi-v7a";
path = "system-images/android-23/google_apis/armeabi-v7a";
revision = "23-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-23_r30.zip;
sha1 = "c3966e3a25623a915902d879f90f6d9253dbb619";
};
};
"24".google_apis."x86" = {
name = "system-image-24-google_apis-x86";
path = "system-images/android-24/google_apis/x86";
revision = "24-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-24_r24.zip;
sha1 = "7a1adb4aa13946830763644d014fc9c6cc1f921d";
};
};
"24".google_apis."x86_64" = {
name = "system-image-24-google_apis-x86_64";
path = "system-images/android-24/google_apis/x86_64";
revision = "24-google_apis-x86_64";
displayName = "Google APIs Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-24_r24.zip;
sha1 = "53b26e8868c7cd27dda31c71ee2bcf999d6b9ce2";
};
};
"24".google_apis."armeabi-v7a" = {
name = "system-image-24-google_apis-armeabi-v7a";
path = "system-images/android-24/google_apis/armeabi-v7a";
revision = "24-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-24_r24.zip;
sha1 = "85068d55673bbf9417db8d70107ceed0952b5a28";
};
};
"24".google_apis."arm64-v8a" = {
name = "system-image-24-google_apis-arm64-v8a";
path = "system-images/android-24/google_apis/arm64-v8a";
revision = "24-google_apis-arm64-v8a";
displayName = "Google APIs ARM 64 v8a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/arm64-v8a-24_r24.zip;
sha1 = "93ab33d90fcdbb30ca2e927cd3eea447e933dfd9";
};
};
"25".google_apis."x86" = {
name = "system-image-25-google_apis-x86";
path = "system-images/android-25/google_apis/x86";
revision = "25-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-25_r15.zip;
sha1 = "5948473077341265a0b21a53a7e0afc2f980187c";
};
};
"25".google_apis."x86_64" = {
name = "system-image-25-google_apis-x86_64";
path = "system-images/android-25/google_apis/x86_64";
revision = "25-google_apis-x86_64";
displayName = "Google APIs Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-25_r15.zip;
sha1 = "5a81fc218a7fe82cc6af01f7fae54a8000900443";
};
};
"25".google_apis."armeabi-v7a" = {
name = "system-image-25-google_apis-armeabi-v7a";
path = "system-images/android-25/google_apis/armeabi-v7a";
revision = "25-google_apis-armeabi-v7a";
displayName = "Google APIs ARM EABI v7a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/armeabi-v7a-25_r15.zip;
sha1 = "813e25f9a5f6d775670ed6c5e67a39bffa1411bf";
};
};
"25".google_apis."arm64-v8a" = {
name = "system-image-25-google_apis-arm64-v8a";
path = "system-images/android-25/google_apis/arm64-v8a";
revision = "25-google_apis-arm64-v8a";
displayName = "Google APIs ARM 64 v8a System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/arm64-v8a-25_r15.zip;
sha1 = "c3049e32f031140757f71acb5b8f0179e6f27303";
};
};
"26".google_apis."x86" = {
name = "system-image-26-google_apis-x86";
path = "system-images/android-26/google_apis/x86";
revision = "26-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-26_r12.zip;
sha1 = "167c83bcfd87127c7376ce986b34701f74fe87ff";
};
};
"26".google_apis."x86_64" = {
name = "system-image-26-google_apis-x86_64";
path = "system-images/android-26/google_apis/x86_64";
revision = "26-google_apis-x86_64";
displayName = "Google APIs Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-26_r12.zip;
sha1 = "fcd46121c3486e2a759d0707c015e0b12bbab9db";
};
};
"27".google_apis."x86" = {
name = "system-image-27-google_apis-x86";
path = "system-images/android-27/google_apis/x86";
revision = "27-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-27_r08.zip;
sha1 = "623ee2638713b7dfde8044c91280c2afad5a1ade";
};
};
"28".google_apis."x86" = {
name = "system-image-28-google_apis-x86";
path = "system-images/android-28/google_apis/x86";
revision = "28-google_apis-x86";
displayName = "Google APIs Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86-28_r07.zip;
sha1 = "fe5d58355545ae82b0e6a55adc1d41573ac7dec1";
};
};
"28".google_apis."x86_64" = {
name = "system-image-28-google_apis-x86_64";
path = "system-images/android-28/google_apis/x86_64";
revision = "28-google_apis-x86_64";
displayName = "Google APIs Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis/x86_64-28_r07.zip;
sha1 = "068468683a56725326f741f75b6913ee1e7955ff";
};
};
}

View File

@ -0,0 +1,97 @@
{fetchurl}:
{
"24".google_apis_playstore."x86" = {
name = "system-image-24-google_apis_playstore-x86";
path = "system-images/android-24/google_apis_playstore/x86";
revision = "24-google_apis_playstore-x86";
displayName = "Google Play Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-24_r19.zip;
sha1 = "b52e9593ffdde65c1a0970256a32e8967c89cc22";
};
};
"25".google_apis_playstore."x86" = {
name = "system-image-25-google_apis_playstore-x86";
path = "system-images/android-25/google_apis_playstore/x86";
revision = "25-google_apis_playstore-x86";
displayName = "Google Play Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-25_r09.zip;
sha1 = "6f6668954f7fd52f896fe7528aa122028c9b026c";
};
};
"26".google_apis_playstore."x86" = {
name = "system-image-26-google_apis_playstore-x86";
path = "system-images/android-26/google_apis_playstore/x86";
revision = "26-google_apis_playstore-x86";
displayName = "Google Play Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-26_r07.zip;
sha1 = "2c8bee7b97a309f099941532e63c42a7d4a06e19";
};
};
"27".google_apis_playstore."x86" = {
name = "system-image-27-google_apis_playstore-x86";
path = "system-images/android-27/google_apis_playstore/x86";
revision = "27-google_apis_playstore-x86";
displayName = "Google Play Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-27_r03.zip;
sha1 = "eb5a944ceb691ca0648d0a6f0d93893a47223b5d";
};
};
"28".google_apis_playstore."x86" = {
name = "system-image-28-google_apis_playstore-x86";
path = "system-images/android-28/google_apis_playstore/x86";
revision = "28-google_apis_playstore-x86";
displayName = "Google Play Intel x86 Atom System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86-28_r05.zip;
sha1 = "4c570d259e93b0b27f97bad1aca2ac47f1e9b51a";
};
};
"28".google_apis_playstore."x86_64" = {
name = "system-image-28-google_apis_playstore-x86_64";
path = "system-images/android-28/google_apis_playstore/x86_64";
revision = "28-google_apis_playstore-x86_64";
displayName = "Google Play Intel x86 Atom_64 System Image";
archives.all = fetchurl {
url =
https://dl.google.com/android/repository/sys-img/google_apis_playstore/x86_64-28_r05.zip;
sha1 = "5f6b238e4c7de41fd2a1c66841093bcf517255a1";
};
};
}

View File

@ -0,0 +1,12 @@
{deployAndroidPackage, lib, package, os, autoPatchelfHook, pkgs}:
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.stdenv.cc.cc pkgs.zlib pkgs.openssl.out pkgs.ncurses5 ];
patchInstructions = lib.optionalString (os == "linux") ''
addAutoPatchelfSearchPath $packageBaseDir/lib
autoPatchelf $packageBaseDir/lib
autoPatchelf $packageBaseDir/bin
'';
}

View File

@ -1,13 +0,0 @@
diff -ru android-ndk-r10c.old/build/tools/make-standalone-toolchain.sh android-ndk-r10c/build/tools/make-standalone-toolchain.sh
--- android-ndk-r10c.old/build/tools/make-standalone-toolchain.sh 2014-10-16 03:46:32.000000000 +0200
+++ android-ndk-r10c/build/tools/make-standalone-toolchain.sh 2014-10-24 23:46:22.544928306 +0200
@@ -310,6 +310,9 @@
# Now copy the GCC toolchain prebuilt binaries
run copy_directory "$TOOLCHAIN_PATH" "$TMPDIR"
+# Making it writable again
+chmod -R +w "$TMPDIR"
+
# Replace soft-link mcld by real file
ALL_LDS=`find $TMPDIR -name "*mcld"`
for LD in $ALL_LDS; do

View File

@ -1,13 +0,0 @@
diff -ru android-ndk-r8e.old/build/tools/make-standalone-toolchain.sh android-ndk-r8e/build/tools/make-standalone-toolchain.sh
--- android-ndk-r8e.old/build/tools/make-standalone-toolchain.sh 2014-10-16 03:46:32.000000000 +0200
+++ android-ndk-r8e/build/tools/make-standalone-toolchain.sh 2014-10-24 23:46:22.544928306 +0200
@@ -194,6 +194,9 @@
# Now copy the GCC toolchain prebuilt binaries
run copy_directory "$TOOLCHAIN_PATH" "$TMPDIR"
+# Making it writable again
+chmod -R +w "$TMPDIR"
+
if [ -n "$LLVM_VERSION" ]; then
# Copy the clang/llvm toolchain prebuilt binaries
run copy_directory "$LLVM_TOOLCHAIN_PATH" "$TMPDIR"

View File

@ -1,119 +0,0 @@
diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py
index a6ae8448..2739912e 100755
--- a/build/tools/make_standalone_toolchain.py
+++ b/build/tools/make_standalone_toolchain.py
@@ -398,7 +398,9 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
sysroot_path, stl, host_tag):
"""Create a standalone toolchain."""
copy_directory_contents(gcc_path, install_path)
+ os.system('chmod -R +w "{}"'.format(install_path))
copy_directory_contents(clang_path, install_path)
+ os.system('chmod -R +w "{}"'.format(install_path))
triple = get_triple(arch)
make_clang_scripts(
install_path, triple, api, host_tag.startswith('windows'))
@@ -406,23 +408,28 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
sysroot = os.path.join(NDK_DIR, 'sysroot')
install_sysroot = os.path.join(install_path, 'sysroot')
shutil.copytree(sysroot, install_sysroot)
+ os.system('chmod -R +w "{}"'.format(install_path))
arch_headers = os.path.join(sysroot, 'usr/include', triple)
copy_directory_contents(
arch_headers, os.path.join(install_sysroot, 'usr/include'))
+ os.system('chmod -R +w "{}"'.format(install_path))
lib_path = os.path.join(sysroot_path, 'usr/lib')
lib_install = os.path.join(install_sysroot, 'usr/lib')
if os.path.exists(lib_path):
shutil.copytree(lib_path, lib_install)
+ os.system('chmod -R +w "{}"'.format(install_path))
lib64_path = os.path.join(sysroot_path, 'usr/lib64')
lib64_install = os.path.join(install_sysroot, 'usr/lib64')
if os.path.exists(lib64_path):
shutil.copytree(lib64_path, lib64_install)
+ os.system('chmod -R +w "{}"'.format(install_path))
prebuilt_path = os.path.join(NDK_DIR, 'prebuilt', host_tag)
copy_directory_contents(prebuilt_path, install_path)
+ os.system('chmod -R +w "{}"'.format(install_path))
toolchain_lib_dir = os.path.join(gcc_path, 'lib/gcc', triple)
dirs = os.listdir(toolchain_lib_dir)
@@ -444,29 +451,37 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
if stl == 'gnustl':
gnustl_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/gnu-libstdc++/4.9')
shutil.copytree(os.path.join(gnustl_dir, 'include'), cxx_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
for abi in get_abis(arch):
copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver, triple,
abi)
+ os.system('chmod -R +w "{}"'.format(install_path))
copy_gnustl_libs(gnustl_dir, install_path, triple, abi)
+ os.system('chmod -R +w "{}"'.format(install_path))
if arch == 'arm':
copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver,
triple, abi, thumb=True)
+ os.system('chmod -R +w "{}"'.format(install_path))
copy_gnustl_libs(gnustl_dir, install_path, triple, abi,
thumb=True)
+ os.system('chmod -R +w "{}"'.format(install_path))
elif stl == 'libc++':
libcxx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++')
libcxxabi_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++abi')
support_dir = os.path.join(NDK_DIR, 'sources/android/support')
copy_directory_contents(os.path.join(libcxx_dir, 'include'),
cxx_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
copy_directory_contents(os.path.join(support_dir, 'include'),
support_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
# I have no idea why we need this, but the old one does it too.
copy_directory_contents(
os.path.join(libcxxabi_dir, 'include'),
os.path.join(install_path, 'include/llvm-libc++abi/include'))
+ os.system('chmod -R +w "{}"'.format(install_path))
headers = [
'cxxabi.h',
@@ -482,21 +497,25 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
dest_libdir = get_dest_libdir(install_path, triple, abi)
include_libunwind = arch == 'arm'
copy_libcxx_libs(src_libdir, dest_libdir, include_libunwind)
+ os.system('chmod -R +w "{}"'.format(install_path))
if arch == 'arm':
thumb_libdir = os.path.join(dest_libdir, 'thumb')
copy_libcxx_libs(src_libdir, thumb_libdir, include_libunwind)
+ os.system('chmod -R +w "{}"'.format(install_path))
elif stl == 'stlport':
stlport_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/stlport')
gabixx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/gabi++')
copy_directory_contents(
os.path.join(stlport_dir, 'stlport'), cxx_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
# Same as for libc++. Not sure why we have this extra directory, but
# keep the cruft for diff.
copy_directory_contents(
os.path.join(gabixx_dir, 'include'),
os.path.join(install_path, 'include/gabi++/include'))
+ os.system('chmod -R +w "{}"'.format(install_path))
headers = [
'cxxabi.h',
@@ -512,9 +531,11 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
for abi in get_abis(arch):
copy_stlport_libs(stlport_dir, install_path, triple, abi)
+ os.system('chmod -R +w "{}"'.format(install_path))
if arch == 'arm':
copy_stlport_libs(stlport_dir, install_path, triple, abi,
thumb=True)
+ os.system('chmod -R +w "{}"'.format(install_path))
else:
raise ValueError(stl)

View File

@ -1,119 +0,0 @@
diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py
index daba3351..424b7fef 100755
--- a/build/tools/make_standalone_toolchain.py
+++ b/build/tools/make_standalone_toolchain.py
@@ -421,7 +421,9 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
platforms_path, stl, host_tag):
"""Create a standalone toolchain."""
copy_directory_contents(gcc_path, install_path)
+ os.system('chmod -R +w "{}"'.format(install_path))
copy_directory_contents(clang_path, install_path)
+ os.system('chmod -R +w "{}"'.format(install_path))
triple = get_triple(arch)
make_clang_scripts(
install_path, triple, api, host_tag.startswith('windows'))
@@ -432,9 +434,11 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
install_headers = os.path.join(install_sysroot, 'usr/include')
os.makedirs(os.path.dirname(install_headers))
shutil.copytree(headers, install_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
arch_headers = os.path.join(sysroot, 'usr/include', triple)
copy_directory_contents(arch_headers, os.path.join(install_headers))
+ os.system('chmod -R +w "{}"'.format(install_path))
for lib_suffix in ('', '64'):
lib_path = os.path.join(platforms_path, 'usr/lib{}'.format(lib_suffix))
@@ -442,20 +446,24 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
install_sysroot, 'usr/lib{}'.format(lib_suffix))
if os.path.exists(lib_path):
shutil.copytree(lib_path, lib_install)
+ os.system('chmod -R +w "{}"'.format(install_path))
static_lib_path = os.path.join(sysroot, 'usr/lib', triple)
static_lib_install = os.path.join(install_sysroot, 'usr/lib')
if arch == 'x86_64':
static_lib_install += '64'
copy_directory_contents(static_lib_path, static_lib_install)
+ os.system('chmod -R +w "{}"'.format(install_path))
prebuilt_path = os.path.join(NDK_DIR, 'prebuilt', host_tag)
copy_directory_contents(prebuilt_path, install_path)
+ os.system('chmod -R +w "{}"'.format(install_path))
gdbserver_path = os.path.join(
NDK_DIR, 'prebuilt', 'android-' + arch, 'gdbserver')
gdbserver_install = os.path.join(install_path, 'share', 'gdbserver')
shutil.copytree(gdbserver_path, gdbserver_install)
+ os.system('chmod -R +w "{}"'.format(install_path))
toolchain_lib_dir = os.path.join(gcc_path, 'lib/gcc', triple)
dirs = os.listdir(toolchain_lib_dir)
@@ -481,26 +489,33 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
for abi in get_abis(arch):
copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver, triple,
abi)
+ os.system('chmod -R +w "{}"'.format(install_path))
copy_gnustl_libs(gnustl_dir, install_path, triple, abi)
+ os.system('chmod -R +w "{}"'.format(install_path))
if arch == 'arm':
copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver,
triple, abi, thumb=True)
+ os.system('chmod -R +w "{}"'.format(install_path))
copy_gnustl_libs(gnustl_dir, install_path, triple, abi,
thumb=True)
+ os.system('chmod -R +w "{}"'.format(install_path))
elif stl == 'libc++':
libcxx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++')
libcxxabi_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++abi')
copy_directory_contents(os.path.join(libcxx_dir, 'include'),
cxx_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
if api < 21:
support_dir = os.path.join(NDK_DIR, 'sources/android/support')
copy_directory_contents(os.path.join(support_dir, 'include'),
support_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
# I have no idea why we need this, but the old one does it too.
copy_directory_contents(
os.path.join(libcxxabi_dir, 'include'),
os.path.join(install_path, 'include/llvm-libc++abi/include'))
+ os.system('chmod -R +w "{}"'.format(install_path))
headers = [
'cxxabi.h',
@@ -515,21 +530,25 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
src_libdir = get_src_libdir(libcxx_dir, abi)
dest_libdir = get_dest_libdir(install_path, triple, abi)
copy_libcxx_libs(src_libdir, dest_libdir, abi, api)
+ os.system('chmod -R +w "{}"'.format(install_path))
if arch == 'arm':
thumb_libdir = os.path.join(dest_libdir, 'thumb')
copy_libcxx_libs(src_libdir, thumb_libdir, abi, api)
+ os.system('chmod -R +w "{}"'.format(install_path))
elif stl == 'stlport':
stlport_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/stlport')
gabixx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/gabi++')
copy_directory_contents(
os.path.join(stlport_dir, 'stlport'), cxx_headers)
+ os.system('chmod -R +w "{}"'.format(install_path))
# Same as for libc++. Not sure why we have this extra directory, but
# keep the cruft for diff.
copy_directory_contents(
os.path.join(gabixx_dir, 'include'),
os.path.join(install_path, 'include/gabi++/include'))
+ os.system('chmod -R +w "{}"'.format(install_path))
headers = [
'cxxabi.h',
@@ -548,6 +567,7 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
if arch == 'arm':
copy_stlport_libs(stlport_dir, install_path, triple, abi,
thumb=True)
+ os.system('chmod -R +w "{}"'.format(install_path))
else:
raise ValueError(stl)

View File

@ -0,0 +1,51 @@
{deployAndroidPackage, lib, package, os, autoPatchelfHook, makeWrapper, pkgs, platform-tools}:
let
runtime_paths = lib.makeBinPath [ pkgs.coreutils pkgs.file pkgs.findutils pkgs.gawk pkgs.gnugrep pkgs.gnused pkgs.jdk pkgs.python3 pkgs.which ] + ":${platform-tools}/platform-tools";
in
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook makeWrapper pkgs.python2 ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.stdenv.cc.cc pkgs.ncurses5 pkgs.zlib pkgs.libcxx.out ];
patchInstructions = lib.optionalString (os == "linux") ''
patchShebangs .
patch -p1 \
--no-backup-if-mismatch < ${./make_standalone_toolchain.py_18.patch}
wrapProgram $(pwd)/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}"
# TODO: allow this stuff
rm -rf docs tests
# Patch the executables of the toolchains, but not the libraries -- they are needed for crosscompiling
addAutoPatchelfSearchPath $out/libexec/android-sdk/ndk-bundle/toolchains/renderscript/prebuilt/linux-x86_64/lib64
find toolchains -type d -name bin | while read dir
do
autoPatchelf "$dir"
done
# fix ineffective PROGDIR / MYNDKDIR determination
for i in ndk-build
do
sed -i -e 's|^PROGDIR=`dirname $0`|PROGDIR=`dirname $(readlink -f $(which $0))`|' $i
done
# Patch executables
autoPatchelf prebuilt/linux-x86_64
# wrap
for i in ndk-build
do
wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
done
# make some executables available in PATH
mkdir -p $out/bin
for i in ndk-build
do
ln -sf ../../libexec/android-sdk/ndk-bundle/$i $out/bin/$i
done
'';
noAuditTmpdir = true; # Audit script gets invoked by the build/ component in the path for the make standalone script
}

View File

@ -0,0 +1,44 @@
diff -Naur android-ndk-r18b/build/tools/make_standalone_toolchain.py android-ndk-r18b-new/build/tools/make_standalone_toolchain.py
--- android-ndk-r18b/build/tools/make_standalone_toolchain.py 2018-10-11 12:49:38.000000000 +0200
+++ android-ndk-r18b-new/build/tools/make_standalone_toolchain.py 2018-11-20 21:55:52.689991420 +0100
@@ -30,7 +30,7 @@
import sys
import tempfile
import textwrap
-
+import subprocess
THIS_DIR = os.path.realpath(os.path.dirname(__file__))
NDK_DIR = os.path.realpath(os.path.join(THIS_DIR, '../..'))
@@ -173,6 +173,7 @@
logger().debug('Copying %s', src_file)
shutil.copy2(src_file, dst_dir)
+ subprocess.check_call(["chmod", "-R", "+w", dst])
def make_clang_scripts(install_dir, triple, api, windows):
"""Creates Clang wrapper scripts.
@@ -365,6 +366,7 @@
install_headers = os.path.join(install_sysroot, 'usr/include')
os.makedirs(os.path.dirname(install_headers))
shutil.copytree(headers, install_headers)
+ subprocess.check_call(["chmod", "-R", "+w", install_path])
arch_headers = os.path.join(sysroot, 'usr/include', triple)
copy_directory_contents(arch_headers, os.path.join(install_headers))
@@ -375,6 +377,7 @@
install_sysroot, 'usr/lib{}'.format(lib_suffix))
if os.path.exists(lib_path):
shutil.copytree(lib_path, lib_install)
+ subprocess.check_call(["chmod", "-R", "+w", install_path])
static_lib_path = os.path.join(sysroot, 'usr/lib', triple)
static_lib_install = os.path.join(install_sysroot, 'usr/lib')
@@ -389,6 +392,7 @@
NDK_DIR, 'prebuilt', 'android-' + arch, 'gdbserver')
gdbserver_install = os.path.join(install_path, 'share', 'gdbserver')
shutil.copytree(gdbserver_path, gdbserver_install)
+ subprocess.check_call(["chmod", "-R", "+w", install_path])
toolchain_lib_dir = os.path.join(gcc_path, 'lib/gcc', triple)
dirs = os.listdir(toolchain_lib_dir)

View File

@ -1,51 +1,19 @@
{ buildPackages, pkgs }:
{deployAndroidPackage, lib, package, os, autoPatchelfHook, pkgs}:
let
inherit (buildPackages) fetchurl unzip;
inherit (pkgs) stdenv zlib;
in
stdenv.mkDerivation rec {
version = "28.0.1";
name = "android-platform-tools-r${version}";
src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
then fetchurl {
url = "https://dl.google.com/android/repository/platform-tools_r${version}-linux.zip";
sha256 = "14kkr9xib5drjjd0bclm0jn3f5xlmlg652mbv4xd83cv7a53a49y";
}
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
url = "https://dl.google.com/android/repository/platform-tools_r${version}-darwin.zip";
sha256 = "117syrddq1haicwyjzd1p4pfphj0wldjs7w10fpk3n2b7yp37j1v";
}
else throw "System ${stdenv.hostPlatform.system} not supported!";
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
cd platform-tools
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux")
''
for i in adb dmtracedump e2fsdroid fastboot hprof-conv make_f2fs mke2fs sload_f2fs sqlite3
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib:`pwd`/lib64 $i
done
for i in etc1tool
do
patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-linux-x86-64.so.2 $i
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib:${zlib.out}/lib:`pwd`/lib64 $i
done
''}
deployAndroidPackage {
inherit package os;
buildInputs = [ autoPatchelfHook ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.zlib pkgs.ncurses5 ];
patchInstructions = lib.optionalString (os == "linux") ''
addAutoPatchelfSearchPath $packageBaseDir/lib64
autoPatchelf --no-recurse $packageBaseDir/lib64
autoPatchelf --no-recurse $packageBaseDir
mkdir -p $out/bin
for i in adb fastboot
cd $out/bin
find $out/libexec/android-sdk/platform-tools -type f -executable -mindepth 1 -maxdepth 1 -not -name sqlite3 | while read i
do
ln -sf $out/platform-tools/$i $out/bin/$i
ln -s $i
done
'';
nativeBuildInputs = [ unzip ];
}

View File

@ -1,343 +0,0 @@
# This file is generated from generate-platforms.sh. DO NOT EDIT.
# Execute generate-platforms.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildPlatform = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
platform_2 = buildPlatform {
name = "android-platform-1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-1.1_r1-linux.zip;
sha1 = "c054d25c9b4c6251fa49c2f9c54336998679d3fe";
};
meta = {
description = "Android SDK Platform 2";
homepage = http://developer.android.com/sdk/;
};
};
platform_3 = buildPlatform {
name = "android-platform-1.5";
src = fetchurl {
url = https://dl.google.com/android/repository/android-1.5_r04-linux.zip;
sha1 = "5c134b7df5f4b8bd5b61ba93bdaebada8fa3468c";
};
meta = {
description = "Android SDK Platform 3";
homepage = http://developer.android.com/sdk/;
};
};
platform_4 = buildPlatform {
name = "android-platform-1.6";
src = fetchurl {
url = https://dl.google.com/android/repository/android-1.6_r03-linux.zip;
sha1 = "483ed088e45bbdf3444baaf9250c8b02e5383cb0";
};
meta = {
description = "Android SDK Platform 4";
homepage = http://developer.android.com/sdk/;
};
};
platform_5 = buildPlatform {
name = "android-platform-2.0";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.0_r01-linux.zip;
sha1 = "be9be6a99ca32875c96ec7f91160ca9fce7e3c7d";
};
meta = {
description = "Android SDK Platform 5";
homepage = http://developer.android.com/sdk/;
};
};
platform_6 = buildPlatform {
name = "android-platform-2.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.0.1_r01-linux.zip;
sha1 = "ce2c971dce352aa28af06bda92a070116aa5ae1a";
};
meta = {
description = "Android SDK Platform 6";
homepage = http://developer.android.com/sdk/;
};
};
platform_7 = buildPlatform {
name = "android-platform-2.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.1_r03.zip;
sha1 = "5ce51b023ac19f8738500b1007a1da5de2349a1e";
};
meta = {
description = "Android SDK Platform 7";
homepage = http://developer.android.com/sdk/;
};
};
platform_8 = buildPlatform {
name = "android-platform-2.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.2_r03.zip;
sha1 = "231262c63eefdff8fd0386e9ccfefeb27a8f9202";
};
meta = {
description = "Android SDK Platform 8";
homepage = http://developer.android.com/sdk/;
};
};
platform_9 = buildPlatform {
name = "android-platform-2.3.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.3.1_r02.zip;
sha1 = "209f8a7a8b2cb093fce858b8b55fed3ba5206773";
};
meta = {
description = "Android SDK Platform 9";
homepage = http://developer.android.com/sdk/;
};
};
platform_10 = buildPlatform {
name = "android-platform-2.3.3";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.3.3_r02.zip;
sha1 = "887e37783ec32f541ea33c2c649dda648e8e6fb3";
};
meta = {
description = "Android SDK Platform 10";
homepage = http://developer.android.com/sdk/;
};
};
platform_11 = buildPlatform {
name = "android-platform-3.0";
src = fetchurl {
url = https://dl.google.com/android/repository/android-3.0_r02.zip;
sha1 = "2c7d4bd13f276e76f6bbd87315fe27aba351dd37";
};
meta = {
description = "Android SDK Platform 11";
homepage = http://developer.android.com/sdk/;
};
};
platform_12 = buildPlatform {
name = "android-platform-3.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-3.1_r03.zip;
sha1 = "4a50a6679cd95bb68bb5fc032e754cd7c5e2b1bf";
};
meta = {
description = "Android SDK Platform 12";
homepage = http://developer.android.com/sdk/;
};
};
platform_13 = buildPlatform {
name = "android-platform-3.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-3.2_r01.zip;
sha1 = "6189a500a8c44ae73a439604363de93591163cd9";
};
meta = {
description = "Android SDK Platform 13";
homepage = http://developer.android.com/sdk/;
};
};
platform_14 = buildPlatform {
name = "android-platform-4.0";
src = fetchurl {
url = https://dl.google.com/android/repository/android-14_r04.zip;
sha1 = "d4f1d8fbca25225b5f0e7a0adf0d39c3d6e60b3c";
};
meta = {
description = "Android SDK Platform 14";
homepage = http://developer.android.com/sdk/;
};
};
platform_15 = buildPlatform {
name = "android-platform-4.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/android-15_r05.zip;
sha1 = "69ab4c443b37184b2883af1fd38cc20cbeffd0f3";
};
meta = {
description = "Android SDK Platform 15";
homepage = http://developer.android.com/sdk/;
};
};
platform_16 = buildPlatform {
name = "android-platform-4.1.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-16_r05.zip;
sha1 = "12a5ce6235a76bc30f62c26bda1b680e336abd07";
};
meta = {
description = "Android SDK Platform 16";
homepage = http://developer.android.com/sdk/;
};
};
platform_17 = buildPlatform {
name = "android-platform-4.2.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-17_r03.zip;
sha1 = "dbe14101c06e6cdb34e300393e64e64f8c92168a";
};
meta = {
description = "Android SDK Platform 17";
homepage = http://developer.android.com/sdk/;
};
};
platform_18 = buildPlatform {
name = "android-platform-4.3.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-18_r03.zip;
sha1 = "e6b09b3505754cbbeb4a5622008b907262ee91cb";
};
meta = {
description = "Android SDK Platform 18";
homepage = http://developer.android.com/sdk/;
};
};
platform_19 = buildPlatform {
name = "android-platform-4.4.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-19_r04.zip;
sha1 = "2ff20d89e68f2f5390981342e009db5a2d456aaa";
};
meta = {
description = "Android SDK Platform 19";
homepage = http://developer.android.com/sdk/;
};
};
platform_20 = buildPlatform {
name = "android-platform-4.4W.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-20_r02.zip;
sha1 = "a9251f8a3f313ab05834a07a963000927637e01d";
};
meta = {
description = "Android SDK Platform 20";
homepage = http://developer.android.com/sdk/;
};
};
platform_21 = buildPlatform {
name = "android-platform-5.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-21_r02.zip;
sha1 = "53536556059bb29ae82f414fd2e14bc335a4eb4c";
};
meta = {
description = "Android SDK Platform 21";
homepage = http://developer.android.com/sdk/;
};
};
platform_22 = buildPlatform {
name = "android-platform-5.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-22_r02.zip;
sha1 = "5d1bd10fea962b216a0dece1247070164760a9fc";
};
meta = {
description = "Android SDK Platform 22";
homepage = http://developer.android.com/sdk/;
};
};
platform_23 = buildPlatform {
name = "android-platform-6.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-23_r03.zip;
sha1 = "027fede3de6aa1649115bbd0bffff30ccd51c9a0";
};
meta = {
description = "Android SDK Platform 23";
homepage = http://developer.android.com/sdk/;
};
};
platform_24 = buildPlatform {
name = "android-platform-7.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-24_r02.zip;
sha1 = "8912da3d4bfe7a9f28f0e5ce92d3a8dc96342aee";
};
meta = {
description = "Android SDK Platform 24";
homepage = http://developer.android.com/sdk/;
};
};
platform_25 = buildPlatform {
name = "android-platform-7.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-25_r03.zip;
sha1 = "00c2c5765e8988504be10a1eb66ed71fcdbd7fe8";
};
meta = {
description = "Android SDK Platform 25";
homepage = http://developer.android.com/sdk/;
};
};
platform_26 = buildPlatform {
name = "android-platform-8.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-26_r02.zip;
sha1 = "e4ae5d7aa557a3c827135838ee400da8443ac4ef";
};
meta = {
description = "Android SDK Platform 26";
homepage = http://developer.android.com/sdk/;
};
};
platform_27 = buildPlatform {
name = "android-platform-8.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-27_r03.zip;
sha1 = "35f747e7e70b2d16e0e4246876be28d15ea1c353";
};
meta = {
description = "Android SDK Platform 27";
homepage = http://developer.android.com/sdk/;
};
};
platform_28 = buildPlatform {
name = "android-platform-9";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-28_r06.zip;
sha1 = "9a4e52b1d55bd2e24216b150aafae2503d3efba6";
};
meta = {
description = "Android SDK Platform 28";
homepage = http://developer.android.com/sdk/;
};
};
}

View File

@ -1,343 +0,0 @@
# This file is generated from generate-platforms.sh. DO NOT EDIT.
# Execute generate-platforms.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildPlatform = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
platform_2 = buildPlatform {
name = "android-platform-1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-1.1_r1-macosx.zip;
sha1 = "e21dbcff45b7356657449ebb3c7e941be2bb5ebe";
};
meta = {
description = "Android SDK Platform 2";
homepage = http://developer.android.com/sdk/;
};
};
platform_3 = buildPlatform {
name = "android-platform-1.5";
src = fetchurl {
url = https://dl.google.com/android/repository/android-1.5_r04-macosx.zip;
sha1 = "d3a67c2369afa48b6c3c7624de5031c262018d1e";
};
meta = {
description = "Android SDK Platform 3";
homepage = http://developer.android.com/sdk/;
};
};
platform_4 = buildPlatform {
name = "android-platform-1.6";
src = fetchurl {
url = https://dl.google.com/android/repository/android-1.6_r03-macosx.zip;
sha1 = "bdafad44f5df9f127979bdb21a1fdd87ee3cd625";
};
meta = {
description = "Android SDK Platform 4";
homepage = http://developer.android.com/sdk/;
};
};
platform_5 = buildPlatform {
name = "android-platform-2.0";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.0_r01-macosx.zip;
sha1 = "2a866d0870dbba18e0503cd41e5fae988a21b314";
};
meta = {
description = "Android SDK Platform 5";
homepage = http://developer.android.com/sdk/;
};
};
platform_6 = buildPlatform {
name = "android-platform-2.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.0.1_r01-macosx.zip;
sha1 = "c3096f80d75a6fc8cb38ef8a18aec920e53d42c0";
};
meta = {
description = "Android SDK Platform 6";
homepage = http://developer.android.com/sdk/;
};
};
platform_7 = buildPlatform {
name = "android-platform-2.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.1_r03.zip;
sha1 = "5ce51b023ac19f8738500b1007a1da5de2349a1e";
};
meta = {
description = "Android SDK Platform 7";
homepage = http://developer.android.com/sdk/;
};
};
platform_8 = buildPlatform {
name = "android-platform-2.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.2_r03.zip;
sha1 = "231262c63eefdff8fd0386e9ccfefeb27a8f9202";
};
meta = {
description = "Android SDK Platform 8";
homepage = http://developer.android.com/sdk/;
};
};
platform_9 = buildPlatform {
name = "android-platform-2.3.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.3.1_r02.zip;
sha1 = "209f8a7a8b2cb093fce858b8b55fed3ba5206773";
};
meta = {
description = "Android SDK Platform 9";
homepage = http://developer.android.com/sdk/;
};
};
platform_10 = buildPlatform {
name = "android-platform-2.3.3";
src = fetchurl {
url = https://dl.google.com/android/repository/android-2.3.3_r02.zip;
sha1 = "887e37783ec32f541ea33c2c649dda648e8e6fb3";
};
meta = {
description = "Android SDK Platform 10";
homepage = http://developer.android.com/sdk/;
};
};
platform_11 = buildPlatform {
name = "android-platform-3.0";
src = fetchurl {
url = https://dl.google.com/android/repository/android-3.0_r02.zip;
sha1 = "2c7d4bd13f276e76f6bbd87315fe27aba351dd37";
};
meta = {
description = "Android SDK Platform 11";
homepage = http://developer.android.com/sdk/;
};
};
platform_12 = buildPlatform {
name = "android-platform-3.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-3.1_r03.zip;
sha1 = "4a50a6679cd95bb68bb5fc032e754cd7c5e2b1bf";
};
meta = {
description = "Android SDK Platform 12";
homepage = http://developer.android.com/sdk/;
};
};
platform_13 = buildPlatform {
name = "android-platform-3.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-3.2_r01.zip;
sha1 = "6189a500a8c44ae73a439604363de93591163cd9";
};
meta = {
description = "Android SDK Platform 13";
homepage = http://developer.android.com/sdk/;
};
};
platform_14 = buildPlatform {
name = "android-platform-4.0";
src = fetchurl {
url = https://dl.google.com/android/repository/android-14_r04.zip;
sha1 = "d4f1d8fbca25225b5f0e7a0adf0d39c3d6e60b3c";
};
meta = {
description = "Android SDK Platform 14";
homepage = http://developer.android.com/sdk/;
};
};
platform_15 = buildPlatform {
name = "android-platform-4.0.3";
src = fetchurl {
url = https://dl.google.com/android/repository/android-15_r05.zip;
sha1 = "69ab4c443b37184b2883af1fd38cc20cbeffd0f3";
};
meta = {
description = "Android SDK Platform 15";
homepage = http://developer.android.com/sdk/;
};
};
platform_16 = buildPlatform {
name = "android-platform-4.1.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-16_r05.zip;
sha1 = "12a5ce6235a76bc30f62c26bda1b680e336abd07";
};
meta = {
description = "Android SDK Platform 16";
homepage = http://developer.android.com/sdk/;
};
};
platform_17 = buildPlatform {
name = "android-platform-4.2.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-17_r03.zip;
sha1 = "dbe14101c06e6cdb34e300393e64e64f8c92168a";
};
meta = {
description = "Android SDK Platform 17";
homepage = http://developer.android.com/sdk/;
};
};
platform_18 = buildPlatform {
name = "android-platform-4.3.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-18_r03.zip;
sha1 = "e6b09b3505754cbbeb4a5622008b907262ee91cb";
};
meta = {
description = "Android SDK Platform 18";
homepage = http://developer.android.com/sdk/;
};
};
platform_19 = buildPlatform {
name = "android-platform-4.4.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-19_r04.zip;
sha1 = "2ff20d89e68f2f5390981342e009db5a2d456aaa";
};
meta = {
description = "Android SDK Platform 19";
homepage = http://developer.android.com/sdk/;
};
};
platform_20 = buildPlatform {
name = "android-platform-4.4W.2";
src = fetchurl {
url = https://dl.google.com/android/repository/android-20_r02.zip;
sha1 = "a9251f8a3f313ab05834a07a963000927637e01d";
};
meta = {
description = "Android SDK Platform 20";
homepage = http://developer.android.com/sdk/;
};
};
platform_21 = buildPlatform {
name = "android-platform-5.0.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-21_r02.zip;
sha1 = "53536556059bb29ae82f414fd2e14bc335a4eb4c";
};
meta = {
description = "Android SDK Platform 21";
homepage = http://developer.android.com/sdk/;
};
};
platform_22 = buildPlatform {
name = "android-platform-5.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/android-22_r02.zip;
sha1 = "5d1bd10fea962b216a0dece1247070164760a9fc";
};
meta = {
description = "Android SDK Platform 22";
homepage = http://developer.android.com/sdk/;
};
};
platform_23 = buildPlatform {
name = "android-platform-6.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-23_r03.zip;
sha1 = "027fede3de6aa1649115bbd0bffff30ccd51c9a0";
};
meta = {
description = "Android SDK Platform 23";
homepage = http://developer.android.com/sdk/;
};
};
platform_24 = buildPlatform {
name = "android-platform-7.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-24_r02.zip;
sha1 = "8912da3d4bfe7a9f28f0e5ce92d3a8dc96342aee";
};
meta = {
description = "Android SDK Platform 24";
homepage = http://developer.android.com/sdk/;
};
};
platform_25 = buildPlatform {
name = "android-platform-7.1.1";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-25_r03.zip;
sha1 = "00c2c5765e8988504be10a1eb66ed71fcdbd7fe8";
};
meta = {
description = "Android SDK Platform 25";
homepage = http://developer.android.com/sdk/;
};
};
platform_26 = buildPlatform {
name = "android-platform-8.0.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-26_r02.zip;
sha1 = "e4ae5d7aa557a3c827135838ee400da8443ac4ef";
};
meta = {
description = "Android SDK Platform 26";
homepage = http://developer.android.com/sdk/;
};
};
platform_27 = buildPlatform {
name = "android-platform-8.1.0";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-27_r03.zip;
sha1 = "35f747e7e70b2d16e0e4246876be28d15ea1c353";
};
meta = {
description = "Android SDK Platform 27";
homepage = http://developer.android.com/sdk/;
};
};
platform_28 = buildPlatform {
name = "android-platform-9";
src = fetchurl {
url = https://dl.google.com/android/repository/platform-28_r06.zip;
sha1 = "9a4e52b1d55bd2e24216b150aafae2503d3efba6";
};
meta = {
description = "Android SDK Platform 28";
homepage = http://developer.android.com/sdk/;
};
};
}

View File

@ -0,0 +1,27 @@
#!/bin/sh -e
if [ "$1" = "" ]
then
echo "Please select a package set: 'packages', 'addons', 'system-images'" >&2
exit 1
fi
if [ "$2" = "" ]
then
echo "Please select a package group:" >&2
( cat <<EOF
builtins.attrNames (import ./generated/$1.nix {
fetchurl = null;
})
EOF
) | nix-instantiate --eval-only -
exit 1
fi
( cat <<EOF
builtins.attrNames (import ./generated/$1.nix {
fetchurl = null;
}).$2
EOF
) | nix-instantiate --eval-only -

File diff suppressed because it is too large Load Diff

View File

@ -1,184 +0,0 @@
# This file is generated from generate-sources.sh. DO NOT EDIT.
# Execute generate-sources.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildSource = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
source_14 = buildSource {
name = "android-source-14";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-14_r01.zip;
sha1 = "eaf4ed7dcac46e68516a1b4aa5b0d9e5a39a7555";
};
meta = {
description = "Source code for Android API 14";
};
};
source_15 = buildSource {
name = "android-source-15";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-15_r02.zip;
sha1 = "e5992a5747c9590783fbbdd700337bf0c9f6b1fa";
};
meta = {
description = "Source code for Android API 15";
};
};
source_16 = buildSource {
name = "android-source-16";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-16_r02.zip;
sha1 = "0f83c14ed333c45d962279ab5d6bc98a0269ef84";
};
meta = {
description = "Source code for Android API 16";
};
};
source_17 = buildSource {
name = "android-source-17";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-17_r01.zip;
sha1 = "6f1f18cd2d2b1852d7f6892df9cee3823349d43a";
};
meta = {
description = "Source code for Android API 17";
};
};
source_18 = buildSource {
name = "android-source-18";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-18_r01.zip;
sha1 = "8b49fdf7433f4881a2bfb559b5dd05d8ec65fb78";
};
meta = {
description = "Source code for Android API 18";
};
};
source_19 = buildSource {
name = "android-source-19";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-19_r02.zip;
sha1 = "433a1d043ef77561571250e94cb7a0ef24a202e7";
};
meta = {
description = "Source code for Android API 19";
};
};
source_20 = buildSource {
name = "android-source-20";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-20_r01.zip;
sha1 = "8da3e40f2625f9f7ef38b7e403f49f67226c0d76";
};
meta = {
description = "Source code for Android API 20";
};
};
source_21 = buildSource {
name = "android-source-21";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-21_r01.zip;
sha1 = "137a5044915d32bea297a8c1552684802bbc2e25";
};
meta = {
description = "Source code for Android API 21";
};
};
source_22 = buildSource {
name = "android-source-22";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-22_r01.zip;
sha1 = "98320e13976d11597a4a730a8d203ac9a03ed5a6";
};
meta = {
description = "Source code for Android API 22";
};
};
source_23 = buildSource {
name = "android-source-23";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-23_r01.zip;
sha1 = "b0f15da2762b42f543c5e364c2b15b198cc99cc2";
};
meta = {
description = "Source code for Android API 23";
};
};
source_24 = buildSource {
name = "android-source-24";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-24_r01.zip;
sha1 = "6b96115830a83d654479f32ce4b724ca9011148b";
};
meta = {
description = "Source code for Android API 24";
};
};
source_25 = buildSource {
name = "android-source-25";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-25_r01.zip;
sha1 = "bbc72efd1a9bad87cc507e308f0d29aad438c52c";
};
meta = {
description = "Source code for Android API 25";
};
};
source_26 = buildSource {
name = "android-source-26";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-26_r01.zip;
sha1 = "2af701ee3223d580409288540b1d06932fd8f9b9";
};
meta = {
description = "Source code for Android API 26";
};
};
source_27 = buildSource {
name = "android-source-27";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-27_r01.zip;
sha1 = "7b714670561d08f54751af42aca929867b806596";
};
meta = {
description = "Source code for Android API 27";
};
};
source_28 = buildSource {
name = "android-source-28";
src = fetchurl {
url = https://dl.google.com/android/repository/sources-28_r01.zip;
sha1 = "5610e0c24235ee3fa343c899ddd551be30315255";
};
meta = {
description = "Source code for Android API 28";
};
};
}

View File

@ -1,18 +0,0 @@
{stdenv, fetchurl, unzip}:
stdenv.mkDerivation rec {
version = "47";
name = "android-support-repository-r${version}";
src = fetchurl {
url = "http://dl.google.com/android/repository/android_m2repository_r${version}.zip";
sha256 = "1l13a6myff6i8x99h1ky2j5sglwy8wc0rsbxfcbif375vh41iyd3";
};
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
buildInputs = [ unzip ];
}

View File

@ -1,18 +0,0 @@
{stdenv, fetchurl, unzip}:
stdenv.mkDerivation rec {
version = "23.2.1";
name = "android-support-r${version}";
src = fetchurl {
url = "https://dl.google.com/android/repository/support_r${version}.zip";
sha1 = "azl7hgps1k98kmbhw45wwbrc86y1n4j1";
};
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
buildInputs = [ unzip ];
}

File diff suppressed because it is too large Load Diff

View File

@ -1,305 +0,0 @@
# This file is generated from generate-sysimages.sh. DO NOT EDIT.
# Execute generate-sysimages.sh or fetch.sh to update the file.
{stdenv, fetchurl, unzip}:
let
buildSystemImage = args:
stdenv.mkDerivation (args // {
buildInputs = [ unzip ];
buildCommand = ''
mkdir -p $out
cd $out
unzip $src
'';
});
in
{
sysimg_armeabi-v7a_10 = buildSystemImage {
name = "sysimg-armeabi-v7a-10";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armv7-10_r04.zip;
sha1 = "54680383118eb5c95a11e1cc2a14aa572c86ee69";
};
};
sysimg_x86_10 = buildSystemImage {
name = "sysimg-x86-10";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-10_r04.zip;
sha1 = "655ffc5cc89dd45a3aca154b254009016e473aeb";
};
};
sysimg_armeabi-v7a_14 = buildSystemImage {
name = "sysimg-armeabi-v7a-14";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-14_r02.zip;
sha1 = "d8991b0c06b18d7d6ed4169d67460ee1add6661b";
};
};
sysimg_armeabi-v7a_15 = buildSystemImage {
name = "sysimg-armeabi-v7a-15";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-15_r04.zip;
sha1 = "363223bd62f5afc0b2bd760b54ce9d26b31eacf1";
};
};
sysimg_x86_15 = buildSystemImage {
name = "sysimg-x86-15";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-15_r04.zip;
sha1 = "e45c728b64881c0e86529a8f7ea9c103a3cd14c1";
};
};
sysimg_armeabi-v7a_16 = buildSystemImage {
name = "sysimg-armeabi-v7a-16";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/sysimg_armv7a-16_r04.zip;
sha1 = "39c093ea755098f0ee79f607be7df9e54ba4943f";
};
};
sysimg_mips_16 = buildSystemImage {
name = "sysimg-mips-16";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/sysimg_mips-16_r04.zip;
sha1 = "67943c54fb3943943ffeb05fdd39c0b753681f6e";
};
};
sysimg_x86_16 = buildSystemImage {
name = "sysimg-x86-16";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-16_r06.zip;
sha1 = "bf1bf8c5591346118d2235da1ad20e7be8a3e9cd";
};
};
sysimg_armeabi-v7a_17 = buildSystemImage {
name = "sysimg-armeabi-v7a-17";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-17_r05.zip;
sha1 = "7460e8110f4a87f9644f1bdb5511a66872d50fd9";
};
};
sysimg_mips_17 = buildSystemImage {
name = "sysimg-mips-17";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/sysimg_mips-17_r01.zip;
sha1 = "f0c6e153bd584c29e51b5c9723cfbf30f996a05d";
};
};
sysimg_x86_17 = buildSystemImage {
name = "sysimg-x86-17";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-17_r04.zip;
sha1 = "03c6d022ab2dcbbcf655d78ba5ccb0431cadcaec";
};
};
sysimg_armeabi-v7a_18 = buildSystemImage {
name = "sysimg-armeabi-v7a-18";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-18_r04.zip;
sha1 = "0bf34ecf4ddd53f6b1b7fe7dfa12f2887c17e642";
};
};
sysimg_x86_18 = buildSystemImage {
name = "sysimg-x86-18";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-18_r03.zip;
sha1 = "03a0cb23465c3de15215934a1dbc9715b56e9458";
};
};
sysimg_armeabi-v7a_19 = buildSystemImage {
name = "sysimg-armeabi-v7a-19";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-19_r05.zip;
sha1 = "d1a5fd4f2e1c013c3d3d9bfe7e9db908c3ed56fa";
};
};
sysimg_x86_19 = buildSystemImage {
name = "sysimg-x86-19";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-19_r06.zip;
sha1 = "2ac82153aae97f7eae4c5a0761224fe04321d03d";
};
};
sysimg_armeabi-v7a_21 = buildSystemImage {
name = "sysimg-armeabi-v7a-21";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-21_r04.zip;
sha1 = "8c606f81306564b65e41303d2603e4c42ded0d10";
};
};
sysimg_x86_21 = buildSystemImage {
name = "sysimg-x86-21";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-21_r05.zip;
sha1 = "00f0eb0a1003efe3316347f762e20a85d8749cff";
};
};
sysimg_x86_64_21 = buildSystemImage {
name = "sysimg-x86_64-21";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-21_r05.zip;
sha1 = "9078a095825a69e5e215713f0866c83cef65a342";
};
};
sysimg_armeabi-v7a_22 = buildSystemImage {
name = "sysimg-armeabi-v7a-22";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-22_r02.zip;
sha1 = "2114ec015dbf3a16cbcb4f63e8a84a1b206a07a1";
};
};
sysimg_x86_22 = buildSystemImage {
name = "sysimg-x86-22";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-22_r06.zip;
sha1 = "e33e2a6cc3f1cc56b2019dbef3917d2eeb26f54e";
};
};
sysimg_x86_64_22 = buildSystemImage {
name = "sysimg-x86_64-22";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-22_r06.zip;
sha1 = "5db3b27f78cd9c4c5092b1cad5a5dd479fb5b2e4";
};
};
sysimg_armeabi-v7a_23 = buildSystemImage {
name = "sysimg-armeabi-v7a-23";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-23_r06.zip;
sha1 = "7cf2ad756e54a3acfd81064b63cb0cb9dff2798d";
};
};
sysimg_x86_23 = buildSystemImage {
name = "sysimg-x86-23";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-23_r10.zip;
sha1 = "f6c3e3dd7bd951454795aa75c3a145fd05ac25bb";
};
};
sysimg_x86_64_23 = buildSystemImage {
name = "sysimg-x86_64-23";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-23_r10.zip;
sha1 = "7cbc291483ca07dc67b71268c5f08a5755f50f51";
};
};
sysimg_arm64-v8a_24 = buildSystemImage {
name = "sysimg-arm64-v8a-24";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/arm64-v8a-24_r07.zip;
sha1 = "e8ab2e49e4efe4b064232b33b5eeaded61437d7f";
};
};
sysimg_armeabi-v7a_24 = buildSystemImage {
name = "sysimg-armeabi-v7a-24";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/armeabi-v7a-24_r07.zip;
sha1 = "3454546b4eed2d6c3dd06d47757d6da9f4176033";
};
};
sysimg_x86_24 = buildSystemImage {
name = "sysimg-x86-24";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-24_r08.zip;
sha1 = "c1cae7634b0216c0b5990f2c144eb8ca948e3511";
};
};
sysimg_x86_64_24 = buildSystemImage {
name = "sysimg-x86_64-24";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-24_r08.zip;
sha1 = "f6559e1949a5879f31a9662f4f0e50ad60181684";
};
};
sysimg_x86_25 = buildSystemImage {
name = "sysimg-x86-25";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-25_r01.zip;
sha1 = "78ce7eb1387d598685633b9f7cbb300c3d3aeb5f";
};
};
sysimg_x86_64_25 = buildSystemImage {
name = "sysimg-x86_64-25";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-25_r01.zip;
sha1 = "7093d7b39216020226ff430a3b7b81c94d31ad37";
};
};
sysimg_x86_26 = buildSystemImage {
name = "sysimg-x86-26";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-26_r01.zip;
sha1 = "e613d6e0da668e30daf547f3c6627a6352846f90";
};
};
sysimg_x86_64_26 = buildSystemImage {
name = "sysimg-x86_64-26";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-26_r01.zip;
sha1 = "432f149c048bffce7f9de526ec65b336daf7a0a3";
};
};
sysimg_x86_27 = buildSystemImage {
name = "sysimg-x86-27";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-27_r01.zip;
sha1 = "4ec990fac7b62958decd12e18a4cd389dfe7c582";
};
};
sysimg_x86_64_27 = buildSystemImage {
name = "sysimg-x86_64-27";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-27_r01.zip;
sha1 = "2878261011a59ca3de29dc5b457a495fdb268d60";
};
};
sysimg_x86_28 = buildSystemImage {
name = "sysimg-x86-28";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86-28_r04.zip;
sha1 = "ce03c42d80c0fc6dc47f6455dbee7aa275d02780";
};
};
sysimg_x86_64_28 = buildSystemImage {
name = "sysimg-x86_64-28";
src = fetchurl {
url = https://dl.google.com/android/repository/sys-img/android/x86_64-28_r04.zip;
sha1 = "d47a85c8f4e9fd57df97814ad8884eeb0f3a0ef0";
};
};
}

View File

@ -0,0 +1,26 @@
{deployAndroidPackage, requireFile, lib, packages, toolsVersion, autoPatchelfHook, makeWrapper, os, pkgs, pkgs_i686, postInstall ? ""}:
if toolsVersion == "26.0.1" then import ./tools/26.nix {
inherit deployAndroidPackage lib autoPatchelfHook makeWrapper os pkgs pkgs_i686 postInstall;
package = {
name = "tools";
path = "tools";
revision = "26.0.1";
archives = {
linux = requireFile {
url = https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip;
sha256 = "185yq7qwxflw24ccm5d6zziwlc9pxmsm3f54pm9p7xm0ik724kj4";
};
macosx = requireFile {
url = https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip;
sha256 = "1ycx9gzdaqaw6n19yvxjawywacavn1jc6sadlz5qikhgfr57b0aa";
};
};
};
} else if toolsVersion == "26.1.1" then import ./tools/26.nix {
inherit deployAndroidPackage lib autoPatchelfHook makeWrapper os pkgs pkgs_i686 postInstall;
package = packages.tools."${toolsVersion}";
} else import ./tools/25.nix {
inherit deployAndroidPackage lib autoPatchelfHook makeWrapper os pkgs pkgs_i686 postInstall;
package = packages.tools."${toolsVersion}";
}

View File

@ -0,0 +1,62 @@
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgs_i686, postInstall ? ""}:
deployAndroidPackage {
name = "androidsdk";
buildInputs = [ autoPatchelfHook makeWrapper ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.xlibs.libX11 pkgs.xlibs.libXext pkgs.xlibs.libXdamage pkgs.xlibs.libxcb pkgs.xlibs.libXfixes pkgs.xlibs.libXrender pkgs.fontconfig.lib pkgs.freetype pkgs.libGL pkgs.zlib pkgs.ncurses5 pkgs.libpulseaudio pkgs_i686.glibc pkgs_i686.xlibs.libX11 pkgs_i686.xlibs.libXrender pkgs_i686.fontconfig pkgs_i686.freetype pkgs_i686.zlib ];
inherit package os;
patchInstructions = ''
${lib.optionalString (os == "linux") ''
# Auto patch all binaries
addAutoPatchelfSearchPath $PWD/lib64
addAutoPatchelfSearchPath $PWD/lib64/libstdc++
addAutoPatchelfSearchPath $PWD/lib64/qt/lib
addAutoPatchelfSearchPath $PWD/lib
addAutoPatchelfSearchPath $PWD/lib/libstdc++
autoPatchelf .
''}
# Wrap all scripts that require JAVA_HOME
for i in bin
do
find $i -maxdepth 1 -type f -executable | while read program
do
if grep -q "JAVA_HOME" $program
then
wrapProgram $PWD/$program --prefix PATH : ${pkgs.jdk8}/bin
fi
done
done
# Wrap programs that require java
for i in draw9patch jobb lint screenshot2
do
wrapProgram $PWD/$i \
--prefix PATH : ${pkgs.jdk8}/bin
done
# Wrap programs that require java and SWT
for i in android ddms hierarchyviewer monitor monkeyrunner traceview uiautomatorviewer
do
wrapProgram $PWD/$i \
--prefix PATH : ${pkgs.jdk8}/bin \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ pkgs.xlibs.libX11 pkgs.xlibs.libXtst ]}
done
${lib.optionalString (os == "linux") ''
wrapProgram $PWD/emulator \
--prefix PATH : ${pkgs.file}/bin:${pkgs.glxinfo}/bin:${pkgs.pciutils}/bin \
--set QT_XKB_CONFIG_ROOT ${pkgs.xkeyboard_config}/share/X11/xkb \
--set QTCOMPOSE ${pkgs.xorg.libX11.out}/share/X11/locale
''}
# Patch all script shebangs
patchShebangs .
cd ..
${postInstall}
'';
meta.licenses = lib.licenses.unfree;
}

View File

@ -0,0 +1,40 @@
{deployAndroidPackage, lib, package, autoPatchelfHook, makeWrapper, os, pkgs, pkgs_i686, postInstall ? ""}:
deployAndroidPackage {
name = "androidsdk";
inherit os package;
buildInputs = [ autoPatchelfHook makeWrapper ]
++ lib.optional (os == "linux") [ pkgs.glibc pkgs.xlibs.libX11 pkgs.xlibs.libXrender pkgs.xlibs.libXext pkgs.fontconfig pkgs.freetype pkgs_i686.glibc pkgs_i686.xlibs.libX11 pkgs_i686.xlibs.libXrender pkgs_i686.xlibs.libXext pkgs_i686.fontconfig pkgs_i686.freetype pkgs_i686.zlib ];
patchInstructions = ''
${lib.optionalString (os == "linux") ''
# Auto patch all binaries
autoPatchelf .
''}
# Wrap all scripts that require JAVA_HOME
for i in bin
do
find $i -maxdepth 1 -type f -executable | while read program
do
if grep -q "JAVA_HOME" $program
then
wrapProgram $PWD/$program --prefix PATH : ${pkgs.jdk8}/bin
fi
done
done
# Wrap monitor script
wrapProgram $PWD/monitor \
--prefix PATH : ${pkgs.jdk8}/bin \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ pkgs.xlibs.libX11 pkgs.xlibs.libXtst ]}
# Patch all script shebangs
patchShebangs .
cd ..
${postInstall}
'';
meta.licenses = lib.licenses.unfree;
}

View File

@ -1,4 +1,4 @@
{ stdenv, requireFile, p7zip, jre, libusb1, platformTools, gtk2, glib, libXtst }:
{ stdenv, requireFile, p7zip, jre, libusb1, platform-tools, gtk2, glib, libXtst }:
# TODO:
#
@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
'';
buildPhase = ''
ln -s ${platformTools}/platform-tools/adb x10flasher_lib/adb.linux
ln -s ${platformTools}/platform-tools/fastboot x10flasher_lib/fastboot.linux
ln -s ${platform-tools}/libexec/android-sdk/platform-tools/adb x10flasher_lib/adb.linux
ln -s ${platform-tools}/libexec/android-sdk/platform-tools/fastboot x10flasher_lib/fastboot.linux
ln -s ${libusb1.out}/lib/libusb-1.0.so.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so
chmod +x x10flasher_lib/unyaffs.linux.x86 x10flasher_lib/bin2elf x10flasher_lib/bin2sin

View File

@ -1,200 +1,181 @@
{stdenv, androidsdk, titaniumsdk, titanium, alloy, xcodewrapper, jdk, python, nodejs, which, file, xcodeBaseDir}:
{ name, src, preBuild ? "", target, androidPlatformVersions ? [ "25" ], androidAbiVersions ? [ "armeabi" "armeabi-v7a" ], tiVersion ? null
{stdenv, composeAndroidPackages, composeXcodeWrapper, titaniumsdk, titanium, alloy, jdk, python, nodejs, which, file}:
{ name, src, preBuild ? "", target, tiVersion ? null
, release ? false, androidKeyStore ? null, androidKeyAlias ? null, androidKeyStorePassword ? null
, iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosVersion ? "11.2"
, enableWirelessDistribution ? false, iosBuildStore ? false, installURL ? null
}:
, iosMobileProvisioningProfile ? null, iosCertificateName ? null, iosCertificate ? null, iosCertificatePassword ? null, iosVersion ? "11.3", iosBuildStore ? false
, enableWirelessDistribution ? false, installURL ? null
, xcodeBaseDir ? "/Applications/Xcode.app"
, androidsdkArgs ? {}
, xcodewrapperArgs ? {}
, ...
}@args:
assert (release && target == "android") -> androidKeyStore != null && androidKeyAlias != null && androidKeyStorePassword != null;
assert (release && target == "iphone") -> iosMobileProvisioningProfile != null && iosCertificateName != null && iosCertificate != null && iosCertificatePassword != null;
assert enableWirelessDistribution -> installURL != null;
let
androidsdkComposition = androidsdk {
platformVersions = androidPlatformVersions;
abiVersions = androidAbiVersions;
useGoogleAPIs = true;
};
realAndroidsdkArgs = {
platformVersions = [ "26" ];
} // androidsdkArgs;
androidsdk = (composeAndroidPackages realAndroidsdkArgs).androidsdk;
realXcodewrapperArgs = {
inherit xcodeBaseDir;
} // xcodewrapperArgs;
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
deleteKeychain = ''
security default-keychain -s login.keychain
security delete-keychain $keychainName
rm -f $HOME/lock-keychain
if [ -f $HOME/lock-keychain ]
then
security default-keychain -s login.keychain
security delete-keychain $keychainName
rm -f $HOME/lock-keychain
fi
'';
in
stdenv.mkDerivation {
name = stdenv.lib.replaceChars [" "] [""] name;
inherit src;
buildInputs = [ nodejs titanium alloy jdk python which file ] ++ stdenv.lib.optional (stdenv.hostPlatform.system == "x86_64-darwin") xcodewrapper;
extraArgs = removeAttrs args [ "name" "preRebuild" "androidsdkArgs" "xcodewrapperArgs" ];
in
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name;
buildInputs = [ nodejs titanium alloy python which file jdk ]
++ stdenv.lib.optional (target == "iphone") xcodewrapper;
buildPhase = ''
${preBuild}
export HOME=$TMPDIR
export HOME=${if target == "iphone" then "/Users/$(whoami)" else "$TMPDIR"}
${stdenv.lib.optionalString (tiVersion != null) ''
# Replace titanium version by the provided one
sed -i -e "s|<sdk-version>[0-9a-zA-Z\.]*</sdk-version>|<sdk-version>${tiVersion}</sdk-version>|" tiapp.xml
''}
# Simulate a login
mkdir -p $HOME/.titanium
cat > $HOME/.titanium/auth_session.json <<EOF
{ "loggedIn": true }
EOF
# Configure the paths to the Titanium SDK and modules
echo "{}" > $TMPDIR/config.json
titanium --config-file $TMPDIR/config.json --no-colors config sdk.defaultInstallLocation ${titaniumsdk}
titanium --config-file $TMPDIR/config.json --no-colors config paths.modules ${titaniumsdk}
mkdir -p $out
${if target == "android" then
''
titanium config --config-file $TMPDIR/config.json --no-colors android.sdkPath ${androidsdkComposition}/libexec
export PATH=$(echo ${androidsdkComposition}/libexec/tools):$(echo ${androidsdkComposition}/libexec/build-tools/android-*):$PATH
export GRADLE_USER_HOME=$TMPDIR/gradle
${if release then
''
${stdenv.lib.optionalString stdenv.isDarwin ''
# Signing the app does not work with OpenJDK on macOS, use host SDK instead
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
''}
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target dist-playstore --keystore ${androidKeyStore} --alias ${androidKeyAlias} --store-password ${androidKeyStorePassword} --output-dir $out
''
else
''titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target emulator --build-only -B foo --output $out''}
''
else if target == "iphone" then
''
${if release then
''
export HOME=/Users/$(whoami)
export keychainName=$(basename $out)
# Create a keychain with the component hash name (should always be unique)
security create-keychain -p "" $keychainName
security default-keychain -s $keychainName
security unlock-keychain -p "" $keychainName
security import ${iosCertificate} -k $keychainName -P "${iosCertificatePassword}" -A
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
provisioningId=$(grep UUID -A1 -a ${iosMobileProvisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
# Ensure that the requested provisioning profile can be found
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision" ]
then
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
fi
# Simulate a login
mkdir -p $HOME/.titanium
cat > $HOME/.titanium/auth_session.json <<EOF
{ "loggedIn": true }
EOF
# Configure the path to Xcode
titanium --config-file $TMPDIR/config.json --no-colors config paths.xcode ${xcodeBaseDir}
# Make plutil available
mkdir -p $TMPDIR/bin
ln -s /usr/bin/plutil $TMPDIR/bin
export PATH=$TMPDIR/bin:$PATH
# Link the modules folder
if [ ! -e modules ]
then
ln -s ${titaniumsdk}/modules modules
fi
# Take precautions to prevent concurrent builds blocking the keychain
while [ -f $HOME/lock-keychain ]
do
echo "Keychain locked, waiting for a couple of seconds, or remove $HOME/lock-keychain to unblock..."
sleep 3
done
touch $HOME/lock-keychain
security default-keychain -s $keychainName
# Do the actual build
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target ${if iosBuildStore then "dist-appstore" else "dist-adhoc"} --pp-uuid $provisioningId --distribution-name "${iosCertificateName}" --keychain $HOME/Library/Keychains/$keychainName-db --device-family universal --ios-version ${iosVersion} --output-dir $out
# Remove our generated keychain
${deleteKeychain}
''
else
''
# Copy all sources to the output store directory.
# Why? Debug application include *.js files, which are symlinked into their
# sources. If they are not copied, we have dangling references to the
# temp folder.
cp -av * $out
cd $out
# We need to consult a real home directory to find the available simulators
export HOME=/Users/$(whoami)
# Configure the path to Xcode
titanium --config-file $TMPDIR/config.json --no-colors config paths.xcode ${xcodeBaseDir}
# Link the modules folder
if [ ! -e modules ]
then
ln -s ${titaniumsdk}/modules modules
createdModulesSymlink=1
fi
# Execute the build
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target simulator --build-only --device-family universal --ios-version ${iosVersion} --output-dir $out
# Remove the modules symlink
if [ "$createdModulesSymlink" = "1" ]
then
rm $out/modules
fi
''}
''
else throw "Target: ${target} is not supported!"}
'';
installPhase = ''
mkdir -p $out
${if target == "android" && release then ""
else
if target == "android" then
''cp "$(ls build/android/bin/*.apk | grep -v '\-unsigned.apk')" $out''
else if target == "iphone" && release then
''
cp -av build/iphone/build/* $out
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
${stdenv.lib.optionalString enableWirelessDistribution ''
appname=$(basename $out/*.ipa .ipa)
bundleId=$(grep '<id>[a-zA-Z0-9.]*</id>' tiapp.xml | sed -e 's|<id>||' -e 's|</id>||' -e 's/ //g')
version=$(grep '<version>[a-zA-Z0-9.]*</version>' tiapp.xml | sed -e 's|<version>||' -e 's|</version>||' -e 's/ //g')
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=$bundleId\&amp;version=$version\&amp;title=$appname|" ${../xcodeenv/install.html.template} > "$out/$appname.html"
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
''}
''
else if target == "iphone" then ""
else throw "Target: ${target} is not supported!"}
${if target == "android" then ''
mkdir -p $out/nix-support
echo "file binary-dist \"$(ls $out/*.apk)\"" > $out/nix-support/hydra-build-products
'' else ""}
titanium config --config-file $TMPDIR/config.json --no-colors android.sdkPath ${androidsdk}/libexec/android-sdk
export PATH=${androidsdk}/libexec/android-sdk/tools:$(echo ${androidsdk}/libexec/android-sdk/build-tools/android-*):$PATH
export GRADLE_USER_HOME=$TMPDIR/gradle
${if release then ''
${stdenv.lib.optionalString stdenv.isDarwin ''
# Signing the app does not work with OpenJDK on macOS, use host SDK instead
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
''}
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target dist-playstore --keystore ${androidKeyStore} --alias "${androidKeyAlias}" --store-password "${androidKeyStorePassword}" --output-dir $out
'' else ''
titanium build --config-file $TMPDIR/config.json --no-colors --force --platform android --target emulator --build-only -B foo --output $out
''}
''
else if target == "iphone" then ''
# Configure the path to Xcode
titanium --config-file $TMPDIR/config.json --no-colors config paths.xcode ${xcodeBaseDir}
# Link the modules folder
if [ ! -e modules ]
then
ln -s ${titaniumsdk}/modules modules
createdModulesSymlink=1
fi
${if release then ''
# Create a keychain with the component hash name (should always be unique)
export keychainName=$(basename $out)
security create-keychain -p "" $keychainName
security default-keychain -s $keychainName
security unlock-keychain -p "" $keychainName
security import ${iosCertificate} -k $keychainName -P "${iosCertificatePassword}" -A
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
provisioningId=$(grep UUID -A1 -a ${iosMobileProvisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
# Ensure that the requested provisioning profile can be found
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision" ]
then
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
cp ${iosMobileProvisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$provisioningId.mobileprovision"
fi
# Take precautions to prevent concurrent builds blocking the keychain
while [ -f $HOME/lock-keychain ]
do
echo "Keychain locked, waiting for a couple of seconds, or remove $HOME/lock-keychain to unblock..."
sleep 3
done
touch $HOME/lock-keychain
security default-keychain -s $keychainName
# Do the actual build
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target ${if iosBuildStore then "dist-appstore" else "dist-adhoc"} --pp-uuid $provisioningId --distribution-name "${iosCertificateName}" --keychain $HOME/Library/Keychains/$keychainName-db --device-family universal --ios-version ${iosVersion} --output-dir $out
# Remove our generated keychain
${deleteKeychain}
'' else ''
# Copy all sources to the output store directory.
# Why? Debug application include *.js files, which are symlinked into their
# sources. If they are not copied, we have dangling references to the
# temp folder.
cp -av * $out
cd $out
# Execute the build
titanium build --config-file $TMPDIR/config.json --force --no-colors --platform ios --target simulator --build-only --device-family universal --ios-version ${iosVersion} --output-dir $out
# Remove the modules symlink
if [ "$createdModulesSymlink" = "1" ]
then
rm $out/modules
fi
''}
'' else throw "Target: ${target} is not supported!"}
'';
installPhase = ''
${if target == "android" then ''
${if release then ""
else ''
cp "$(ls build/android/bin/*.apk | grep -v '\-unsigned.apk')" $out
''}
mkdir -p $out/nix-support
echo "file binary-dist \"$(ls $out/*.apk)\"" > $out/nix-support/hydra-build-products
''
else if target == "iphone" then
if release then ''
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
${stdenv.lib.optionalString enableWirelessDistribution ''
appname="$(basename "$out/*.ipa" .ipa)"
bundleId=$(grep '<id>[a-zA-Z0-9.]*</id>' tiapp.xml | sed -e 's|<id>||' -e 's|</id>||' -e 's/ //g')
version=$(grep '<version>[a-zA-Z0-9.]*</version>' tiapp.xml | sed -e 's|<version>||' -e 's|</version>||' -e 's/ //g')
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=$bundleId\&amp;version=$version\&amp;title=$appname|" ${../xcodeenv/install.html.template} > "$out/$appname.html"
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
''}
''
else ""
else throw "Target: ${target} is not supported!"}
'';
failureHook = stdenv.lib.optionalString (release && target == "iphone") deleteKeychain;
}
} // extraArgs)

View File

@ -1,27 +1,19 @@
{pkgs, xcodeVersion ? "9.2", xcodeBaseDir ? "/Applications/Xcode.app", tiVersion ? "7.1.0.GA"}:
{pkgs, pkgs_i686, androidenv, xcodeenv, tiVersion ? "7.1.0.GA"}:
rec {
androidenv = pkgs.androidenv;
xcodeenv = if pkgs.stdenv.hostPlatform.system == "x86_64-darwin" then pkgs.xcodeenv.override {
version = xcodeVersion;
inherit xcodeBaseDir;
} else null;
titaniumsdk = let
titaniumSdkFile = if tiVersion == "6.3.1.GA" then ./titaniumsdk-6.3.nix
else if tiVersion == "7.1.0.GA" then ./titaniumsdk-7.1.nix
titaniumSdkFile = if tiVersion == "7.1.0.GA" then ./titaniumsdk-7.1.nix
else throw "Titanium version not supported: "+tiVersion;
in
import titaniumSdkFile {
inherit (pkgs) stdenv fetchurl unzip makeWrapper python jdk;
inherit (pkgs) stdenv fetchurl unzip makeWrapper;
};
buildApp = import ./build-app.nix {
inherit (pkgs) stdenv python which file jdk nodejs;
inherit (pkgs.nodePackages_6_x) alloy titanium;
inherit (androidenv) androidsdk;
inherit (xcodeenv) xcodewrapper;
inherit titaniumsdk xcodeBaseDir;
inherit (pkgs.nodePackages_8_x) alloy titanium;
inherit (androidenv) composeAndroidPackages;
inherit (xcodeenv) composeXcodeWrapper;
inherit titaniumsdk;
};
}

View File

@ -1,91 +0,0 @@
{ nixpkgs ? <nixpkgs>
, systems ? [ "x86_64-linux" "x86_64-darwin" ]
, xcodeVersion ? "9.2"
, xcodeBaseDir ? "/Applications/Xcode.app"
, tiVersion ? "7.1.0.GA"
, rename ? false
, newBundleId ? "com.example.kitchensink", iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? "Example", iosCertificatePassword ? "", iosVersion ? "11.2"
, enableWirelessDistribution ? false, installURL ? null
}:
let
pkgs = import nixpkgs {};
in
rec {
kitchensink_android_debug = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./kitchensink {
inherit (pkgs) fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion xcodeBaseDir tiVersion; };
inherit tiVersion;
target = "android";
});
kitchensink_android_release = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./kitchensink {
inherit (pkgs) fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion xcodeBaseDir tiVersion; };
inherit tiVersion;
target = "android";
release = true;
});
emulate_kitchensink_debug = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./emulate-kitchensink {
inherit (pkgs) androidenv;
kitchensink = builtins.getAttr system kitchensink_android_debug;
});
emulate_kitchensink_release = pkgs.lib.genAttrs systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
import ./emulate-kitchensink {
inherit (pkgs) androidenv;
kitchensink = builtins.getAttr system kitchensink_android_release;
});
} // (if builtins.elem "x86_64-darwin" systems then
let
pkgs = import nixpkgs { system = "x86_64-darwin"; };
in
rec {
kitchensink_ios_development = import ./kitchensink {
inherit (pkgs) fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion xcodeBaseDir tiVersion; };
inherit tiVersion iosVersion;
target = "iphone";
};
simulate_kitchensink = import ./simulate-kitchensink {
inherit (pkgs) stdenv;
xcodeenv = pkgs.xcodeenv.override { version = xcodeVersion; inherit xcodeBaseDir; };
kitchensink = kitchensink_ios_development;
bundleId = if rename then newBundleId else "com.appcelerator.kitchensink";
};
} else {}) // (if rename then
let
pkgs = import nixpkgs { system = "x86_64-darwin"; };
in
{
kitchensink_ipa = import ./kitchensink {
inherit (pkgs) stdenv fetchgit;
titaniumenv = pkgs.titaniumenv.override { inherit xcodeVersion xcodeBaseDir tiVersion; };
target = "iphone";
inherit tiVersion;
release = true;
rename = true;
inherit newBundleId iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword iosVersion;
inherit enableWirelessDistribution installURL;
};
}
else {})

View File

@ -1,10 +0,0 @@
{androidenv, kitchensink}:
androidenv.emulateApp {
name = "emulate-${kitchensink.name}";
app = kitchensink;
platformVersion = "16";
useGoogleAPIs = true;
package = "com.appcelerator.kitchensink";
activity = ".KitchensinkActivity";
}

View File

@ -1,44 +0,0 @@
{ titaniumenv, fetchgit, target, androidPlatformVersions ? [ "25" "26" ], tiVersion ? "7.1.0.GA", release ? false
, rename ? false, stdenv ? null, newBundleId ? null, iosMobileProvisioningProfile ? null, iosCertificate ? null, iosCertificateName ? null, iosCertificatePassword ? null, iosVersion ? "11.2"
, enableWirelessDistribution ? false, installURL ? null
}:
assert rename -> (stdenv != null && newBundleId != null && iosMobileProvisioningProfile != null && iosCertificate != null && iosCertificateName != null && iosCertificatePassword != null);
let
src = fetchgit {
url = https://github.com/appcelerator/kitchensink-v2.git;
rev = "94364df2ef60a80bd354a4273e3cb5f4c5185537";
sha256 = "0q4gzidpsq401frkngy4yk5kqvm8dz00ls74bw3fnpvg4714d6gf";
};
# Rename the bundle id to something else
renamedSrc = stdenv.mkDerivation {
name = "KitchenSink-renamedsrc";
inherit src;
buildPhase = ''
sed -i -e "s|com.appcelerator.kitchensink|${newBundleId}|" tiapp.xml
'';
installPhase = ''
mkdir -p $out
mv * $out
'';
};
in
titaniumenv.buildApp {
name = "KitchenSink-${target}-${if release then "release" else "debug"}";
src = if rename then renamedSrc else src;
preBuild = ''
sed -i -e "s|23|25|" tiapp.xml
''; # Raise minimum android SDK from 23 to 25
inherit tiVersion;
inherit target androidPlatformVersions release;
androidKeyStore = ./keystore;
androidKeyAlias = "myfirstapp";
androidKeyStorePassword = "mykeystore";
inherit iosMobileProvisioningProfile iosCertificate iosCertificateName iosCertificatePassword iosVersion;
inherit enableWirelessDistribution installURL;
}

View File

@ -1,10 +0,0 @@
#!/bin/sh -e
( echo "John Doe"
echo "My Company"
echo "My Organization"
echo "My City"
echo "My State"
echo "US"
echo "yes"
) | keytool --genkeypair --alias myfirstapp --keystore ./keystore --storepass mykeystore

View File

@ -1,7 +0,0 @@
{xcodeenv, kitchensink, bundleId}:
xcodeenv.simulateApp {
name = "simulate-${kitchensink.name}";
inherit bundleId;
app = "${kitchensink}/build/iphone/build/Products/Debug-iphonesimulator";
}

View File

@ -1,43 +0,0 @@
{stdenv, fetchurl, unzip, makeWrapper}:
stdenv.mkDerivation {
name = "mobilesdk-6.3.1.GA";
src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux") then fetchurl {
url = http://builds.appcelerator.com/mobile/6_3_X/mobilesdk-6.3.1.v20171101154403-linux.zip;
sha256 = "0g8dqqf5ffa7ll3rqm5naywipnv2vvfxcj9fmqg1wnvvxf0rflqj";
}
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
url = http://builds.appcelerator.com/mobile/6_3_X/mobilesdk-6.3.1.v20171101154403-osx.zip;
sha256 = "00bm8vv70mg4kd7jvmxd1bfqafv6zdpdx816i0hvf801zwnak4nj";
}
else throw "Platform: ${stdenv.hostPlatform.system} not supported!";
buildInputs = [ unzip makeWrapper ];
buildCommand = ''
mkdir -p $out
cd $out
(yes y | unzip $src) || true
# Rename ugly version number
cd mobilesdk/*
mv * 6.3.1.GA
cd *
${stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-darwin") ''
# Fixes a bad archive copying error when generating an IPA file
sed -i -e "s|cp -rf|/bin/cp -rf|" iphone/cli/commands/_build.js
''}
# Patch some executables
${if stdenv.hostPlatform.system == "i686-linux" then
''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
''
else if stdenv.hostPlatform.system == "x86_64-linux" then
''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
''
else ""}
'';
}

View File

@ -35,7 +35,7 @@ let
sha256 = "11nwdb9y84cghcx319nsjjf9m035s4s1184zrhzpvaxq2wvqhbhx";
};
# Put the download plugins in a fake Maven repository
# Put the downloaded plugins in a fake Maven repository
fakeMavenRepo = stdenv.mkDerivation {
name = "fake-maven-repo";
buildCommand = ''
@ -54,15 +54,15 @@ let
in
stdenv.mkDerivation {
name = "mobilesdk-7.1.0.GA";
src = if (stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux") then fetchurl {
src = if (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux") then fetchurl {
url = http://builds.appcelerator.com/mobile/7_1_X/mobilesdk-7.1.0.v20180314133955-linux.zip;
sha256 = "18b3jnr65sdn5wj191bcl48gvhyklxmighxakv4vrz1fb59kyvqn";
}
else if stdenv.hostPlatform.system == "x86_64-darwin" then fetchurl {
else if stdenv.system == "x86_64-darwin" then fetchurl {
url = http://builds.appcelerator.com/mobile/7_1_X/mobilesdk-7.1.0.v20180314133955-osx.zip;
sha256 = "1f62616biwsw1fqxz2sq7lpa6bsfjazffliplyf5dpnh298cnc1m";
}
else throw "Platform: ${stdenv.hostPlatform.system} not supported!";
else throw "Platform: ${stdenv.system} not supported!";
buildInputs = [ unzip makeWrapper ];
@ -89,11 +89,11 @@ stdenv.mkDerivation {
# Patch some executables
${if stdenv.hostPlatform.system == "i686-linux" then
${if stdenv.system == "i686-linux" then
''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 android/titanium_prep.linux32
''
else if stdenv.hostPlatform.system == "x86_64-linux" then
else if stdenv.system == "x86_64-linux" then
''
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 android/titanium_prep.linux64
''

View File

@ -1,14 +1,13 @@
{stdenv, xcodewrapper}:
{stdenv, composeXcodeWrapper}:
{ name
, src
, sdkVersion ? "11.2"
, sdkVersion ? "11.3"
, target ? null
, configuration ? null
, scheme ? null
, sdk ? null
, xcodeFlags ? ""
, release ? false
, codeSignIdentity ? null
, certificateFile ? null
, certificatePassword ? null
, provisioningProfile ? null
@ -18,24 +17,23 @@
, enableWirelessDistribution ? false
, installURL ? null
, bundleId ? null
, version ? null
, title ? null
, meta ? {}
}:
, appVersion ? null
, ...
}@args:
assert release -> codeSignIdentity != null && certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null;
assert enableWirelessDistribution -> installURL != null && bundleId != null && version != null && title != null;
assert release -> certificateFile != null && certificatePassword != null && provisioningProfile != null && signMethod != null;
assert enableWirelessDistribution -> installURL != null && bundleId != null && appVersion != null;
let
# Set some default values here
_target = if target == null then name else target;
_configuration = if configuration == null
then
if release then "Release" else "Debug"
else configuration;
_sdk = if sdk == null
then
if release then "iphoneos" + sdkVersion else "iphonesimulator" + sdkVersion
@ -46,41 +44,45 @@ let
security default-keychain -s login.keychain
security delete-keychain $keychainName
'';
xcodewrapperFormalArgs = builtins.functionArgs composeXcodeWrapper;
xcodewrapperArgs = builtins.intersectAttrs xcodewrapperFormalArgs args;
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
extraArgs = removeAttrs args ([ "name" "scheme" "xcodeFlags" "release" "certificateFile" "certificatePassword" "provisioningProfile" "signMethod" "generateIPA" "generateXCArchive" "enableWirelessDistribution" "installURL" "bundleId" "version" ] ++ builtins.attrNames xcodewrapperFormalArgs);
in
stdenv.mkDerivation {
name = stdenv.lib.replaceChars [" "] [""] name;
inherit src;
inherit meta;
stdenv.mkDerivation ({
name = stdenv.lib.replaceChars [" "] [""] name; # iOS app names can contain spaces, but in the Nix store this is not allowed
buildInputs = [ xcodewrapper ];
buildPhase = ''
${stdenv.lib.optionalString release ''
export HOME=/Users/$(whoami)
keychainName="$(basename $out)"
# Create a keychain
security create-keychain -p "" $keychainName
security default-keychain -s $keychainName
security unlock-keychain -p "" $keychainName
# Import the certificate into the keychain
security import ${certificateFile} -k $keychainName -P "${certificatePassword}" -A
export HOME=/Users/$(whoami)
keychainName="$(basename $out)"
# Grant the codesign utility permissions to read from the keychain
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
# Determine provisioning ID
PROVISIONING_PROFILE=$(grep UUID -A1 -a ${provisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
# Create a keychain
security create-keychain -p "" $keychainName
security default-keychain -s $keychainName
security unlock-keychain -p "" $keychainName
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$PROVISIONING_PROFILE.mobileprovision" ]
then
# Copy provisioning profile into the home directory
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
cp ${provisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$PROVISIONING_PROFILE.mobileprovision"
fi
# Check whether the identity can be found
security find-identity -p codesigning $keychainName
''}
# Import the certificate into the keychain
security import ${certificateFile} -k $keychainName -P "${certificatePassword}" -A
# Grant the codesign utility permissions to read from the keychain
security set-key-partition-list -S apple-tool:,apple: -s -k "" $keychainName
# Determine provisioning ID
PROVISIONING_PROFILE=$(grep UUID -A1 -a ${provisioningProfile} | grep -o "[-A-Za-z0-9]\{36\}")
if [ ! -f "$HOME/Library/MobileDevice/Provisioning Profiles/$PROVISIONING_PROFILE.mobileprovision" ]
then
# Copy provisioning profile into the home directory
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
cp ${provisioningProfile} "$HOME/Library/MobileDevice/Provisioning Profiles/$PROVISIONING_PROFILE.mobileprovision"
fi
# Check whether the identity can be found
security find-identity -p codesigning $keychainName
''}
# Do the building
export LD=clang # To avoid problem with -isysroot parameter that is unrecognized by the stock ld. Comparison with an impure build shows that it uses clang instead. Ugly, but it works
@ -116,10 +118,11 @@ stdenv.mkDerivation {
# Add IPA to Hydra build products
mkdir -p $out/nix-support
echo "file binary-dist \"$(echo $out/*.ipa)\"" > $out/nix-support/hydra-build-products
${stdenv.lib.optionalString enableWirelessDistribution ''
appname=$(basename $out/*.ipa .ipa)
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=${bundleId}\&amp;version=${version}\&amp;title=$appname|" ${./install.html.template} > $out/$appname.html
# Add another hacky build product that enables wireless adhoc installations
appname="$(basename "$out/*.ipa" .ipa)"
sed -e "s|@INSTALL_URL@|${installURL}?bundleId=${bundleId}\&amp;version=${appVersion}\&amp;title=$appname|" ${./install.html.template} > $out/$appname.html
echo "doc install \"$out/$appname.html\"" >> $out/nix-support/hydra-build-products
''}
''}
@ -127,13 +130,13 @@ stdenv.mkDerivation {
mkdir -p $out
mv "${name}.xcarchive" $out
''}
# Delete our temp keychain
${deleteKeychain}
''}
'';
failureHook = stdenv.lib.optionalString release deleteKeychain;
installPhase = "true";
}
} // extraArgs)

View File

@ -1,4 +1,7 @@
{stdenv, version, xcodeBaseDir}:
{stdenv}:
{version ? "9.3", xcodeBaseDir ? "/Applications/Xcode.app"}:
assert stdenv.isDarwin;
stdenv.mkDerivation {
name = "xcode-wrapper-"+version;
@ -9,6 +12,7 @@ stdenv.mkDerivation {
ln -s /usr/bin/security
ln -s /usr/bin/codesign
ln -s /usr/bin/xcrun
ln -s /usr/bin/plutil
ln -s "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild"
ln -s "${xcodeBaseDir}/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator"

View File

@ -1,15 +1,15 @@
{stdenv, version ? "9.2", xcodeBaseDir ? "/Applications/Xcode.app"}:
{stdenv}:
rec {
xcodewrapper = import ./xcodewrapper.nix {
inherit stdenv version xcodeBaseDir;
composeXcodeWrapper = import ./compose-xcodewrapper.nix {
inherit stdenv;
};
buildApp = import ./build-app.nix {
inherit stdenv xcodewrapper;
inherit stdenv composeXcodeWrapper;
};
simulateApp = import ./simulate-app.nix {
inherit stdenv xcodewrapper;
inherit stdenv composeXcodeWrapper;
};
}

View File

@ -4,14 +4,14 @@
<head>
<title>Install IPA</title>
</head>
<body>
<a id="forwardlink" href="@INSTALL_URL@">Go to the install page or wait a second</a>
<script type="text/javascript">
setTimeout(function() {
var link = document.getElementById('forwardlink');
if(document.createEvent) {
var eventObj = document.createEvent('MouseEvents');
eventObj.initEvent('click', true, false);

View File

@ -1,47 +1,56 @@
{stdenv, xcodewrapper}:
{name, bundleId, app}:
{stdenv, composeXcodeWrapper}:
{name, app ? null, bundleId ? null, ...}@args:
assert app != null -> bundleId != null;
let
xcodewrapperArgs = builtins.intersectAttrs (builtins.functionArgs composeXcodeWrapper) args;
xcodewrapper = composeXcodeWrapper xcodewrapperArgs;
in
stdenv.mkDerivation {
name = stdenv.lib.replaceChars [" "] [""] name;
buildCommand = ''
mkdir -p $out/bin
cat > $out/bin/run-test-simulator << "EOF"
#! ${stdenv.shell} -e
if [ "$1" = "" ]
then
# Show the user the possibile UDIDs and let him pick one, if none is provided as a command-line parameter
xcrun simctl list
echo "Please provide a UDID of a simulator:"
read udid
else
# If a parameter has been provided, consider that a device UDID and use that
udid="$1"
fi
# Open the simulator instance
open -a "$(readlink "${xcodewrapper}/bin/Simulator")" --args -CurrentDeviceUDID $udid
# Copy the app and restore the write permissions
appTmpDir=$(mktemp -d -t appTmpDir)
cp -r "$(echo ${app}/*.app)" "$appTmpDir"
chmod -R 755 "$(echo $appTmpDir/*.app)"
# Wait for the simulator to start
echo "Press enter when the simulator is started..."
read
# Install the app
xcrun simctl install "$udid" "$(echo $appTmpDir/*.app)"
# Remove the app tempdir
rm -Rf $appTmpDir
# Launch the app in the simulator
xcrun simctl launch $udid "${bundleId}"
EOF
chmod +x $out/bin/run-test-simulator
${stdenv.lib.optionalString (app != null) ''
# Copy the app and restore the write permissions
appTmpDir=$(mktemp -d -t appTmpDir)
cp -r "$(echo ${app}/*.app)" "$appTmpDir"
chmod -R 755 "$(echo $appTmpDir/*.app)"
# Wait for the simulator to start
echo "Press enter when the simulator is started..."
read
# Install the app
xcrun simctl install "$udid" "$(echo $appTmpDir/*.app)"
# Remove the app tempdir
rm -Rf $appTmpDir
# Launch the app in the simulator
xcrun simctl launch $udid "${bundleId}"
EOF
chmod +x $out/bin/run-test-simulator
''}
'';
}

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, makeWrapper, jre, buildTools }:
{ stdenv, fetchurl, makeWrapper, jre, build-tools }:
stdenv.mkDerivation rec {
name = "apktool-${version}";
@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
mkdir -p "$out/bin"
makeWrapper "${jre}/bin/java" "$out/bin/apktool" \
--add-flags "-jar $out/libexec/apktool/apktool.jar" \
--prefix PATH : "${buildTools.v25_0_1}/build-tools/25.0.1/"
--prefix PATH : "${builtins.head build-tools}/libexec/android-sdk/build-tools/28.0.3"
'';
meta = with stdenv.lib; {

View File

@ -3,7 +3,7 @@
, ninja
, pkgconfig
, platformTools
, platform-tools
, ffmpeg
, SDL2
}:
@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
ln -s "${prebuilt_server}" "$out/share/scrcpy/scrcpy-server.jar"
# runtime dep on `adb` to push the server
wrapProgram "$out/bin/scrcpy" --prefix PATH : "${platformTools}/bin"
wrapProgram "$out/bin/scrcpy" --prefix PATH : "${platform-tools}/bin"
'';
meta = with stdenv.lib; {

View File

@ -53,7 +53,7 @@ in lib.init bootStages ++ [
cc = if crossSystem.useiOSPrebuilt or false
then buildPackages.darwin.iosSdkPkgs.clang
else if crossSystem.useAndroidPrebuilt or false
then buildPackages.androidenv."androidndkPkgs_${crossSystem.ndkVer}".gcc
then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".gcc
else buildPackages.gcc;
extraNativeBuildInputs = old.extraNativeBuildInputs

View File

@ -29,7 +29,7 @@ rustPlatform.buildRustPackage rec {
patches = [
(substituteAll {
src = ./paths.patch;
adb = "${androidenv.platformTools}/bin/adb";
adb = "${androidenv.androidPkgs_9_0.platform-tools}/bin/adb";
inherit apk;
})
];

View File

@ -539,7 +539,7 @@ in
ansifilter = callPackage ../tools/text/ansifilter {};
apktool = callPackage ../development/tools/apktool {
buildTools = androidenv.buildTools;
inherit (androidenv.androidPkgs_9_0) build-tools;
};
appimage-run = callPackage ../tools/package-management/appimage-run {};
@ -815,26 +815,29 @@ in
ssh-agents = callPackage ../tools/networking/ssh-agents { };
titaniumenv = callPackage ../development/mobile/titaniumenv { };
titaniumenv = callPackage ../development/mobile/titaniumenv {
pkgs_i686 = pkgsi686Linux;
};
abootimg = callPackage ../development/mobile/abootimg {};
adbfs-rootless = callPackage ../development/mobile/adbfs-rootless {
adb = androidenv.platformTools;
adb = androidenv.androidPkgs_9_0.platform-tools;
};
adb-sync = callPackage ../development/mobile/adb-sync { };
adb-sync = callPackage ../development/mobile/adb-sync {
inherit (androidenv.androidPkgs_9_0) platform-tools;
};
androidenv = callPackage ../development/mobile/androidenv {
pkgs_i686 = pkgsi686Linux;
licenseAccepted = (config.android_sdk.accept_license or false);
licenseAccepted = config.android_sdk.accept_license or false;
};
inherit (androidenv) androidndk;
androidndkPkgs = androidndkPkgs_18b;
androidndkPkgs_18b = (callPackage ../development/androidndk-pkgs {})."18b";
androidsdk = androidenv.androidsdk_8_0;
androidsdk_extras = res.androidenv.androidsdk_8_0_extras;
androidsdk_9_0 = androidenv.androidPkgs_9_0.androidsdk;
webos = recurseIntoAttrs {
cmake-modules = callPackage ../development/mobile/webos/cmake-modules.nix { };
@ -2676,7 +2679,7 @@ in
flamerobin = callPackage ../applications/misc/flamerobin { };
flashtool = pkgsi686Linux.callPackage ../development/mobile/flashtool {
platformTools = androidenv.platformTools;
inherit (androidenv.androidPkgs_9_0) platform-tools;
};
flashrom = callPackage ../tools/misc/flashrom { };
@ -5313,7 +5316,7 @@ in
};
scrcpy = callPackage ../misc/scrcpy {
inherit (androidenv) platformTools;
inherit (androidenv.androidPkgs_9_0) platform-tools;
};
screen-message = callPackage ../tools/X11/screen-message { };
@ -9350,7 +9353,7 @@ in
# TODO(@Ericson2314): Build bionic libc from source
bionic = assert stdenv.hostPlatform.useAndroidPrebuilt;
androidenv."androidndkPkgs_${stdenv.hostPlatform.ndkVer}".libraries;
pkgs."androidndkPkgs_${stdenv.hostPlatform.ndkVer}".libraries;
bobcat = callPackage ../development/libraries/bobcat { };