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 parent=%~dp0
|
||||||
SET tab=
|
SET tab=
|
||||||
SET OK=
|
SET OK=
|
||||||
|
SET DEBUG=
|
||||||
|
|
||||||
CD %parent%
|
CD %parent%
|
||||||
|
|
||||||
call :%~1 "%~2"
|
call :%~1 "%~2" "%~3"
|
||||||
IF NOT DEFINED OK CALL :usage
|
IF NOT DEFINED OK CALL :usage
|
||||||
|
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
|
|
||||||
:usage
|
:usage
|
||||||
ECHO %me% all ^<version name^>
|
ECHO %me% all ^<version name^> ^<version code^>
|
||||||
ECHO %tab%Build binaries, zip, and sign Magisk
|
ECHO %tab%Build binaries, zip, and sign Magisk
|
||||||
ECHO %tab%This is equlivant to first ^<build^>, then ^<zip^>
|
ECHO %tab%This is equlivant to first ^<build^>, then ^<zip^>
|
||||||
ECHO %me% clean
|
ECHO %me% clean
|
||||||
ECHO %tab%Cleanup compiled / generated files
|
ECHO %tab%Cleanup compiled / generated files
|
||||||
ECHO %me% build
|
ECHO %me% build ^<version name^> ^<version code^>
|
||||||
ECHO %tab%Build the binaries with ndk
|
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 %me% zip ^<version name^>
|
||||||
ECHO %tab%Zip and sign Magisk
|
ECHO %tab%Zip and sign Magisk
|
||||||
ECHO %me% uninstaller
|
ECHO %me% uninstaller
|
||||||
@ -29,18 +32,39 @@ EXIT /B %ERRORLEVEL%
|
|||||||
:all
|
:all
|
||||||
SET OK=y
|
SET OK=y
|
||||||
IF [%~1] == [] (
|
IF [%~1] == [] (
|
||||||
CALL :error "Missing version number"
|
CALL :error "Missing version info"
|
||||||
CALL :usage
|
CALL :usage
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
)
|
)
|
||||||
CALL :build
|
IF [%~2] == [] (
|
||||||
|
CALL :error "Missing version info"
|
||||||
|
CALL :usage
|
||||||
|
EXIT /B %ERRORLEVEL%
|
||||||
|
)
|
||||||
|
CALL :build "%~1" "%~2"
|
||||||
CALL :zip "%~1"
|
CALL :zip "%~1"
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
|
|
||||||
|
:debug
|
||||||
|
SET OK=y
|
||||||
|
SET DEBUG=-DDEBUG
|
||||||
|
CALL :build "VER_DEBUG" "99999"
|
||||||
|
EXIT /B %ERRORLEVEL%
|
||||||
|
|
||||||
:build
|
:build
|
||||||
SET OK=y
|
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 ************************
|
||||||
ECHO * Building binaries
|
ECHO * Building: VERSION=%~1 CODE=%~2
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
FOR /F "tokens=* USEBACKQ" %%F IN (`where ndk-build`) DO (
|
FOR /F "tokens=* USEBACKQ" %%F IN (`where ndk-build`) DO (
|
||||||
IF [%%F] == [] (
|
IF [%%F] == [] (
|
||||||
@ -48,7 +72,7 @@ EXIT /B %ERRORLEVEL%
|
|||||||
EXIT /B 1
|
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%
|
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Copying binaries
|
ECHO * Copying binaries
|
||||||
@ -92,7 +116,7 @@ EXIT /B %ERRORLEVEL%
|
|||||||
:zip
|
:zip
|
||||||
SET OK=y
|
SET OK=y
|
||||||
IF [%~1] == [] (
|
IF [%~1] == [] (
|
||||||
CALL :error "Missing version number"
|
CALL :error "Missing version info"
|
||||||
CALL :usage
|
CALL :usage
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
)
|
)
|
||||||
|
25
build.sh
25
build.sh
@ -1,13 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "$0 all <version name>"
|
echo "$0 all <version name> <version code>"
|
||||||
echo -e "\tBuild binaries, zip, and sign Magisk"
|
echo -e "\tBuild binaries, zip, and sign Magisk"
|
||||||
echo -e "\tThis is equlivant to first <build>, then <zip>"
|
echo -e "\tThis is equlivant to first <build>, then <zip>"
|
||||||
echo "$0 clean"
|
echo "$0 clean"
|
||||||
echo -e "\tCleanup compiled / generated files"
|
echo -e "\tCleanup compiled / generated files"
|
||||||
echo "$0 build"
|
echo "$0 build <verison name> <version code>"
|
||||||
echo -e "\tBuild the binaries with ndk"
|
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 "$0 zip <version name>"
|
||||||
echo -e "\tZip and sign Magisk"
|
echo -e "\tZip and sign Magisk"
|
||||||
echo "$0 uninstaller"
|
echo "$0 uninstaller"
|
||||||
@ -48,10 +50,10 @@ error() {
|
|||||||
|
|
||||||
build_bin() {
|
build_bin() {
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Building binaries"
|
echo "* Building: VERSION=$1 CODE=$2"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
[ -z `which ndk-build` ] && error "Please add ndk-build to PATH!"
|
[ -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 "************************"
|
||||||
echo "* Copying binaries"
|
echo "* Copying binaries"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
@ -150,21 +152,28 @@ sign_zip() {
|
|||||||
|
|
||||||
DIR="$(cd "$(dirname "$0")"; pwd)"
|
DIR="$(cd "$(dirname "$0")"; pwd)"
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
DEBUG=
|
||||||
|
CPUNUM=`getconf _NPROCESSORS_ONLN`
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
"all" )
|
"all" )
|
||||||
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
[ -z "$2" -o -z "$3" ] && echo -e "! Missing version info\n" && usage
|
||||||
build_bin
|
build_bin $2 $3
|
||||||
zip_package $2
|
zip_package $2
|
||||||
;;
|
;;
|
||||||
"clean" )
|
"clean" )
|
||||||
cleanup
|
cleanup
|
||||||
;;
|
;;
|
||||||
"build" )
|
"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" )
|
"zip" )
|
||||||
[ -z "$2" ] && echo -e "! Missing version number\n" && usage
|
[ -z "$2" ] && echo -e "! Missing version info\n" && usage
|
||||||
zip_package $2
|
zip_package $2
|
||||||
;;
|
;;
|
||||||
"uninstaller" )
|
"uninstaller" )
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user