mirror of
https://github.com/servo/servo.git
synced 2025-09-04 20:18:21 +01:00
Make Android build optional on Nix (#31231)
* Make Android build optional on Nix I want to build Servo without also installing the entire Android SDK. This makes it so Android support is only built if `buildAndroid` is true. Signed-off-by: syvb <me@iter.ca> * Add Android support to nix-shell if SERVO_ANDROID_BUILD set --------- Signed-off-by: syvb <me@iter.ca>
This commit is contained in:
parent
92af41cfeb
commit
f27227b1db
3 changed files with 19 additions and 13 deletions
|
@ -1,6 +1,9 @@
|
|||
# This provides a shell with all the necesarry packages required to run mach and build servo
|
||||
# NOTE: This does not work offline or for nix-build
|
||||
|
||||
{
|
||||
buildAndroid ? false
|
||||
}:
|
||||
with import (builtins.fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/46ae0210ce163b3cba6c7da08840c1d63de9c701.tar.gz";
|
||||
}) {
|
||||
|
@ -11,8 +14,8 @@ with import (builtins.fetchTarball {
|
|||
}))
|
||||
];
|
||||
config = {
|
||||
android_sdk.accept_license = true;
|
||||
allowUnfree = true;
|
||||
android_sdk.accept_license = buildAndroid;
|
||||
allowUnfree = buildAndroid;
|
||||
};
|
||||
};
|
||||
let
|
||||
|
@ -134,22 +137,16 @@ stdenv.mkDerivation rec {
|
|||
|
||||
RUSTC_BOOTSTRAP = "crown";
|
||||
}))
|
||||
|
||||
# for android builds
|
||||
# TODO: make this optional
|
||||
openjdk17_headless
|
||||
androidSdk
|
||||
] ++ (lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.AppKit
|
||||
]) ++ (lib.optionals buildAndroid [
|
||||
# for android builds
|
||||
openjdk17_headless
|
||||
androidSdk
|
||||
]);
|
||||
|
||||
LIBCLANG_PATH = llvmPackages.clang-unwrapped.lib + "/lib/";
|
||||
|
||||
# Required by ./mach build --android
|
||||
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
|
||||
ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${buildToolsVersion}/aapt2";
|
||||
|
||||
# Allow cargo to download crates
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
|
@ -217,4 +214,9 @@ stdenv.mkDerivation rec {
|
|||
export RUSTUP_HOME=$repo_root/.rustup
|
||||
fi
|
||||
'';
|
||||
} // lib.optionalAttrs buildAndroid {
|
||||
# Required by ./mach build --android
|
||||
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
|
||||
ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
|
||||
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${buildToolsVersion}/aapt2";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue