Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
ed027ec3
Commit
ed027ec3
authored
Feb 12, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor build flags
parent
b3fd79cb
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
27 additions
and
24 deletions
+27
-24
build.py
build.py
+1
-1
build.gradle
native/build.gradle
+2
-1
Application.mk
native/jni/Application.mk
+2
-2
daemon.cpp
native/jni/core/daemon.cpp
+2
-2
magisk.cpp
native/jni/core/magisk.cpp
+2
-2
flags.h
native/jni/include/flags.h
+12
-7
main.cpp
native/jni/magiskboot/main.cpp
+1
-1
magiskhide.cpp
native/jni/magiskhide/magiskhide.cpp
+1
-1
magiskpolicy.cpp
native/jni/magiskpolicy/magiskpolicy.cpp
+1
-1
resetprop.cpp
native/jni/resetprop/resetprop.cpp
+1
-1
su.cpp
native/jni/su/su.cpp
+2
-2
logging.h
native/jni/utils/include/logging.h
+0
-3
No files found.
build.py
View file @
ed027ec3
...
@@ -191,7 +191,7 @@ def build_binary(args):
...
@@ -191,7 +191,7 @@ def build_binary(args):
os
.
utime
(
os
.
path
.
join
(
'native'
,
'jni'
,
'include'
,
'flags.h'
))
os
.
utime
(
os
.
path
.
join
(
'native'
,
'jni'
,
'include'
,
'flags.h'
))
# Basic flags
# Basic flags
base_flags
=
f
'MAGISK_VERSION=
"{config["version"]}"
MAGISK_VER_CODE={config["versionCode"]}'
base_flags
=
f
'MAGISK_VERSION=
{config["version"]}
MAGISK_VER_CODE={config["versionCode"]}'
if
not
args
.
release
:
if
not
args
.
release
:
base_flags
+=
' MAGISK_DEBUG=1'
base_flags
+=
' MAGISK_DEBUG=1'
...
...
native/build.gradle
View file @
ed027ec3
...
@@ -12,7 +12,8 @@ android {
...
@@ -12,7 +12,8 @@ android {
externalNativeBuild
{
externalNativeBuild
{
ndkBuild
{
ndkBuild
{
// Pass arguments to ndk-build.
// Pass arguments to ndk-build.
arguments
(
'B_MAGISK=1'
,
'B_INIT=1'
,
'B_BOOT=1'
,
'B_BXZ=1'
,
'MAGISK_DEBUG=1'
)
arguments
(
'B_MAGISK=1'
,
'B_INIT=1'
,
'B_BOOT=1'
,
'MAGISK_DEBUG=1'
,
'MAGISK_VERSION=debug'
,
'MAGISK_VER_CODE=INT_MAX'
)
}
}
}
}
}
}
...
...
native/jni/Application.mk
View file @
ed027ec3
APP_ABI := armeabi-v7a x86
APP_ABI := armeabi-v7a x86
APP_CFLAGS := -Oz -std=gnu11 \
APP_CFLAGS := -Oz -std=gnu11 \
-D
MAGISK_VERSION="${MAGISK_VERSION}" -DMAGISK_VER_
CODE=${MAGISK_VER_CODE}
-D
__MVSTR=${MAGISK_VERSION} -D__M
CODE=${MAGISK_VER_CODE}
APP_CPPFLAGS := -std=c++17
APP_CPPFLAGS := -std=c++17
APP_STL := c++_static
APP_STL := c++_static
APP_PLATFORM := android-16
APP_PLATFORM := android-16
ifdef MAGISK_DEBUG
ifdef MAGISK_DEBUG
APP_CFLAGS += -D
MAGISK_DEBU
G
APP_CFLAGS += -D
__MDB
G
endif
endif
# Busybox require some additional settings
# Busybox require some additional settings
...
...
native/jni/core/daemon.cpp
View file @
ed027ec3
...
@@ -70,7 +70,7 @@ static void *request_handler(void *args) {
...
@@ -70,7 +70,7 @@ static void *request_handler(void *args) {
su_daemon_handler
(
client
,
&
credential
);
su_daemon_handler
(
client
,
&
credential
);
break
;
break
;
case
CHECK_VERSION
:
case
CHECK_VERSION
:
write_string
(
client
,
xstr
(
MAGISK_VERSION
)
":MAGISK"
);
write_string
(
client
,
MAGISK_VERSION
":MAGISK"
);
close
(
client
);
close
(
client
);
break
;
break
;
case
CHECK_VERSION_CODE
:
case
CHECK_VERSION_CODE
:
...
@@ -109,7 +109,7 @@ static void main_daemon() {
...
@@ -109,7 +109,7 @@ static void main_daemon() {
xdup2
(
fd
,
STDIN_FILENO
);
xdup2
(
fd
,
STDIN_FILENO
);
close
(
fd
);
close
(
fd
);
LOGI
(
"Magisk v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
")
daemon started
\n
"
);
LOGI
(
SHOW_VER
(
Magisk
)
"
daemon started
\n
"
);
// Get server stat
// Get server stat
stat
(
"/proc/self/exe"
,
&
SERVER_STAT
);
stat
(
"/proc/self/exe"
,
&
SERVER_STAT
);
...
...
native/jni/core/magisk.cpp
View file @
ed027ec3
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
[[
noreturn
]]
static
void
usage
()
{
[[
noreturn
]]
static
void
usage
()
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"Magisk v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") (by topjohnwu)
multi-call binary
\n
"
FULL_VER
(
Magisk
)
"
multi-call binary
\n
"
"
\n
"
"
\n
"
"Usage: magisk [applet [arguments]...]
\n
"
"Usage: magisk [applet [arguments]...]
\n
"
" or: magisk [options]...
\n
"
" or: magisk [options]...
\n
"
...
@@ -48,7 +48,7 @@ int magisk_main(int argc, char *argv[]) {
...
@@ -48,7 +48,7 @@ int magisk_main(int argc, char *argv[]) {
if
(
argc
<
2
)
if
(
argc
<
2
)
usage
();
usage
();
if
(
strcmp
(
argv
[
1
],
"-c"
)
==
0
)
{
if
(
strcmp
(
argv
[
1
],
"-c"
)
==
0
)
{
printf
(
"%s (%d)
\n
"
,
xstr
(
MAGISK_VERSION
)
":MAGISK"
,
MAGISK_VER_CODE
);
printf
(
MAGISK_VERSION
":MAGISK ("
str
(
MAGISK_VER_CODE
)
")
\n
"
);
return
0
;
return
0
;
}
else
if
(
strcmp
(
argv
[
1
],
"-v"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
1
],
"-v"
)
==
0
)
{
int
fd
=
connect_daemon
();
int
fd
=
connect_daemon
();
...
...
native/jni/include/flags.h
View file @
ed027ec3
#pragma once
#pragma once
/* Include this header anywhere
you access
MAGISK_DEBUG, MAGISK_VERSION, MAGISK_VER_CODE.
/* Include this header anywhere
accessing
MAGISK_DEBUG, MAGISK_VERSION, MAGISK_VER_CODE.
*
*
* This file is
only for more
precise incremental builds. We can make sure code that uses
* This file is
for
precise incremental builds. We can make sure code that uses
* external flags are re-compiled by updating the timestamp of this file
* external flags are re-compiled by updating the timestamp of this file
* */
* */
#ifndef MAGISK_VERSION
#define quote(s) #s
#define MAGISK_VERSION 99.99
#define str(s) quote(s)
#endif
#define MAGISK_VERSION str(__MVSTR)
#define MAGISK_VER_CODE __MCODE
#define SHOW_VER(name) str(name) " v" MAGISK_VERSION "(" str(MAGISK_VER_CODE) ")"
#define FULL_VER(name) SHOW_VER(name) " (by topjohnwu)"
#if
ndef MAGISK_VER_CODE
#if
def __MDBG
#define MAGISK_
VER_CODE 99999
#define MAGISK_
DEBUG
#endif
#endif
native/jni/magiskboot/main.cpp
View file @
ed027ec3
...
@@ -107,7 +107,7 @@ static void usage(char *arg0) {
...
@@ -107,7 +107,7 @@ static void usage(char *arg0) {
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
cmdline_logging
();
cmdline_logging
();
fprintf
(
stderr
,
"MagiskBoot v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") (by topjohnwu)
- Boot Image Modification Tool
\n
"
);
fprintf
(
stderr
,
FULL_VER
(
MagiskBoot
)
"
- Boot Image Modification Tool
\n
"
);
umask
(
0
);
umask
(
0
);
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"--cleanup"
)
==
0
)
{
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"--cleanup"
)
==
0
)
{
...
...
native/jni/magiskhide/magiskhide.cpp
View file @
ed027ec3
...
@@ -17,7 +17,7 @@ bool hide_enabled = false;
...
@@ -17,7 +17,7 @@ bool hide_enabled = false;
[[
noreturn
]]
static
void
usage
(
char
*
arg0
)
{
[[
noreturn
]]
static
void
usage
(
char
*
arg0
)
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"MagiskHide v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") (by topjohnwu)
\n\n
"
FULL_VER
(
MagiskHide
)
"
\n\n
"
"Usage: %s [--option [arguments...] ]
\n\n
"
"Usage: %s [--option [arguments...] ]
\n\n
"
"Options:
\n
"
"Options:
\n
"
" --status Return the status of MagiskHide
\n
"
" --status Return the status of MagiskHide
\n
"
...
...
native/jni/magiskpolicy/magiskpolicy.cpp
View file @
ed027ec3
...
@@ -86,7 +86,7 @@ static const char *type_msg_6 =
...
@@ -86,7 +86,7 @@ static const char *type_msg_6 =
[[
noreturn
]]
static
void
usage
(
char
*
arg0
)
{
[[
noreturn
]]
static
void
usage
(
char
*
arg0
)
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"MagiskPolicy v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") (by topjohnwu)
\n\n
"
FULL_VER
(
MagiskPolicy
)
"
\n\n
"
"Usage: %s [--options...] [policy statements...]
\n
"
"Usage: %s [--options...] [policy statements...]
\n
"
"
\n
"
"
\n
"
"Options:
\n
"
"Options:
\n
"
...
...
native/jni/resetprop/resetprop.cpp
View file @
ed027ec3
...
@@ -55,7 +55,7 @@ illegal:
...
@@ -55,7 +55,7 @@ illegal:
[[
noreturn
]]
static
void
usage
(
char
*
arg0
)
{
[[
noreturn
]]
static
void
usage
(
char
*
arg0
)
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"resetprop v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") (by topjohnwu & nkk71)
- System Props Modification Tool
\n\n
"
FULL_VER
(
resetprop
)
"
- System Props Modification Tool
\n\n
"
"Usage: %s [flags] [options...]
\n
"
"Usage: %s [flags] [options...]
\n
"
"
\n
"
"
\n
"
"Options:
\n
"
"Options:
\n
"
...
...
native/jni/su/su.cpp
View file @
ed027ec3
...
@@ -35,7 +35,7 @@ static void usage(int status) {
...
@@ -35,7 +35,7 @@ static void usage(int status) {
FILE
*
stream
=
(
status
==
EXIT_SUCCESS
)
?
stdout
:
stderr
;
FILE
*
stream
=
(
status
==
EXIT_SUCCESS
)
?
stdout
:
stderr
;
fprintf
(
stream
,
fprintf
(
stream
,
"MagiskSU v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
")
\n\n
"
FULL_VER
(
MagiskSU
)
"
\n\n
"
"Usage: su [options] [-] [user [argument...]]
\n\n
"
"Usage: su [options] [-] [user [argument...]]
\n\n
"
"Options:
\n
"
"Options:
\n
"
" -c, --command COMMAND pass COMMAND to the invoked shell
\n
"
" -c, --command COMMAND pass COMMAND to the invoked shell
\n
"
...
@@ -151,7 +151,7 @@ int su_client_main(int argc, char *argv[]) {
...
@@ -151,7 +151,7 @@ int su_client_main(int argc, char *argv[]) {
printf
(
"%d
\n
"
,
MAGISK_VER_CODE
);
printf
(
"%d
\n
"
,
MAGISK_VER_CODE
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
case
'v'
:
case
'v'
:
printf
(
"%s
\n
"
,
xstr
(
MAGISK_VERSION
)
":MAGISKSU (topjohnwu)
"
);
printf
(
"%s
\n
"
,
MAGISK_VERSION
":MAGISKSU
"
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
case
'z'
:
case
'z'
:
// Do nothing, placed here for legacy support :)
// Do nothing, placed here for legacy support :)
...
...
native/jni/utils/include/logging.h
View file @
ed027ec3
...
@@ -11,9 +11,6 @@
...
@@ -11,9 +11,6 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#define str(a) #a
#define xstr(a) str(a)
typedef
enum
{
typedef
enum
{
L_DEBUG
,
L_DEBUG
,
L_INFO
,
L_INFO
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment