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

@ -82,7 +82,7 @@ in
environment.files = { environment.files = {
inherit login loginInner; inherit login loginInner;
prootStatic = "/nix/store/scj2cqyvcra7dcan4y73n0459ac7fms7-proot-termux-aarch64-unknown-linux-android-unstable-2022-05-03"; prootStatic = "/nix/store/wsgnxpmrdmjy7qrsxvp7r5jandbabzjl-proot-termux-static-aarch64-unknown-linux-android-unstable-2022-05-03";
}; };
}; };

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 let
loadNixpkgs = import ../lib/load-nixpkgs.nix; loadNixpkgs = import ../lib/load-nixpkgs.nix;
crossSystem = { crossSystem = {
config = "${config.build.arch}-unknown-linux-android"; config = "${config.build.arch}-unknown-linux-android";
ndkVer = "21"; sdkVer = "32";
libc = "bionic";
# that one is cool because it could make its way on-device one day, useAndroidPrebuilt = false;
# but it currently isn't static-friendly: useLLVM = true;
# sdkVer = "30"; isStatic = true;
# libc = "bionic";
# useAndroidPrebuilt = false;
# useLLVM = true;
# use that one instead
sdkVer = "29";
useAndroidPrebuilt = true;
}; };
in in
loadNixpkgs { inherit crossSystem; } 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 }: { callPackage, tallocStatic }:
let let
pkgsCross = callPackage ./cross-pkgs.nix { }; pkgsCross = callPackage ./cross-pkgs.nix { };
stdenv = pkgsCross.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
stdenv = pkgsCross.pkgsStatic.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
in in
callPackage ../proot-termux { pkgsCross.callPackage ../proot-termux {
pkgs = pkgsCross;
talloc = tallocStatic; talloc = tallocStatic;
inherit stdenv; inherit stdenv;
} }

View file

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

View file

@ -1,11 +1,9 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ pkgs ? (import ../pkgs/lib/load-nixpkgs.nix {}) }: { pkgs ? (import ../pkgs/lib/load-nixpkgs.nix {}) }:
let pkgs.callPackage ../pkgs/proot-termux {
stdenv = pkgs.stdenv; stdenv = pkgs.stdenv;
in static = false;
pkgs.callPackage ../pkgs/proot-termux { outputBinaryName = "proot";
outputBinaryName = "proot"; }
inherit pkgs;
}