Browse Source

Add init scripts for NDK and SDK Tools

master
wchen342 2 months ago
parent
commit
fd7c1bee6f
Signed by: wchen342 GPG Key ID: 9C19365D69B04CEC
  1. 5
      base/docker-setup.sh
  2. 26
      ndk/build.sh
  3. 29
      ndk/docker-build.sh
  4. 0
      sdk/art.patch
  5. 0
      sdk/bionic_libc.patch
  6. 20
      sdk/build.sh
  7. 3
      sdk/docker-build.sh
  8. 0
      sdk/external_conscrypt.patch
  9. 0
      sdk/external_icu_android_icu4j.patch
  10. 0
      sdk/external_libxml2.patch
  11. 0
      sdk/frameworks_base.patch
  12. 0
      sdk/hardware_interfaces.patch
  13. 11
      sdk/libcore.patch
  14. 0
      sdk/packages_modules_NeuralNetworks.patch
  15. 0
      sdk/prebuilts_tools.patch
  16. 26
      sdk_tools/build.sh
  17. 17
      sdk_tools/docker-build.sh

5
base/docker-setup.sh

@ -13,10 +13,11 @@ apt install -y repo python-is-python3 openssh-client
# Taken from Ubuntu 18.04
# https://source.android.com/setup/build/initializing#installing-required-packages-ubuntu-1804
apt -y install git-core gnupg flex bison build-essential zip \
apt -y install git gnupg flex bison build-essential zip \
curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev \
libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig tofrodos
libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig tofrodos \
rsync dos2unix pbzip2
# Set up user and working directory
useradd build -m -s /bin/bash

26
ndk/build.sh

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -eu -o pipefail
pushd ../base && source ./setup.sh && popd
container_name="android-rebuilds-ndk"
VERSION='ndk-release-r23'
docker create --name ${container_name} --workdir /home/build/wd --entrypoint "tail" android-rebuilds:base "-f" "/dev/null"
docker start "${container_name}"
# Run build script
docker cp docker-build.sh "${container_name}":/home/build/wd/docker-build.sh
docker exec --user build "${container_name}" bash -c "/home/build/wd/docker-build.sh"
# copy output
# shutdown and remove container
# if docker ps --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
# echo "Stopping container"
# docker stop "${container_name}"
# fi
# if docker ps --all --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
# echo "Removing container"
# docker rm "${container_name}"
# fi

29
ndk/docker-build.sh

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -eux -o pipefail
VERSION='r23' # temporarily before SDK 12 comes out formally
# https://source.android.com/setup/build/building#choose-a-target
TARGET='eng' # user, userdebug, eng
export USER=$(whoami)
export BUILD_NUMBER="${TARGET}-${VERSION}"
# Sync sources
repo init -u https://android.googlesource.com/platform/manifest -b ndk-$VERSION --depth=1
repo sync -c -j4
# Various fixes
# Clone missing libraries
# Clean up and fixes
# Build
# build/envsetup.sh cannot be run with -u
set +u
source build/envsetup.sh
lunch ndk_arm64-${TARGET}
set -u
# win_sdk build linux SDK too
#make -j$(nproc) sdk dist sdk_repo
make -j$(nproc) win_sdk dist sdk_repo

0
SDK/art.patch → sdk/art.patch

0
SDK/bionic_libc.patch → sdk/bionic_libc.patch

20
SDK/build.sh → sdk/build.sh

@ -4,6 +4,7 @@ set -eu -o pipefail
pushd ../base && source ./setup.sh && popd
container_name="android-rebuilds-sdk"
VERSION='s-beta-5' # temporarily before SDK 12 comes out formally
docker create --name ${container_name} --workdir /home/build/wd --entrypoint "tail" android-rebuilds:base "-f" "/dev/null"
docker start "${container_name}"
@ -17,18 +18,21 @@ docker cp external_icu_android_icu4j.patch "${container_name}":/home/build/wd/ex
docker cp external_libxml2.patch "${container_name}":/home/build/wd/external_libxml2.patch
docker cp frameworks_base.patch "${container_name}":/home/build/wd/frameworks_base.patch
docker cp hardware_interfaces.patch "${container_name}":/home/build/wd/hardware_interfaces.patch
docker cp libcore.patch "${container_name}":/home/build/wd/libcore.patch
docker cp prebuilts_tools.patch "${container_name}":/home/build/wd/prebuilts_tools.patch
docker cp packages_modules_NeuralNetworks.patch "${container_name}":/home/build/wd/packages_modules_NeuralNetworks.patch
docker exec --user build "${container_name}" bash -c "/home/build/wd/docker-build.sh"
# copy output
docker cp "${container_name}":/home/build/wd/out/dist/android-sdk_eng.build_linux-x86.zip android-sdk_eng.${VERSION}_linux-x86.zip
docker cp "${container_name}":/home/build/wd/out/dist/android-sdk_eng.build_windows.zip android-sdk_eng.${VERSION}_windows.zip
# shutdown and remove container
# if docker ps --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
# echo "Stopping container"
# docker stop "${container_name}"
# fi
# if docker ps --all --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
# echo "Removing container"
# docker rm "${container_name}"
# fi
if docker ps --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
echo "Stopping container"
docker stop "${container_name}"
fi
if docker ps --all --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
echo "Removing container"
docker rm "${container_name}"
fi

3
SDK/docker-build.sh → sdk/docker-build.sh

@ -52,6 +52,7 @@ pushd external/libxml2 && git apply ../../external_libxml2.patch && popd
# Revert https://android.googlesource.com/platform/frameworks/base/+/061b25ec6f2786662123becbe1c6d5c098922c73%5E%21/#F0
pushd frameworks/base && git apply ../../frameworks_base.patch && popd
pushd hardware/interfaces && git apply ../../hardware_interfaces.patch && popd
pushd libcore && git apply ../../libcore.patch && popd
pushd prebuilts/tools && git apply ../../prebuilts_tools.patch && popd
pushd packages/modules/NeuralNetworks && git apply ../../../packages_modules_NeuralNetworks.patch && popd
@ -59,7 +60,7 @@ pushd packages/modules/NeuralNetworks && git apply ../../../packages_modules_Neu
# build/envsetup.sh cannot be run with -u
set +u
source build/envsetup.sh
lunch aosp_arm64-${TARGET}
lunch sdk_arm64-${TARGET}
set -u
# win_sdk build linux SDK too

0
SDK/external_conscrypt.patch → sdk/external_conscrypt.patch

0
SDK/external_icu_android_icu4j.patch → sdk/external_icu_android_icu4j.patch

0
SDK/external_libxml2.patch → sdk/external_libxml2.patch

0
SDK/frameworks_base.patch → sdk/frameworks_base.patch

0
SDK/hardware_interfaces.patch → sdk/hardware_interfaces.patch

11
sdk/libcore.patch

@ -0,0 +1,11 @@
diff --git a/mmodules/intracoreapi/Android.bp b/mmodules/intracoreapi/Android.bp
--- a/mmodules/intracoreapi/Android.bp
+++ b/mmodules/intracoreapi/Android.bp
@@ -68,7 +68,6 @@ java_sdk_library {
droiddoc_options: [
"--hide-annotation libcore.api.Hide",
"--show-single-annotation libcore.api.IntraCoreApi",
- "--skip-annotation-instance-methods=false",
],
merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],

0
SDK/packages_modules_NeuralNetworks.patch → sdk/packages_modules_NeuralNetworks.patch

0
SDK/prebuilts_tools.patch → sdk/prebuilts_tools.patch

26
sdk_tools/build.sh

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -eu -o pipefail
pushd ../base && source ./setup.sh && popd
container_name="android-rebuilds-studio"
VERSION='main'
docker create --name ${container_name} --workdir /home/build/wd --entrypoint "tail" android-rebuilds:base "-f" "/dev/null"
docker start "${container_name}"
# Run build script
docker cp docker-build.sh "${container_name}":/home/build/wd/docker-build.sh
docker exec --user build "${container_name}" bash -c "/home/build/wd/docker-build.sh"
# copy output
# shutdown and remove container
# if docker ps --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
# echo "Stopping container"
# docker stop "${container_name}"
# fi
# if docker ps --all --format '{{.Names}}' | grep -w "${container_name}" &> /dev/null; then
# echo "Removing container"
# docker rm "${container_name}"
# fi

17
sdk_tools/docker-build.sh

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eux -o pipefail
VERSION='main' # 4.3.0
export USER=$(whoami)
# Sync sources
repo init -u https://android.googlesource.com/platform/manifest -b studio-$VERSION
repo sync -c -j4
# SDK tools
# https://sites.google.com/a/android.com/tools/build/#TOC-Building-the-Linux-and-MacOS-SDK
mkdir -p out/dist
# Build
Loading…
Cancel
Save