Update build scripts
This commit is contained in:
parent
b2f8792873
commit
e4f3fb36f3
18
build.cmd
18
build.cmd
@ -31,16 +31,6 @@ EXIT /B %ERRORLEVEL%
|
|||||||
|
|
||||||
:all
|
:all
|
||||||
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%
|
|
||||||
)
|
|
||||||
CALL :build "%~1" "%~2"
|
CALL :build "%~1" "%~2"
|
||||||
CALL :zip "%~1"
|
CALL :zip "%~1"
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
@ -48,7 +38,7 @@ EXIT /B %ERRORLEVEL%
|
|||||||
:debug
|
:debug
|
||||||
SET OK=y
|
SET OK=y
|
||||||
SET DEBUG=-DDEBUG
|
SET DEBUG=-DDEBUG
|
||||||
CALL :build "VER_DEBUG" "99999"
|
CALL :build "%~1" "%~2"
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
|
|
||||||
:build
|
:build
|
||||||
@ -63,8 +53,12 @@ EXIT /B %ERRORLEVEL%
|
|||||||
CALL :usage
|
CALL :usage
|
||||||
EXIT /B %ERRORLEVEL%
|
EXIT /B %ERRORLEVEL%
|
||||||
)
|
)
|
||||||
|
SET BUILD=Build
|
||||||
|
IF NOT [%DEBUG%] == [] (
|
||||||
|
SET BUILD=Debug
|
||||||
|
)
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Building: VERSION=%~1 CODE=%~2
|
ECHO * %BUILD%: 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] == [] (
|
||||||
|
23
build.sh
23
build.sh
@ -1,18 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "$0 all <version name> <version code>"
|
echo "$ME 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 "$ME clean"
|
||||||
echo -e "\tCleanup compiled / generated files"
|
echo -e "\tCleanup compiled / generated files"
|
||||||
echo "$0 build <verison name> <version code>"
|
echo "$ME build <verison name> <version code>"
|
||||||
echo -e "\tBuild the binaries with ndk"
|
echo -e "\tBuild the binaries with ndk"
|
||||||
echo "$0 debug"
|
echo "$ME debug <verison name> <version code>"
|
||||||
echo -e "\tBuild the binaries with the debug flag on\n\tCall <zip> afterwards if you want to flash on device"
|
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 "$ME zip <version name>"
|
||||||
echo -e "\tZip and sign Magisk"
|
echo -e "\tZip and sign Magisk"
|
||||||
echo "$0 uninstaller"
|
echo "$ME uninstaller"
|
||||||
echo -e "\tZip and sign the uninstaller"
|
echo -e "\tZip and sign the uninstaller"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
@ -49,8 +49,11 @@ error() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_bin() {
|
build_bin() {
|
||||||
|
[ -z "$1" -o -z "$2" ] && echo -e "! Missing version info\n" && usage
|
||||||
|
BUILD="Build"
|
||||||
|
[ -z "DEBUG" ] || BUILD="Debug"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Building: VERSION=$1 CODE=$2"
|
echo "* $BUILD: 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 APP_CFLAGS="-DMAGISK_VERSION=$1 -DMAGISK_VER_CODE=$2 $DEBUG" -j${CPUNUM} || 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...."
|
||||||
@ -72,6 +75,7 @@ build_bin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zip_package() {
|
zip_package() {
|
||||||
|
[ -z "$1" ] && echo -e "! Missing version info\n" && usage
|
||||||
[ ! -f "zip_static/arm/magiskboot" ] && error "Missing binaries!! Please run '$0 build' before zipping"
|
[ ! -f "zip_static/arm/magiskboot" ] && error "Missing binaries!! Please run '$0 build' before zipping"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Adding version info"
|
echo "* Adding version info"
|
||||||
@ -154,10 +158,10 @@ DIR="$(cd "$(dirname "$0")"; pwd)"
|
|||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
DEBUG=
|
DEBUG=
|
||||||
CPUNUM=`getconf _NPROCESSORS_ONLN`
|
CPUNUM=`getconf _NPROCESSORS_ONLN`
|
||||||
|
ME=$0
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
"all" )
|
"all" )
|
||||||
[ -z "$2" -o -z "$3" ] && echo -e "! Missing version info\n" && usage
|
|
||||||
build_bin $2 $3
|
build_bin $2 $3
|
||||||
zip_package $2
|
zip_package $2
|
||||||
;;
|
;;
|
||||||
@ -165,12 +169,11 @@ case $1 in
|
|||||||
cleanup
|
cleanup
|
||||||
;;
|
;;
|
||||||
"build" )
|
"build" )
|
||||||
[ -z "$2" -o -z "$3" ] && echo -e "! Missing version info\n" && usage
|
|
||||||
build_bin $2 $3
|
build_bin $2 $3
|
||||||
;;
|
;;
|
||||||
"debug" )
|
"debug" )
|
||||||
DEBUG="-DDEBUG"
|
DEBUG="-DDEBUG"
|
||||||
build_bin "VER_DEBUG" "99999"
|
build_bin $2 $3
|
||||||
;;
|
;;
|
||||||
"zip" )
|
"zip" )
|
||||||
[ -z "$2" ] && echo -e "! Missing version info\n" && usage
|
[ -z "$2" ] && echo -e "! Missing version info\n" && usage
|
||||||
|
Loading…
x
Reference in New Issue
Block a user