Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Building DualBootPatcher from source

Youssif Shaaban Alsager edited this page Dec 28, 2017 · 3 revisions

When you deeply exploring DualBootPatcher repository you'll find all information and guides you need but for some people instructions isn't clear enough, so let me explain it here 😀

You'll need Linux, whichever distribution you use. but i'm sure building works on [Debian-Ubuntu-Fedora-Arch] and all its derivations.

A) Prerequisites:

You'll need these packages whatever version you want to build:

  • Android NDK

Currently NDK r15c is required to build, you can get it here

Download, Extract and rename it to "android-ndk"

wget https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip && unzip android-ndk-r15c-linux-x86_64.zip && mv android-ndk-r15c android-ndk

And then export android ndk:

echo "export ANDROID_NDK=$(pwd)/android-ndk" >> ~/.bashrc

echo "export ANDROID_NDK_HOME=$(pwd)/android-ndk" >> ~/.bashrc

  • cmake

DBP needs cmake 3.7.2 or higher. you need to download it here

Downloading & Extract command:

wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz && tar xzf cmake-3.7.2.tar.gz

extract to folder and run the following commands in cmake folder

sed -i 's|cmake_options="-DCMAKE_BOOTSTRAP=1"|cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=ON"|' bootstrap

./bootstrap

make

sudo make install

  • OpenSSL

I'm successfully build using openssl-1.1.0c, download here and extract.

wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz && tar xzf openssl-1.1.0c.tar.gz

open openssl-1.1.0c folder and install it

./config shared --prefix=/usr/local/ssl --openssldir=/usr/local/ssl

make

sudo make install

echo 'PATH=${PATH}:/usr/local/ssl' >> ~/.bashrc

  • gtest

Install on Ubuntu / Debian:

sudo apt-get install libgtest-dev

On Fedora:

sudo dnf install gtest-devel

On Archlinux:

sudo pacman -S gtest

  • yaml-cpp

Install on Ubuntu / Debian using

sudo apt-get install libyaml-cpp-dev

On Fedora

sudo dnf install yaml-cpp-devel

On Archlinux:

sudo pacman -S yaml-cpp

Other General packages that must be installed: [Skip this if you have android build environment 👍 ]

Ubuntu / Debian:

sudo apt-get install ccache libboost-dev libssl-dev openssl python-minimal build-essential libfontconfig1 findutils git make libprocps-dev unzip zip gcc-multilib g++-multilib lib32ncurses5-dev transifex-client gnupg mesa-common-dev libglu1-mesa-dev

Fedora:

sudo dnf install ccache findutils gcc-c++ git make procps-ng unzip zip gnupg ncurses-compat-libs transifex-client openssl-devel

Archlinux:

sudo pacman -S ccache boost openssl lib32-openssl findutils git make procps-ng unzip zip gnupg gcc-multilib ncurses

sudo pacaur -S transifex-client ncurses5-compat-libs lib32-ncurseslib32-ncurses5-compat-libs

For building android app you need:

  • Android SDK

You need to install SDK using android studio ( build-tools 25.0.3, platforms android-25, platform-tools and tools )

or install from terminal:

mkdir -p android-sdk && cd android-sdk

wget -q https://dl.google.com/android/repository/platform-tools_r25.0.3-linux.zip && unzip -qq platform-tools_r25.0.3-linux.zip

wget -q https://dl.google.com/android/repository/build-tools_r25.0.3-linux.zip && unzip -qq build-tools_r25.0.3-linux.zip

wget -q https://dl.google.com/android/repository/tools_r25.2.3-linux.zip && unzip -qq tools_r25.2.3-linux.zip

Then Export it:

echo "export ANDROID_HOME=$(pwd)" >> ~/.bashrc

echo "export PATH=${PATH}:${ANDROID_HOME}/tools" >> ~/.bashrc

*JDK 1.8

Ubuntu / Debian:

sudo apt-get install openjdk-8-jdk openjdk-8-jdk-headless

Fedora:

sudo dnf install java-1.8.0-openjdk-devel java-1.8.0-openjdk-headless

Archlinux:

sudo pacman -S jdk8-openjdk

Other packages:

Ubuntu / Debian:

sudo apt-get install lib32stdc++-6-dev

Fedora:

sudo dnf install glibc.i686 libstdc++.i686

Archlinux:

sudo pacman -S glibc libstdc++5 lib32-libstdc++5

And for Linux version you need:

  • qt5

it must be 5.3 or higher

Ubuntu / Debian:

sudo apt-get install qttools5-dev-tools libqt5core5a

Fedora:

sudo dnf install qt5-qtbase-devel

Archlinux:

sudo pacman -S qt5-base

Other packages:

Ubuntu / Debian:

sudo apt-get install libarchive-dev liblz4-tool liblzma-dev lz4-dev zlib1g-dev lib32z-dev

Fedora:

sudo dnf install libarchive-devel lz4-devel xz-devel

Archlinux:

sudo pacman -S libarchive lz4 xz lib32-xz lzip

Some final touches:

Enable ccache:

echo "export USE_CCACHE=1" >> ~/.bashrc

Reload bash environment:

source ~/.bashrc

Cloning the source:

git clone --recursive https://github.com/chenxiaolong/DualBootPatcher.git


B) Building Android APP:

  1. Open DualBootPatcher folder and make new folder "build" and open it.

mkdir build && cd build/

  1. Now Build the app:

cmake .. -DMBP_BUILD_TARGET=android -DMBP_BUILD_TYPE=debug

make

cpack -G TXZ

make apk

  1. And you'll find built APK in DualBootPatcher/Android_GUI/build/outputs/apk/debug/Android_GUI-debug.apk

C) Building Utilities Zip:

Utilities Zip is AROMA based zip which enable you to switch ROMs form twrp or wipe ROM when something went wrong.

  1. In build folder run these commands:

make android-system_armeabi-v7a

make -C data/devices

./utilities/create.sh

  1. You'll find built utilities.zip in DualBootPatcher/build/utilities/DualBootUtilities-9.3.0.zip

D) Building Linux App:

  1. In build folder run these commands:

cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON

make

cpack

  1. You'll find built DualBootPatcher-9.3.0-Linux.zip in DualBootPatcher/build/DualBootPatcher-9.3.0-Linux.zip