pkgs: use non-prebuilt SDK

This commit is contained in:
Alexander Sosedkin 2022-07-03 19:03:00 +02:00
parent 0de95f9e9f
commit 0ad6321f79
5 changed files with 38 additions and 42 deletions

View file

@ -1,25 +1,19 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, path }:
{ config }:
let
loadNixpkgs = import ../lib/load-nixpkgs.nix;
crossSystem = {
config = "${config.build.arch}-unknown-linux-android";
ndkVer = "21";
# that one is cool because it could make its way on-device one day,
# but it currently isn't static-friendly:
# sdkVer = "30";
# libc = "bionic";
# useAndroidPrebuilt = false;
# useLLVM = true;
# use that one instead
sdkVer = "29";
useAndroidPrebuilt = true;
sdkVer = "32";
libc = "bionic";
useAndroidPrebuilt = false;
useLLVM = true;
isStatic = true;
};
in
loadNixpkgs { inherit crossSystem; }

View file

@ -1,15 +1,13 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ callPackage, tallocStatic }:
let
pkgsCross = callPackage ./cross-pkgs.nix { };
stdenv = pkgsCross.pkgsStatic.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
stdenv = pkgsCross.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
in
callPackage ../proot-termux {
pkgs = pkgsCross;
pkgsCross.callPackage ../proot-termux {
talloc = tallocStatic;
inherit stdenv;
}

View file

@ -1,7 +1,7 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ pkgs, stdenv, callPackage, fetchFromGitHub,
talloc, outputBinaryName ? "proot-static" }:
{ stdenv, fetchFromGitHub, talloc,
static ? true, outputBinaryName ? "proot-static" }:
stdenv.mkDerivation {
pname = "proot-termux";
@ -12,20 +12,26 @@ stdenv.mkDerivation {
owner = "termux";
rev = "5c462a6ecfddd629b1439f38fbb61216d6fcb359";
sha256 = "sha256-XS4js80NsAN2C4jMuISSqMm/DwYpH/stbABaxzoqZcE=";
# 1 step behind 6f12fbee "Implement shmat", use if ashmem.h is missing
#rev = "ffd811ee726c62094477ed335de89fc107cadf17";
#sha256 = "1zjblclsybvsrjmq2i0z6prhka268f0609w08dh9vdrbrng117f8";
};
buildInputs = [ talloc ];
patches = [ ./detranslate-empty.patch ];
makeFlags = [ "-Csrc" "V=1" ];
CFLAGS = [ "-O3" ];
installPhase = ''
install -D -m 0755 src/proot $out/bin/${outputBinaryName}
# ashmem.h is rather small, our needs are even smaller, so just define these:
preConfigure = ''
mkdir -p fake-ashmem/linux; cat > fake-ashmem/linux/ashmem.h << EOF
#include <linux/limits.h>
#include <linux/ioctl.h>
#define __ASHMEMIOC 0x77
#define ASHMEM_NAME_LEN 256
#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
EOF
'';
buildInputs = [ talloc ];
patches = [ ./detranslate-empty.patch ];
makeFlags = [ "-Csrc" "V=1" ];
CFLAGS = [ "-O3" "-I../fake-ashmem" ] ++
(if static then [ "-static" ] else []);
LDFLAGS = if static then [ "-static" ] else [];
preInstall = "${stdenv.cc.targetPrefix}strip src/proot";
installPhase = "install -D -m 0755 src/proot $out/bin/${outputBinaryName}";
}