mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
androidndk: Add makeStandaloneToolchain
support
Example: ``` let toolchain = (androidenv.androidndk.makeStandaloneToolchain 24 "arm64"); in ... ```
This commit is contained in:
parent
48bdf31f58
commit
dd0b3dafc9
@ -1,12 +1,18 @@
|
||||
{ stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
|
||||
, coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
|
||||
, platformTools, python3, libcxx, version, sha256, bash
|
||||
, platformTools, python3, libcxx, version, sha256, 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
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
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;
|
||||
|
||||
@ -47,7 +53,7 @@ stdenv.mkDerivation rec {
|
||||
''
|
||||
patch -p1 \
|
||||
--no-backup-if-mismatch \
|
||||
-d $out/libexec/${name} < ${ ./. + "/make_standalone_toolchain.py_${version}.patch" }
|
||||
-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
|
||||
@ -97,4 +103,8 @@ stdenv.mkDerivation rec {
|
||||
hydraPlatforms = [];
|
||||
license = stdenv.lib.licenses.asl20;
|
||||
};
|
||||
}
|
||||
};
|
||||
passthru = {
|
||||
inherit makeStandaloneToolchain;
|
||||
};
|
||||
in lib.extendDerivation true passthru (ndk fullNDK)
|
||||
|
Loading…
Reference in New Issue
Block a user