From 0ddf4355a1cd23c7ef9df29828e209d8e794f1f7 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 9 Nov 2016 05:16:03 +0800 Subject: [PATCH] Update build.sh --- README.MD | 9 ++++++++- build.sh | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.MD b/README.MD index d96a02f3e..be6c01b66 100644 --- a/README.MD +++ b/README.MD @@ -1,3 +1,10 @@ # Magisk -Static binaries included: +###Static binaries included: * Busybox: http://forum.xda-developers.com/android/software-hacking/tool-busybox-flashable-archs-t3348543 + +###How to build Magisk +1. Only support MacOS and Linux +2. Download and install NDK +3. Add the NDK directory into PATH. +To check if success, please try calling `which ndk-build` and see if it returns the NDK directory +4. Execute `./build.sh`, it will give you further information diff --git a/build.sh b/build.sh index 953acfa90..109a5553e 100755 --- a/build.sh +++ b/build.sh @@ -1,14 +1,14 @@ #!/bin/bash usage() { - echo "$0 all " + echo "$0 all " echo -e "\tBuild binaries, zip, and sign Magisk" echo -e "\tThis is equlivant to first --build, then --zip" echo "$0 clean" echo -e "\tCleanup compiled / generated files" echo "$0 build" echo -e "\tBuild the binaries with ndk" - echo "$0 zip " + echo "$0 zip " echo -e "\tZip and sign Magisk" echo "$0 uninstaller" echo -e "\tZip and sign the uninstaller" @@ -19,7 +19,7 @@ cleanup() { echo "************************" echo "* Cleaning up" echo "************************" - ndk-build clean + ndk-build clean 2>/dev/null ls zip_static/arm/* | grep -v "busybox" | xargs rm -rfv ls zip_static/arm64/* | grep -v "busybox" | xargs rm -rfv ls zip_static/x86/* | grep -v "busybox" | xargs rm -rfv @@ -41,6 +41,12 @@ build_bin() { echo "************************" echo "* Building binaries" echo "************************" + if [ -z `which ndk-build` ]; then + echo "!!!!!!!!!!!!!!!!!!!!!!!!" + echo "! Please add ndk-build to PATH!" + echo "!!!!!!!!!!!!!!!!!!!!!!!!" + exit 1 + fi ndk-build -j4 if [ $? -ne 0 ]; then echo "!!!!!!!!!!!!!!!!!!!!!!!!" @@ -73,7 +79,7 @@ zip_package() { echo "* Adding version info" echo "************************" sed "s/MAGISK_VERSION_STUB/Magisk v$1 Boot Image Patcher/g" scripts/flash_script.sh > zip_static/META-INF/com/google/android/update-binary - sed "s/MAGISK_VERSION_STUB/setprop magisk.version $1/g" scripts/magic_mask.sh > zip_static/common/magic_mask.sh + sed "s/MAGISK_VERSION_STUB/setprop magisk.version \"$1\"/g" scripts/magic_mask.sh > zip_static/common/magic_mask.sh echo "************************" echo "* Zipping Magisk v$1" echo "************************"