diff --git a/How-To-Build.md b/How-To-Build.md index e355063..70032f6 100644 --- a/How-To-Build.md +++ b/How-To-Build.md @@ -1 +1,85 @@ -Soon! \ No newline at end of file +## Building PMT from source +This guide teaches you how to compile PMT from source. It is aimed at enthusiasts and developers. + +### Requirements + - Android NDK + - Git, CMake and Ninja packages + - Linux system (any distro, it doesn't matter) + - Patience + +--- + +### Set upping Android NDK + - Download latest Android NDK release from [Android Developers](https://developer.android.com/ndk/downloads). + - Extract the NDK archive you downloaded in a convenient place in the terminal with the following command: +```bash +unzip android-ndk-*-linux.zip +``` + - The reason we use the script is that some file managers do not create a direct symbolic link when extracting. For example, dolphin. If we were to use it, NDK's `clang` would not work properly. + - Copy the path to the directory that the Android NDK files are in. You'll need it! + +--- + +### Installing required packages + - For `pacman` package manager (Arch Linux and Arch Linux based distros): +```bash +sudo pacman -S git cmake ninja +``` + - For `dnf` package manager (Fedora): +```bash +sudo dnf install git cmake ninja-build +``` + - For `apt` package manager (Debian/Ubuntu and Debian/Ubuntu based distros): +```bash +sudo apt install git cmake ninja-build +``` + - For `zypper` package manager (OpenSUSE and OpenSUSE based distros): +```bash +sudo zypper install git cmake ninja +``` + +--- + +### Downloading PMT from GitHub + - PMT is managed from a single branch. In general, it is always in the development phase. There may be bugs, etc. So my suggestion is to clone the repository via published tags. +```bash +# Example: clone 1.2.0 version release tag. You can also look at tags from the repository on GitHub. +git clone -b 20250821 https://github.com/ShawkTeam/pmt-renovated +``` + - Or you can clone the repository directly (don't specify a branch only with `-b`) and switch between tags with `git switch`. + - Or just to work on or try out the unreleased version that may be in development... + +### Building PMT with build script + - Enter the cloned repository directory. + - Save the path to the NDK directory you copied earlier to the variable named `ANDROID_NDK` using `export`. If you want, you can also add `bashrc` or `zshrc` to your files so that you don't repeat the continuous process. For me, the command is like this: +```bash +# I extracted it on my desktop. +export ANDROID_NDK="/home/yzbruh/Desktop/Development/android-ndk-r28c" +``` + - Now all you have to do is run build.sh! +```bash +bash build.sh build +``` + +--- + +#### Extra Notes. + - To clean up the compiled files, use the following command: +```bash +bash build.sh clean +``` + - To recompile (clean + build), use the following command: +```bash +bash build.sh rebuild +``` + - Currently, only `arm64-v8a` and `armeabi-v7a` are compiled. If you want to compile in other ABIs, etc., you need to edit the `TARGET_ABI_LIST` string on line 19 in the `build.sh`. Also, only the following ABIs are supported by the Android NDK: `arm64-v8a` `armeabi-v7a` `x86_64` `x86` + - The thread to use is calculated based on: +```bash +$(($(nproc) - 2)) +# The two threads are not used during compilation to make your computer a little more comfortable. You can also edit it within build.sh if you want +``` + +--- + +#### Notes for developers + - I would be glad if you could let me know all the help you can do for PMT by opening a pull request! Your help will always be valuable!