From 3d8caecb00186bcf2d33dd5f933ff86f52ed35e4 Mon Sep 17 00:00:00 2001 From: Sky Swimmer Date: Thu, 20 Jun 2024 10:58:20 +0200 Subject: [PATCH] Attempt further work on android (pardon the many commits i cannot compile locally) --- .../coreclr.sh | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/feraltweaks-bootstrap/scripts/build-crosscompile-android-arm64/coreclr.sh b/feraltweaks-bootstrap/scripts/build-crosscompile-android-arm64/coreclr.sh index 67e30b5..e1b1617 100644 --- a/feraltweaks-bootstrap/scripts/build-crosscompile-android-arm64/coreclr.sh +++ b/feraltweaks-bootstrap/scripts/build-crosscompile-android-arm64/coreclr.sh @@ -8,11 +8,13 @@ elif [ -d launcher/feraltweaks-launcher ]; then cd feraltweaks-bootstrap fi cd build/work - +set -e # Properties monorepo="https://github.com/dotnet/runtime" monobranch="release/8.0" +ndkver="r26d" +apilevel=26 # Download .NET runtime echo Cloning .NET runtime... @@ -25,8 +27,54 @@ cd runtime/repo # Prepare echo Preparing crosscompile... -echo "$(cat eng/common/cross/build-android-rootfs.sh | sed "s/__NDK_Version=.*/__NDK_Version=r26d/g" | sed "s/-linux-x86_64.zip/-linux.zip/g")" > eng/common/cross/build-android-rootfs.sh -bash eng/common/cross/build-android-rootfs.sh arm64 24 || exit 1 + +echo "Setting up toolchains and rootfs..." +mkdir -p "./.tools/android-rootfs/android-ndk-$ndkver" +mkdir -p "./.tools/android-rootfs/lldb" +CROSS_DIR="$(realpath ./.tools/android-rootfs)" +NDK_DIR="$(realpath ./.tools/android-rootfs/android-ndk-$ndkver)" +LLDB_DIR="$(realpath ./.tools/android-rootfs/lldb)" + +echo "Downloading Android NDK $ndkver..." +curl -L "https://dl.google.com/android/repository/android-ndk-$ndkver-linux.zip" --output "$NDK_DIR.zip" -f || exit 1 +echo "Extracting Android NDK..." +LAST="$PWD" +cd "$CROSS_DIR" +unzip "$NDK_DIR.zip" || exit 1 +cd "$LAST" + +echo "Downloading Android LLDB..." +curl -L "https://dl.google.com/android/repository/lldb-2.3.3614996-linux-x86_64.zip" --output "$LLDB_DIR.zip" -f || exit 1 +echo "Extracting Android LLDB..." +LAST="$PWD" +cd "$LLDB_DIR" +unzip "$LLDB_DIR.zip" || exit 1 +cd "$LAST" + +TOOLCHAIN_DIR="$(realpath ./.tools/android-rootfs/android-ndk-$ndkver/toolchains/llvm/prebuilt/linux-x86_64)" + +# Taken from eng/common/cross/build-android-rootfs.sh +echo "Downloading dependencies..." +TMP=$CROSS_DIR/tmp/arm64/ +mkdir -p "$TMP" +__AndroidPackages="libicu" +__AndroidPackages+=" libandroid-glob" +__AndroidPackages+=" liblzma" +__AndroidPackages+=" krb5" +__AndroidPackages+=" openssl" +for path in $(wget -qO- https://packages.termux.dev/termux-main-21/dists/stable/main/binary-aarch64/Packages |\ + grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do + + if [[ "$path" != "Filename:" ]]; then + echo "Working on: $path" + wget -qO- https://packages.termux.dev/termux-main-21/$path | dpkg -x - "$TMP" + fi +done +cp -Rv "$TMP/data/data/com.termux/files/usr/"* "$TOOLCHAIN_DIR/sysroot/usr/" +echo "Generating platform file..." +echo "RID=android.$apilevel-arm64" > "$TOOLCHAIN_DIR/sysroot/android_platform" +# End ported code + echo Switching branch... git checkout "$monobranch" || exit 1 git pull