WIP: compile proot dynamically with non-prebuilt SDK

This commit is contained in:
Alexander Sosedkin 2022-06-01 01:01:32 +02:00
parent a3f92c0e0d
commit dda3bd3ef0
4 changed files with 28 additions and 15 deletions

View file

@ -82,9 +82,8 @@ in
environment.files = { environment.files = {
inherit login loginInner; inherit login loginInner;
prootStatic = "/nix/store/fmkdds5jp3ddx8mkb63fshkiiangw4ny-proot-termux-aarch64-unknown-linux-android-unstable-2021-11-21"; prootStatic = "/nix/store/y19q9ax61119i0h2b2yyjdw9qy8qp25h-proot-termux-aarch64-unknown-linux-android-unstable-2021-11-21";
}; };
}; };
} }

View file

@ -11,14 +11,14 @@ let
# that one is cool because it could make its way on-device one day, # that one is cool because it could make its way on-device one day,
# but it currently isn't static-friendly: # but it currently isn't static-friendly:
# sdkVer = "30"; sdkVer = "30";
# libc = "bionic"; libc = "bionic";
# useAndroidPrebuilt = false; useAndroidPrebuilt = false;
# useLLVM = true; useLLVM = true;
# use that one instead # use that one instead
sdkVer = "29"; #sdkVer = "29";
useAndroidPrebuilt = true; #useAndroidPrebuilt = true;
}; };
in in

View file

@ -5,7 +5,8 @@
let let
pkgsCross = callPackage ./cross-pkgs.nix { }; pkgsCross = callPackage ./cross-pkgs.nix { };
stdenv = pkgsCross.pkgsStatic.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv; #stdenv = pkgsCross.pkgsStatic.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
stdenv = pkgsCross.stdenv;
in in
callPackage ../proot-termux { callPackage ../proot-termux {

View file

@ -10,20 +10,33 @@ stdenv.mkDerivation {
src = fetchFromGitHub { src = fetchFromGitHub {
repo = "proot"; repo = "proot";
owner = "termux"; owner = "termux";
rev = "7d6bdd9f6cf31144e11ce65648dab2a1e495a7de"; #rev = "7d6bdd9f6cf31144e11ce65648dab2a1e495a7de";
sha256 = "sha256-sbueMoqhOw0eChgp6KOZbhwRnSmDZhHq+jm06mGqxC4="; #sha256 = "sha256-sbueMoqhOw0eChgp6KOZbhwRnSmDZhHq+jm06mGqxC4=";
# 1 step behind 6f12fbee "Implement shmat", use if ashmem.h is missing # 1 step behind 6f12fbee "Implement shmat", use if ashmem.h is missing
#rev = "ffd811ee726c62094477ed335de89fc107cadf17"; rev = "ffd811ee726c62094477ed335de89fc107cadf17";
#sha256 = "1zjblclsybvsrjmq2i0z6prhka268f0609w08dh9vdrbrng117f8"; sha256 = "1zjblclsybvsrjmq2i0z6prhka268f0609w08dh9vdrbrng117f8";
}; };
buildInputs = [ talloc ]; LDFLAGS = [
"-static"
"${talloc}/lib/libtalloc.a"
#"-ltalloc"
#"-shared"
"-Wl,-Bdynamic"
];
#LDFLAGS = [ "-static" "-ltalloc" "-shared" ];
#buildInputs = [ talloc ];
CFLAGS = [ "-I${talloc}/include" "-O3" ];
#LDFLAGS = [ "${talloc}/lib/libtalloc.a" ];
patches = [ ./detranslate-empty.patch ]; patches = [ ./detranslate-empty.patch ];
makeFlags = [ "-Csrc" "V=1" ]; makeFlags = [ "-Csrc" "V=1" ];
CFLAGS = [ "-O3" ];
postPatch = ''
substituteInPlace src/GNUmakefile --replace '-ltalloc' ""
'';
installPhase = '' installPhase = ''
install -D -m 0755 src/proot $out/bin/${outputBinaryName} install -D -m 0755 src/proot $out/bin/${outputBinaryName}