Skip to content

Commit

Permalink
Attempt further work on android (pardon the many commits i cannot com…
Browse files Browse the repository at this point in the history
…pile locally)
  • Loading branch information
SkySwimmer committed Jun 20, 2024
1 parent 5eceb16 commit cf7c105
Showing 1 changed file with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ cd build/work
# Properties
monorepo="https://github.com/dotnet/runtime"
monobranch="release/8.0"
ndkver="r26d"
apilevel=26

# Download .NET runtime
echo Cloning .NET runtime...
Expand All @@ -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 "$NDK_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-$__AndroidArch/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 -R "$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
Expand Down

0 comments on commit cf7c105

Please sign in to comment.