97 lines
2.3 KiB
Bash
Executable File
97 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
readonly ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$ROOT"
|
|
source common.sh
|
|
|
|
readonly MANIFEST_URL="https://github.com/LineageOS/android.git"
|
|
readonly MANIFEST_BRANCH="cm-14.1"
|
|
readonly MANIFEST_LOCAL="local_manifests/los-14.1.xml"
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
usage: $0 [-hn] [bootimage|bacon|clean|prune]
|
|
|
|
flags:
|
|
-h show this help
|
|
-n don't sync
|
|
|
|
commands:
|
|
bootimage build boot.img (kernel + dt.img + ramdisk, fast gate)
|
|
bacon full build -> lineage_rubenslte-*.zip
|
|
clean mka clean
|
|
prune remove all of los-build
|
|
EOF
|
|
}
|
|
|
|
append_seandroidenforce() {
|
|
local img="$1"
|
|
|
|
[ -f "$img" ] || return
|
|
tail -c 16 "$img" | grep -q "SEANDROIDNEFORCE" || \
|
|
printf 'SEANDROIDENFORCE' >> "$img"
|
|
}
|
|
|
|
do_build() {
|
|
mkdir -p los-build
|
|
cd los-build
|
|
|
|
if [ ! -d .repo ]; then
|
|
rlte_print "Setting up repo"
|
|
repo init --depth 1 -u "$MANIFEST_URL" -b "$MANIFEST_BRANCH"
|
|
mkdir -p .repo/local_manifests
|
|
cp "$ROOT/$MANIFEST_LOCAL" .repo/local_manifests/
|
|
fi
|
|
|
|
if [ ! -v "NO_SYNC" ]; then
|
|
rlte_print "Syncing repositories"
|
|
repo sync -c -j"$(nproc)"
|
|
fi
|
|
|
|
export LC_ALL=C LANG=C USE_CCACHE=1 CCACHE_DIR="$ROOT/.ccache" \
|
|
JACK_SERVER=false JACK_NO_SERVER=1 \
|
|
JACK_REPOSITORY="$ROOT/.jack-repository" TOP="$PWD" \
|
|
ANDROID_BUILD_TOP="$PWD"
|
|
|
|
mkdir -p "$ROOT/.jack-repository"
|
|
cp -n "$TOP"/prebuilts/sdk/tools/jacks/jack-*.jar "$ROOT/.jack-repository"
|
|
cp -n "$TOP"/prebuilts/sdk/tools/jills/jill-*.jar "$ROOT/.jack-repository"
|
|
|
|
set +eu
|
|
source build/envsetup.sh
|
|
lunch lineage_rubenslte-userdebug
|
|
set -e
|
|
|
|
if [ -z "${TARGET_PRODUCT:-}" ]; then
|
|
rlte_error "lunch failed - TARGET_PRODUCT not set"
|
|
exit 1
|
|
fi
|
|
|
|
rlte_print "Commencing build (command: $CMD)"
|
|
mka "$CMD"
|
|
|
|
if [ "$CMD" != "clean" ]; then
|
|
rlte_print "Appending SEANDROIDENFORCE"
|
|
append_seandroidenforce "$ROOT/los-build/out/target/product/rubenslte/boot.img"
|
|
fi
|
|
|
|
rlte_ok "Done."
|
|
}
|
|
|
|
while getopts ":hn" opt; do
|
|
case "$opt" in
|
|
h) usage; exit 0 ;;
|
|
n) NO_SYNC=1 ;;
|
|
*) usage; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
case "${1:-}" in
|
|
bootimage|bacon|clean) CMD="${1:-}"; do_build ;;
|
|
prune) rm -rf los-build ;;
|
|
*) usage; exit 1 ;;
|
|
esac
|