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
3358eab9
Commit
3358eab9
authored
Apr 15, 2022
by
topjohnwu
Committed by
John Wu
Apr 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to use ONDK
parent
a609e0aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
33 deletions
+19
-33
build.py
build.py
+15
-28
gradle.properties
gradle.properties
+1
-2
Android.mk
native/jni/external/Android.mk
+2
-2
libcxx
native/jni/external/libcxx
+1
-1
No files found.
build.py
View file @
3358eab9
...
@@ -12,8 +12,7 @@ import subprocess
...
@@ -12,8 +12,7 @@ import subprocess
import
sys
import
sys
import
textwrap
import
textwrap
import
urllib.request
import
urllib.request
import
zipfile
import
tarfile
from
distutils.dir_util
import
copy_tree
def
error
(
str
):
def
error
(
str
):
...
@@ -309,9 +308,11 @@ def dump_flag_header():
...
@@ -309,9 +308,11 @@ def dump_flag_header():
def
build_binary
(
args
):
def
build_binary
(
args
):
# Verify NDK install
# Verify NDK install
props
=
parse_props
(
op
.
join
(
ndk_path
,
'source.properties'
))
try
:
if
props
[
'Pkg.Revision'
]
!=
config
[
'fullNdkVersion'
]:
with
open
(
op
.
join
(
ndk_path
,
'ONDK_VERSION'
),
'r'
)
as
ondk_ver
:
error
(
'Incorrect NDK. Please install/upgrade NDK with "build.py ndk"'
)
assert
ondk_ver
.
read
()
.
strip
(
'
\t\r\n
'
)
==
config
[
'ondkVersion'
]
except
:
error
(
'Unmatched NDK. Please install/upgrade NDK with "build.py ndk"'
)
if
'target'
not
in
vars
(
args
):
if
'target'
not
in
vars
(
args
):
vars
(
args
)[
'target'
]
=
[]
vars
(
args
)[
'target'
]
=
[]
...
@@ -416,30 +417,17 @@ def cleanup(args):
...
@@ -416,30 +417,17 @@ def cleanup(args):
def
setup_ndk
(
args
):
def
setup_ndk
(
args
):
os_name
=
platform
.
system
()
.
lower
()
os_name
=
platform
.
system
()
.
lower
()
ndk_ver
=
config
[
'ndkVersion'
]
ndk_ver
=
config
[
'
o
ndkVersion'
]
url
=
f
'https://
dl.google.com/android/repository/android-ndk-r{ndk_ver}-{os_name}.zip
'
url
=
f
'https://
github.com/topjohnwu/ondk/releases/download/{ndk_ver}/ondk-{ndk_ver}-{os_name}.tar.gz
'
ndk_
zip
=
url
.
split
(
'/'
)[
-
1
]
ndk_
archive
=
url
.
split
(
'/'
)[
-
1
]
header
(
f
'* Downloading {ndk_zip}'
)
header
(
f
'* Downloading and extracting {ndk_archive}'
)
with
urllib
.
request
.
urlopen
(
url
)
as
response
,
open
(
ndk_zip
,
'wb'
)
as
out_file
:
with
urllib
.
request
.
urlopen
(
url
)
as
response
:
shutil
.
copyfileobj
(
response
,
out_file
)
with
tarfile
.
open
(
mode
=
'r|gz'
,
fileobj
=
response
)
as
tar
:
tar
.
extractall
(
ndk_root
)
header
(
'* Extracting NDK zip'
)
rm_rf
(
ndk_path
)
rm_rf
(
ndk_path
)
with
zipfile
.
ZipFile
(
ndk_zip
,
'r'
)
as
zf
:
mv
(
op
.
join
(
ndk_root
,
f
'ondk-{ndk_ver}'
),
ndk_path
)
for
info
in
zf
.
infolist
():
vprint
(
f
'Extracting {info.filename}'
)
if
info
.
external_attr
>>
28
==
0xA
:
# symlink
src
=
zf
.
read
(
info
)
.
decode
(
"utf-8"
)
dest
=
op
.
join
(
ndk_root
,
info
.
filename
)
os
.
symlink
(
src
,
dest
)
continue
extracted_path
=
zf
.
extract
(
info
,
ndk_root
)
if
info
.
create_system
==
3
:
# ZIP_UNIX_SYSTEM = 3
unix_attributes
=
info
.
external_attr
>>
16
if
unix_attributes
:
os
.
chmod
(
extracted_path
,
unix_attributes
)
mv
(
op
.
join
(
ndk_root
,
f
'android-ndk-r{ndk_ver}'
),
ndk_path
)
header
(
'* Patching static libs'
)
header
(
'* Patching static libs'
)
for
target
in
[
'aarch64-linux-android'
,
'arm-linux-androideabi'
,
for
target
in
[
'aarch64-linux-android'
,
'arm-linux-androideabi'
,
...
@@ -452,8 +440,7 @@ def setup_ndk(args):
...
@@ -452,8 +440,7 @@ def setup_ndk(args):
continue
continue
src_dir
=
op
.
join
(
'tools'
,
'ndk-bins'
,
'21'
,
arch
)
src_dir
=
op
.
join
(
'tools'
,
'ndk-bins'
,
'21'
,
arch
)
rm
(
op
.
join
(
src_dir
,
'.DS_Store'
))
rm
(
op
.
join
(
src_dir
,
'.DS_Store'
))
for
path
in
copy_tree
(
src_dir
,
lib_dir
):
shutil
.
copytree
(
src_dir
,
lib_dir
,
copy_function
=
cp
,
dirs_exist_ok
=
True
)
vprint
(
f
'Replaced {path}'
)
def
setup_avd
(
args
):
def
setup_avd
(
args
):
...
...
gradle.properties
View file @
3358eab9
...
@@ -29,5 +29,4 @@ android.nonTransitiveRClass=true
...
@@ -29,5 +29,4 @@ android.nonTransitiveRClass=true
# Magisk
# Magisk
magisk.stubVersion
=
27
magisk.stubVersion
=
27
magisk.versionCode
=
24306
magisk.versionCode
=
24306
magisk.ndkVersion
=
23b
magisk.ondkVersion
=
r24.1
magisk.fullNdkVersion
=
23.1.7779620
native/jni/external/Android.mk
View file @
3358eab9
...
@@ -248,7 +248,7 @@ LOCAL_SRC_FILES := \
...
@@ -248,7 +248,7 @@ LOCAL_SRC_FILES := \
selinux/libsepol/cil/src/cil_verify.c \
selinux/libsepol/cil/src/cil_verify.c \
selinux/libsepol/cil/src/cil_write_ast.c
selinux/libsepol/cil/src/cil_write_ast.c
LOCAL_CFLAGS := -
Dgetline=__getline -Wno-implicit-function-declaration
LOCAL_CFLAGS := -
Wno-unused-but-set-variable
include $(BUILD_STATIC_LIBRARY)
include $(BUILD_STATIC_LIBRARY)
# libselinux.a
# libselinux.a
...
@@ -260,7 +260,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LIBSELINUX)
...
@@ -260,7 +260,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LIBSELINUX)
LOCAL_STATIC_LIBRARIES := libpcre2
LOCAL_STATIC_LIBRARIES := libpcre2
LOCAL_CFLAGS := \
LOCAL_CFLAGS := \
-Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-function \
-Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-function \
-Wno-macro-redefined -D_GNU_SOURCE -DUSE_PCRE2 \
-Wno-macro-redefined -
Wno-unused-but-set-variable -
D_GNU_SOURCE -DUSE_PCRE2 \
-DNO_PERSISTENTLY_STORED_PATTERNS -DDISABLE_SETRANS -DDISABLE_BOOL \
-DNO_PERSISTENTLY_STORED_PATTERNS -DDISABLE_SETRANS -DDISABLE_BOOL \
-DNO_MEDIA_BACKEND -DNO_X_BACKEND -DNO_DB_BACKEND -DNO_ANDROID_BACKEND \
-DNO_MEDIA_BACKEND -DNO_X_BACKEND -DNO_DB_BACKEND -DNO_ANDROID_BACKEND \
-Dfgets_unlocked=fgets -D'__fsetlocking(...)='
-Dfgets_unlocked=fgets -D'__fsetlocking(...)='
...
...
libcxx
@
9b40e8b9
Subproject commit
0aa67c3ffea069bdb58fe3b5e7aad06934afb292
Subproject commit
9b40e8b93627e0aef4ee8ad1b9f3aea913ee32c0
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