docs/build.md
On Unix, install python3 using your favorite package manager
On Windows, download and install the latest Python version on the official website.
Make sure to select "Add Python to PATH" during installation.
(Optional on Windows): Run pip install colorama to install the colorama python package
On Unix, install git with your favorite package manager
On Windows, download the install the latest Git version on the official website.
Make sure to "Enable symbolic links" during installation.
ANDROID_HOME to the Android SDK folder. This path can be found in Android Studio settings.ANDROID_STUDIO to the path where your Android Studio is installed. The build script will automatically find and use the bundled JDK.git clone --recurse-submodules https://github.com/topjohnwu/Magisk.git./build.py ndk to let the script download and install NDK for you./build.py all.build.py to see your options. -h to access help (e.g. ./build.py binary -h)config.prop. A sample config.prop.sample is provided../build.py binary, as some generated code is only created during the build process.First, install rustup, the official Rust toolchain manager. The Magisk NDK package ONDK (the one installed with ./build.py ndk) bundles a complete Rust toolchain, so building the Magisk project itself does not require any further configuration.
However, if you'd like to work on the Rust codebase, it'll be easier if you link ONDK's Rust toolchain in rustup and set it as default so several development tools and IDEs will work properly:
# Link the ONDK toolchain with the name "magisk"
rustup toolchain link magisk "$ANDROID_HOME/ndk/magisk/toolchains/rust"
# Set magisk as default
rustup default magisk
If you plan to use VSCode, you can then install the rust-analyzer plugin and everything should be good to go. If you plan to use Jetbrain IDEs (e.g. Rustrover, or its Rust Plugin), we need some additional setup:
rustup toolchain install nightly
# Add some components that is also included in ONDK
rustup +nightly component add rust-src clippy
rustup limitations# We choose ~/.cargo/wrapper here as an example (and a good recommendation)
# Pick any path you like, you just need to use this path in the next step
./build.py rustup ~/.cargo/wrapper
rustfmt and use Clippy as the external linter.config.prop.