LeOS-GSI/build-20.sh

190 lines
5.5 KiB
Bash

#!/bin/bash
MONTH="date +%B"
echo
echo "--------------------------------------"
echo " LeOS-20 Buildbot "
echo " by "
echo " harvey186 "
echo "--------------------------------------"
echo
git clone http://62.178.96.192:3000/JoJo/LeOS-GSI.git -b LeOS-20
# external/webview
# LeOS
# patches
# prebuilds/prebuildapks - from U
# vendor/LeOS
# venodor/addons
# sas-creator
set -e
initRepos() {
if [ ! -d .repo ]; then
echo "--> Initializing workspace"
repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 --git-lfs
git clone https://github.com/AndyCGYan/lineage_build_unified lineage_build_unified -b lineage-20-td
git clone https://github.com/AndyCGYan/lineage_patches_unified lineage_patches_unified -b lineage-20-td
rm -R lineage_patches_unified/patches_treble/vendor_hardware_overlay/
rm -R lineage_patches_unified/patches_platform/packages_apps_Messaging
rm lineage_patches_unified/patches_treble/device_phh_treble/0005-treble-Switch-to-MindTheGapps.patch
rm lineage_patches_unified/patches_treble/device_phh_treble/0009-treble-Import-prebuilt-PHH-Superuser.patch
echo
echo "--> Preparing local manifest"
mkdir -p .repo/local_manifests
cp LeOS/manifest.xml .repo/local_manifests
cp LeOS/eOS.xml .repo/local_manifests
cp LeOS/remove.xml .repo/local_manifests
echo
fi
}
#syncRepos() {
# echo "--> Syncing repos"
# repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
# echo
#}
#applyPatches() {
# echo "--> Applying TrebleDroid patches"
#
# cp patches lineage_patches_unified/leos-20
# bash lineage_patches_unified/patch.sh lineage_patches_unified patches_treble_prerequisite
# echo
applyPatches() {
echo "Applying patch groups"
cp patches/leos/0001-LeOS-changes.patch lineage_build_unified
cp -R patches/leos lineage_patches_unified
cd lineage_build_unified
git apply 0001-LeOS-changes.patch
cd ..
bash lineage_build_unified/buildbot_unified.sh treble x
}
prepare_build() {
bash texte.sh
echo "Supl"
cd device/google/
grep -RiIl 'supl.google.com' | xargs sed -i 's/supl.google.com/supl.grapheneos.org/g'
cd ../..
cd vendor/hardware_overlay/
grep -RiIl 'supl.google.com' | xargs sed -i 's/supl.google.com/supl.grapheneos.org/g'
cd ../..
cd hardware
grep -RiIl 'supl.google.com' | xargs sed -i 's/supl.google.com/supl.grapheneos.org/g'
cd ..
cd cts/tests/location/location_gnss/src/android/location/cts/gnss/
grep -RiIl 'supl.google.com' | xargs sed -i 's/supl.google.com/supl.grapheneos.org/g'
cd ../../../../../../../../..
cd frameworks/base
grep -RiIl 'supl.google.com' | xargs sed -i 's/supl.google.com/supl.grapheneos.org/g'
cd ../..
mkdir images
}
setupEnv() {
echo "--> Setting up build environment"
source build/envsetup.sh &>/dev/null
echo
}
buildVanillaVariant() {
echo "--> Building leos_arm64_bvS"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
export PRODUCT_BROKEN_VERIFY_USES_LIBRARIES=true
lunch lineage_arm64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo
echo "--> Building leos_a64_bvS"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch lineage_a64_bvS-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo "--> Building LeOS-20-VNDKLITE-arm64-bvS.img"
cd sas-creator
sudo bash lite-adapterS.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-20-VNDKLITE-arm64-bvS.img
sudo rm -rf d tmp
echo "--> Building LeOS-20-VNDKLITE-arm64-bvN"
sudo bash lite-adapterN.sh 64 ../out/target/product/leos_arm64_ab/system.img
mv s.img LeOS-20-VNDKLITE-arm64-bvN.img
sudo rm -rf d tmp
cd ..
echo
echo "--> Building LeOS-20-VNDKLITE-a64-bvS.img"
cd sas-creator
sudo bash lite-adapterSa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-20-VNDKLITE-a64-bvS.img
sudo rm -rf d tmp
echo "--> Building LeOS-20-VNDKLITE-a64-bvN"
sudo bash lite-adapterNa64.sh 32 ../out/target/product/leos_a64_ab/system.img
mv s.img LeOS-20-VNDKLITE-a64-bvN.img
sudo rm -rf d tmp
cd ..
echo
cd prebuilts/prebuiltapks/foss_nano/
bash update.sh
cd ../../..
echo "--> Building treble_arm64_bvN"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch lineage_arm64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
echo
echo "--> Building treble_a64_bvN"
export WITHOUT_CHECK_API=true
export USE_CCACHE=1
export CCACHE_SIZE=50G
export WITH_SU=true
lunch lineage_a64_bvN-userdebug
#make installclean
make -j12 RELAX_USES_LIBRARY_CHECK=true systemimage
}
generatePackages() {
echo "--> Generating packages"
cp out/target/product/leos_arm64_ab/system.img sas-creator/LeOS-20-VNDK-arm64_bvN.img
cp out/target/product/leos_a64_ab/system.img sas-creator/LeOS-20-VNDK-a64-bvN.img
cd sas-creator
xz -vT0 *.img
cp *.img.xz /media/ich/exSSD2/leos-cloud/LeOS-Files/LeOS-20/$MONTH/
echo
}
echo "READY"
initRepos
#syncRepos
applyPatches
setupEnv
buildVanillaVariant
buildVndkliteVariants
generatePackages