If you have docker installed, follow the directions at Docker.md
to set up a docker build environment. It includes all the dependencies needed for building DualBootPatcher. With docker, DualBootPatcher can also be built from Windows and Mac hosts. For building the Qt patcher for Windows, you'll need to use the <version>-mingw
image.
If you don't have docker installed, the following packages are needed.
Host packages:
- Android NDK
- cmake
- mingw-w64 toolchain
mingw-w64 packages:
- gtest
- libarchive
- OpenSSL
- qt5
- yaml-cpp
DualBootPatcher can be natively compiled on Windows or cross-compiled from Linux using mingw-w64.
If you're using Fedora 25, the mingw packages can be found in the official repos and the DualBootPatcher Copr repo: https://copr.fedorainfracloud.org/coprs/chenxiaolong/mingw/.
If you're using Arch Linux, the mingw packages are available in the AUR.
-
If you haven't cloned the repo and its submodules yet, follow the directions at
Git-Clone.md
. -
Set the environment variables for the Android NDK path. If you're using the docker image, this step is not needed as the environment variables are already set in the image.
export ANDROID_NDK_HOME=/path/to/android-ndk export ANDROID_NDK=/path/to/android-ndk
-
If making a release build, make a copy of
cmake/SigningConfig.prop.in
and edit it to specify the keystore path, keystore passphrase, key alias, and key passphrase. -
If cross-compiling from Linux, copy the
cmake/toolchain-mingw.cmake.in
toolchain file template and modify it to point to the mingw-w64 installation.# Set these appropriately for your distro # For Fedora #export MINGW_TRIPLET=$(rpm -E '%{mingw32_target}') #export MINGW_ROOT_PATH=$(rpm -E '%{mingw32_prefix}') # For Arch Linux #export MINGW_TRIPLET=i686-w64-mingw32 #export MINGW_ROOT_PATH=/usr/${MINGW_TRIPLET} sed \ -e "s,@MINGW_TRIPLET@,${MINGW_TRIPLET},g" \ -e "s,@MINGW_ROOT_PATH@,${MINGW_ROOT_PATH},g" \ < cmake/toolchain-mingw.cmake.in \ > cmake/toolchain-mingw.cmake
-
Configure the build with CMake.
mkdir build && cd build cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON
If cross-compiling, pass
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw.cmake
to cmake.It is possible to make a non-portable build, but it doesn't make much sense for Windows.
If you're making a release build, you'll need to pass the
-DMBP_BUILD_TYPE=release
and-DMBP_SIGN_CONFIG_PATH=<signing config path>
arguments. SeeCMake.md
for a complete listing of CMake options. -
Build the system components. This includes things like mbtool and odinupdater. The build can be sped up by running things in parallel. Just pass
-j<number of cores>
(eg.-j4
) tomake
.make
-
Package the patcher.
If you're making a portable build, use
cpack
to generate an archive.cpack
Note that the
.dll
dependencies have to be manually added to the resulting archive in order to be used on other machines.For Fedora 25 (and consequently, the mingw docker image), the following script will copy the needed DLLs.
unzip DualBootPatcher-<version>-win32.zip rm DualBootPatcher-<version>-win32.zip pushd DualBootPatcher-<version>-win32 dlls=( iconv.dll libarchive-13.dll libbz2-1.dll libcrypto-10.dll libgcc_s_sjlj-1.dll libGLESv2.dll libglib-2.0-0.dll libharfbuzz-0.dll libintl-8.dll liblz4.dll liblzma-5.dll libpcre-1.dll libpcre16-0.dll libpng16-16.dll libstdc++-6.dll libwinpthread-1.dll libxml2-2.dll Qt5Core.dll Qt5Gui.dll Qt5Widgets.dll zlib1.dll ) for dll in "${dlls[@]}"; do cp "${MINGW_ROOT_PATH}/bin/${dll}" . done # Qt Windows plugin mkdir platforms/ cp "${MINGW_ROOT_PATH}"/lib/qt5/plugins/platforms/qwindows.dll platforms/ # Strip exe's and dll's find -name '*.exe' -o -name '*.dll' -exec strip {} \\+ # Optionally, compress executables and libraries (excluding qwindows plugin) upx --lzma *.exe *.dll popd zip -r DualBootPatcher-<version>-win32.zip DualBootPatcher-<version>-win32