mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
Update build script and tools
This commit is contained in:
parent
102a7f8723
commit
86da87f254
42
build.cmd
42
build.cmd
@ -4,22 +4,25 @@ SET me=%~nx0
|
||||
SET parent=%~dp0
|
||||
SET tab=
|
||||
SET OK=
|
||||
SET DEBUG=
|
||||
|
||||
CD %parent%
|
||||
|
||||
call :%~1 "%~2"
|
||||
call :%~1 "%~2" "%~3"
|
||||
IF NOT DEFINED OK CALL :usage
|
||||
|
||||
EXIT /B %ERRORLEVEL%
|
||||
|
||||
:usage
|
||||
ECHO %me% all ^<version name^>
|
||||
ECHO %me% all ^<version name^> ^<version code^>
|
||||
ECHO %tab%Build binaries, zip, and sign Magisk
|
||||
ECHO %tab%This is equlivant to first ^<build^>, then ^<zip^>
|
||||
ECHO %me% clean
|
||||
ECHO %tab%Cleanup compiled / generated files
|
||||
ECHO %me% build
|
||||
ECHO %me% build ^<version name^> ^<version code^>
|
||||
ECHO %tab%Build the binaries with ndk
|
||||
ECHO %me% debug
|
||||
ECHO %tab%Build the binaries with the debug flag on
|
||||
ECHO %tab%Call ^<zip^> afterwards if you want to flash on device
|
||||
ECHO %me% zip ^<version name^>
|
||||
ECHO %tab%Zip and sign Magisk
|
||||
ECHO %me% uninstaller
|
||||
@ -29,18 +32,39 @@ EXIT /B %ERRORLEVEL%
|
||||
:all
|
||||
SET OK=y
|
||||
IF [%~1] == [] (
|
||||
CALL :error "Missing version number"
|
||||
CALL :error "Missing version info"
|
||||
CALL :usage
|
||||
EXIT /B %ERRORLEVEL%
|
||||
)
|
||||
CALL :build
|
||||
IF [%~2] == [] (
|
||||
CALL :error "Missing version info"
|
||||
CALL :usage
|
||||
EXIT /B %ERRORLEVEL%
|
||||
)
|
||||
CALL :build "%~1" "%~2"
|
||||
CALL :zip "%~1"
|
||||
EXIT /B %ERRORLEVEL%
|
||||
|
||||
:debug
|
||||
SET OK=y
|
||||
SET DEBUG=-DDEBUG
|
||||
CALL :build "VER_DEBUG" "99999"
|
||||
EXIT /B %ERRORLEVEL%
|
||||
|
||||
:build
|
||||
SET OK=y
|
||||
IF [%~1] == [] (
|
||||
CALL :error "Missing version info"
|
||||
CALL :usage
|
||||
EXIT /B %ERRORLEVEL%
|
||||
)
|
||||
IF [%~2] == [] (
|
||||
CALL :error "Missing version info"
|
||||
CALL :usage
|
||||
EXIT /B %ERRORLEVEL%
|
||||
)
|
||||
ECHO ************************
|
||||
ECHO * Building binaries
|
||||
ECHO * Building: VERSION=%~1 CODE=%~2
|
||||
ECHO ************************
|
||||
FOR /F "tokens=* USEBACKQ" %%F IN (`where ndk-build`) DO (
|
||||
IF [%%F] == [] (
|
||||
@ -48,7 +72,7 @@ EXIT /B %ERRORLEVEL%
|
||||
EXIT /B 1
|
||||
)
|
||||
)
|
||||
CALL ndk-build -j4 || CALL :error "Magisk binary tools build failed...."
|
||||
CALL ndk-build APP_CFLAGS="-DMAGISK_VERSION=%~1 -DMAGISK_VER_CODE=%~2 %DEBUG%" -j%NUMBER_OF_PROCESSORS% || CALL :error "Magisk binary tools build failed...."
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
ECHO ************************
|
||||
ECHO * Copying binaries
|
||||
@ -92,7 +116,7 @@ EXIT /B %ERRORLEVEL%
|
||||
:zip
|
||||
SET OK=y
|
||||
IF [%~1] == [] (
|
||||
CALL :error "Missing version number"
|
||||
CALL :error "Missing version info"
|
||||
CALL :usage
|
||||
EXIT /B %ERRORLEVEL%
|
||||
)
|
||||
|
25
build.sh
25
build.sh
@ -1,13 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo "$0 all <version name>"
|
||||
echo "$0 all <version name> <version code>"
|
||||
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 "$0 build <verison name> <version code>"
|
||||
echo -e "\tBuild the binaries with ndk"
|
||||
echo "$0 debug"
|
||||
echo -e "\tBuild the binaries with the debug flag on\n\tCall <zip> afterwards if you want to flash on device"
|
||||
echo "$0 zip <version name>"
|
||||
echo -e "\tZip and sign Magisk"
|
||||
echo "$0 uninstaller"
|
||||
@ -48,10 +50,10 @@ error() {
|
||||
|
||||
build_bin() {
|
||||
echo "************************"
|
||||
echo "* Building binaries"
|
||||
echo "* Building: VERSION=$1 CODE=$2"
|
||||
echo "************************"
|
||||
[ -z `which ndk-build` ] && error "Please add ndk-build to PATH!"
|
||||
ndk-build -j4 || error "Magisk binary tools build failed...."
|
||||
ndk-build APP_CFLAGS="-DMAGISK_VERSION=$1 -DMAGISK_VER_CODE=$2 $DEBUG" -j${CPUNUM} || error "Magisk binary tools build failed...."
|
||||
echo "************************"
|
||||
echo "* Copying binaries"
|
||||
echo "************************"
|
||||
@ -150,21 +152,28 @@ sign_zip() {
|
||||
|
||||
DIR="$(cd "$(dirname "$0")"; pwd)"
|
||||
cd "$DIR"
|
||||
DEBUG=
|
||||
CPUNUM=`getconf _NPROCESSORS_ONLN`
|
||||
|
||||
case $1 in
|
||||
"all" )
|
||||
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
||||
build_bin
|
||||
[ -z "$2" -o -z "$3" ] && echo -e "! Missing version info\n" && usage
|
||||
build_bin $2 $3
|
||||
zip_package $2
|
||||
;;
|
||||
"clean" )
|
||||
cleanup
|
||||
;;
|
||||
"build" )
|
||||
build_bin
|
||||
[ -z "$2" -o -z "$3" ] && echo -e "! Missing version info\n" && usage
|
||||
build_bin $2 $3
|
||||
;;
|
||||
"debug" )
|
||||
DEBUG="-DDEBUG"
|
||||
build_bin "VER_DEBUG" "99999"
|
||||
;;
|
||||
"zip" )
|
||||
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
||||
[ -z "$2" ] && echo -e "! Missing version info\n" && usage
|
||||
zip_package $2
|
||||
;;
|
||||
"uninstaller" )
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user