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
ef9d077c
Commit
ef9d077c
authored
Mar 28, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update build.py
parent
e4b20abf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
21 deletions
+25
-21
build.py
build.py
+25
-21
No files found.
build.py
View file @
ef9d077c
...
...
@@ -242,6 +242,29 @@ def run_ndk_build(flags):
collect_binary
()
def
dump_bin_headers
():
for
arch
in
archs
:
bin_file
=
os
.
path
.
join
(
'native'
,
'out'
,
arch
,
'magisk'
)
if
not
os
.
path
.
exists
(
bin_file
):
error
(
'Build "magisk" before building "magiskinit"'
)
with
open
(
os
.
path
.
join
(
'native'
,
'out'
,
arch
,
'binaries_arch.h'
),
'w'
)
as
out
:
with
open
(
bin_file
,
'rb'
)
as
src
:
binary_dump
(
src
,
out
,
'magisk_xz'
)
for
arch
,
arch32
in
list
(
zip
(
arch64
,
archs
)):
bin_file
=
os
.
path
.
join
(
'native'
,
'out'
,
arch
,
'magisk'
)
with
open
(
os
.
path
.
join
(
'native'
,
'out'
,
arch32
,
'binaries_arch64.h'
),
'w'
)
as
out
:
with
open
(
bin_file
,
'rb'
)
as
src
:
binary_dump
(
src
,
out
,
'magisk_xz'
)
stub
=
os
.
path
.
join
(
config
[
'outdir'
],
'stub-release.apk'
)
if
not
os
.
path
.
exists
(
stub
):
stub
=
os
.
path
.
join
(
config
[
'outdir'
],
'stub-debug.apk'
)
if
not
os
.
path
.
exists
(
stub
):
error
(
'Build stub APK before building "magiskinit"'
)
with
open
(
os
.
path
.
join
(
'native'
,
'out'
,
'binaries.h'
),
'w'
)
as
out
:
with
open
(
stub
,
'rb'
)
as
src
:
binary_dump
(
src
,
out
,
'manager_xz'
)
def
build_binary
(
args
):
if
args
.
target
:
args
.
target
=
set
(
args
.
target
)
&
set
(
support_targets
)
...
...
@@ -263,23 +286,9 @@ def build_binary(args):
if
'magisk'
in
args
.
target
:
run_ndk_build
(
'B_MAGISK=1 B_64BIT=1'
)
clean_elf
()
# Dump the binary to header
for
arch
in
archs
:
bin_file
=
os
.
path
.
join
(
'native'
,
'out'
,
arch
,
'magisk'
)
with
open
(
os
.
path
.
join
(
'native'
,
'out'
,
arch
,
'binaries_arch.h'
),
'w'
)
as
out
:
with
open
(
bin_file
,
'rb'
)
as
src
:
binary_dump
(
src
,
out
,
'magisk_xz'
)
for
arch
,
arch32
in
list
(
zip
(
arch64
,
archs
)):
bin_file
=
os
.
path
.
join
(
'native'
,
'out'
,
arch
,
'magisk'
)
with
open
(
os
.
path
.
join
(
'native'
,
'out'
,
arch32
,
'binaries_arch64.h'
),
'w'
)
as
out
:
with
open
(
bin_file
,
'rb'
)
as
src
:
binary_dump
(
src
,
out
,
'magisk_xz'
)
if
'magiskinit'
in
args
.
target
:
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
'native'
,
'out'
,
'x86'
,
'binaries_arch.h'
)):
error
(
'Build "magisk" before building "magiskinit"'
)
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
'native'
,
'out'
,
'binaries.h'
)):
error
(
'Build stub APK before building "magiskinit"'
)
dump_bin_headers
()
run_ndk_build
(
'B_INIT=1'
)
run_ndk_build
(
'B_INIT64=1'
)
...
...
@@ -361,12 +370,7 @@ def build_app(args):
def
build_stub
(
args
):
header
(
'* Building Magisk Manager stub'
)
stub
=
build_apk
(
args
,
'stub'
)
# Dump the stub APK to header
mkdir
(
os
.
path
.
join
(
'native'
,
'out'
))
with
open
(
os
.
path
.
join
(
'native'
,
'out'
,
'binaries.h'
),
'w'
)
as
out
:
with
open
(
stub
,
'rb'
)
as
src
:
binary_dump
(
src
,
out
,
'manager_xz'
)
build_apk
(
args
,
'stub'
)
def
build_snet
(
args
):
...
...
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