From a86078813a07b6865e64d3711d029745b7972647 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Tue, 15 Nov 2022 16:10:52 -0500 Subject: [PATCH] cross-compile python3.10 for aarch64-android --- flake.nix | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 3713974..034fc6d 100644 --- a/flake.nix +++ b/flake.nix @@ -111,9 +111,6 @@ ''; }; in { - - packages.python = pkgs.pkgsCross.aarch64-android.tahoe-lafs; - packages.apk = pkgs.androidenv.buildApp { name = "PrivateStorage Mobile"; src = ./app; @@ -153,6 +150,8 @@ ANDROID_PLATFORM_VERSION = "${platformVersion}"; + # https://nix.dev/tutorials/cross-compilation + buildInputs = with pkgs; [ gradle-wrapper ant @@ -212,5 +211,43 @@ nativeBuildInputs = with pkgs; getBuildInputs (drv: drv.nativeBuildInputs) [ openssl libffi python39 ]; }; + } // { + packages.aarch64-android.host-python310 = (pkgs.pkgsCross.aarch64-android.python310.override { + # Turn off all the things. Each one might be broken for + # cross-compilation and even if not we don't need them for this build + # Python. We just need it to report the right platform info. + mimetypesSupport = false; + x11Support = false; + bluezSupport = false; + sqlite = null; + openssl = null; + tzdata = null; + readline = null; + }).overrideAttrs (old: { + # Turn off even more things which aren't parameters to the Python + # expression. + + # These drag in an aarch64-android bash which fails to build. + preFixup = null; + postPatch = null; + + # This drags in a -lcrypt dependency which isn't satisfied by Google + # Android Bionic. + LIBS = null; + }); + + # packages.aarch64-android.zfec = self.packages.aarch64-android.host-python310.buildPythonPackage; + # let + # build-python = pkgs.pkgsCross.${system}.python310; + # host-python = pkgs.pkgsCross.aarch64-android.python310; + + # build-pyenv = build-python.withPackages (ps: [ (ps.callPackage ./crossenv.nix) ]); + # in + # pkgs.mkDerivation { + # name = "python3.10-zfec"; + # version = "2.3.4"; # XXX + + # src = fetchPypi + # }; }); } -- GitLab