diff --git a/build.cmd b/build.cmd index ae2e5a172..d3a85c54a 100644 --- a/build.cmd +++ b/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 ^ + ECHO %me% all ^ ^ ECHO %tab%Build binaries, zip, and sign Magisk ECHO %tab%This is equlivant to first ^, then ^ ECHO %me% clean ECHO %tab%Cleanup compiled / generated files - ECHO %me% build + ECHO %me% build ^ ^ ECHO %tab%Build the binaries with ndk + ECHO %me% debug + ECHO %tab%Build the binaries with the debug flag on + ECHO %tab%Call ^ afterwards if you want to flash on device ECHO %me% zip ^ 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% ) diff --git a/build.sh b/build.sh index fca479825..19ab723f6 100755 --- a/build.sh +++ b/build.sh @@ -1,13 +1,15 @@ #!/bin/bash usage() { - echo "$0 all " + echo "$0 all " echo -e "\tBuild binaries, zip, and sign Magisk" echo -e "\tThis is equlivant to first , then " echo "$0 clean" echo -e "\tCleanup compiled / generated files" - echo "$0 build" + echo "$0 build " echo -e "\tBuild the binaries with ndk" + echo "$0 debug" + echo -e "\tBuild the binaries with the debug flag on\n\tCall afterwards if you want to flash on device" echo "$0 zip " 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" ) diff --git a/ziptools/win_bin/zipadjust.exe b/ziptools/win_bin/zipadjust.exe index 7aec5ff5e..e15ca943f 100644 Binary files a/ziptools/win_bin/zipadjust.exe and b/ziptools/win_bin/zipadjust.exe differ