Commit 4467ad27 authored by Sharaf Zaman's avatar Sharaf Zaman 💬

Android: Refactored build files

Made shell scripts more modular, by removing environment variables
in favor of commandline arguments

Maniphest: T10784
parent 660972c3
This diff is collapsed.
#!/bin/bash
: ${CMAKE_ANDROID_NDK?"Android NDK path must be set"}
: ${BUILD_ROOT? "Built roott path must be set"}
VERSION="1_69"
if [[ -z $ANDROID_ABI ]]; then
echo "ANDROID_ABI not specified, using the default one: armeabi-v7a"
ANDROID_ABI=armeabi-v7a
fi
git clone https://github.com/moritz-wundke/Boost-for-Android $BUILD_ROOT/d/boost
cd $BUILD_ROOT/d/boost
./build-android.sh --prefix=$BUILD_ROOT/i --with-libraries=system \
--boost=1.69.0 --arch=$ANDROID_ABI \
$CMAKE_ANDROID_NDK
cd $BUILD_ROOT/i/$ANDROID_ABI/lib
# possible only because just one library is being used
mv libboost_system-*-$VERSION.a libboost_system.a
#!/bin/bash -e
# See more: 3rdparty/README.md
# Build external dependencies in $KRITA_ROOT/3rdparty
# assuming in $KRITA_ROOT/b
: ${KRITA_ROOT?"Project root path must be set"}
: ${CMAKE_ANDROID_NDK?"Android NDK path must be set"}
: ${ANDROID_API_LEVEL?"Android API level is required"}
: ${QT_ANDROID?"Path to QT root is required"}
: ${BUILD_ROOT? "Build root must be set"}
if [[ -z $ANDROID_ABI ]]; then
echo "ANDROID_ABI not specified, using the default one: armeabi-v7a"
ANDROID_ABI=armeabi-v7a
fi
ANDROID_NATIVE_API_LEVEL=android-$ANDROID_API_LEVEL
cmake $KRITA_ROOT/3rdparty \
-DINSTALL_ROOT=$BUILD_ROOT/i \
-DEXTERNALS_DOWNLOAD_DIR=$BUILD_ROOT/d \
-DCMAKE_INSTALL_PREFIX=$BUILD_ROOT/i \
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=$ANDROID_NATIVE_API_LEVEL \
-DANDROID_ABI=$ANDROID_ABI \
-DANDROID_STL=c++_static
# You can comment these and build them individually
cmake --build . --config RelWithDebInfo --target ext_png
cmake --build . --config RelWithDebInfo --target ext_zlib
cmake --build . --config RelWithDebInfo --target ext_quazip
cmake --build . --config RelWithDebInfo --target ext_lcms2
# this one SHOULD be built before exiv
cmake --build . --config RelWithDebInfo --target ext_expat
cmake --build . --config RelWithDebInfo --target ext_exiv2
cmake --build . --config RelWithDebInfo --target ext_gsl
#!/bin/bash
# parts used from KDE/KStars project
: ${QT_ANDROID?"Qt path must be set"}
: ${CMAKE_ANDROID_NDK?"Android NDK path must be set"}
: ${ANDROID_SDK_ROOT?"Android SDK path must be set"}
: ${ANDROID_API_LEVEL?"Android API level"}
: ${KRITA_ROOT?"Project root path must be set"}
: ${BUILD_ROOT? "Build root must be set"}
if [[ -z $ANDROID_ABI ]]; then
echo "ANDROID_ABI not specified, using the default one: armeabi-v7a"
ANDROID_ABI=armeabi-v7a
fi
if [[ $ANDROID_ABI == "armeabi-v7a" ]]; then
ANDROID_ARCHITECTURE=arm
elif [[ $ANDROID_ABI == "arm64-v8a" ]]; then
ANDROID_ARCHITECTURE=arm64
elif [[ $ANDROID_ABI == "x86" || $ANDROID_ABI == "x86_64" ]]; then
ANDROID_ARCHITECTURE=$ANDROID_ABI
fi
ANDROID_NATIVE_API_LEVEL=android-$ANDROID_API_LEVEL
cd $BUILD_ROOT
CURDIR="$(pwd)"/
mkdir kf5
cd kf5
git clone git://anongit.kde.org/scratch/cordlandwehr/kdesrc-conf-android.git
mkdir -p extragear/kdesrc-build
git clone git://anongit.kde.org/kdesrc-build extragear/kdesrc-build
ln -s extragear/kdesrc-build/kdesrc-build kdesrc-build
ln -s kdesrc-conf-android/kdesrc-buildrc kdesrc-buildrc
# Change the build configuration
sed -E -i "s|build-dir.*|build-dir $CURDIR/kf5/kde/build/${android_architecture} |g" kdesrc-conf-android/kdesrc-buildrc
sed -E -i "s|source-dir.*|source-dir $CURDIR/kf5/kde/src |g" kdesrc-conf-android/kdesrc-buildrc
sed -E -i "s|kdedir.*|kdedir $CURDIR/kf5/kde/install/${android_architecture} |g" kdesrc-conf-android/kdesrc-buildrc
sed -i -- 's/make-options -j8/make-options -j4 VERBOSE=1/g' kdesrc-conf-android/kdesrc-buildrc
# The toolchain provided by Linux distribution can be old, use this instead
./kdesrc-build extra-cmake-modules
if [ -e $qt_android_libs ]
then
sed -E -i "s|-DCMAKE_PREFIX_PATH=.*?\\ |-DCMAKE_PREFIX_PATH=$QT_ANDROID- -DCMAKE_ANDROID_NDK=$CMAKE_ANDROID_NDK -DECM_ADDITIONAL_FIND_ROOT_PATH=$QT_ANDROID\;$CURDIR/kf5/kde/install -DANDROID_STL=c++_static -DCMAKE_TOOLCHAIN_FILE=$CURDIR/kf5/kde/install/share/ECM/toolchain/Android.cmake -DKCONFIG_USE_DBUS=OFF -DANDROID_PLATFORM=$ANDROID_NATIVE_API_LEVEL -DANDROID_API_LEVEL=$ANDROID_API_LEVEL -DANDROID_ABI=$ANDROID_ABI -DANDROID_ARCHITECTURE=$ANDROID_ARCHITECTURE |g" kdesrc-conf-android/kdesrc-buildrc
sed -i -- "s/cxxflags.*/& -D__ANDROID_API__=$ANDROID_API_LEVEL/" kdesrc-conf-android/kdesrc-buildrc
else
echo "Qt Android libraries path doesn't exist. Exiting."
exit
fi
sed -E -i "s|use-modules.+|use-modules kconfig ki18n |g" kdesrc-conf-android/kdesrc-buildrc
rm -rf kde/build/* # clean build folders
./kdesrc-build libintl-lite
./kdesrc-build ki18n kcoreaddons \
frameworks-android \
kwidgetsaddons kcompletion \
kguiaddons kitemmodels \
kitemviews kwindowsystem \
karchive
#!/bin/bash
: ${KRITA_ROOT?"Project root path must be set"}
: ${CMAKE_ANDROID_NDK?"Android NDK path must be set"}
: ${BUILD_ROOT? "Build root must be set"}
: ${ANDROID_SDK_ROOT? "Android SDK path must be set"}
: ${ANDROID_API_LEVEL?"Android API level is required"}
if [[ -z $ANDROID_ABI ]]; then
echo "ANDROID_ABI not specified, using the default one: armeabi-v7a"
ANDROID_ABI=armeabi-v7a
fi
ANDROID_NATIVE_API_LEVEL=android-$ANDROID_API_LEVEL
cmake $KRITA_ROOT/3rdparty \
-DINSTALL_ROOT=$BUILD_ROOT/i \
-DEXTERNALS_DOWNLOAD_DIR=$BUILD_ROOT/d \
-DCMAKE_INSTALL_PREFIX=$BUILD_ROOT/i \
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=$ANDROID_ABI \
-DANDROID_PLATFORM=$ANDROID_NATIVE_API_LEVEL \
-DANDROID_STL=c++_static \
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
cmake --build . --config RelWithDebInfo --target ext_qt
#!/bin/bash
: ${KRITA_ROOT?"Project root path must be set"}
: ${CMAKE_ANDROID_NDK?"Android NDK path must be set"}
: ${ANDROID_SDK_ROOT?"Android SDK path must be set"}
: ${ANDROID_API_LEVEL?"API level required"}
: ${QT_ANDROID?"path to qt android required"}
: ${INSTALL_PREFIX?"INSTALL_PREFIX must be set for building apk"}
CURDIR="$(pwd)"/
if [[ -z $ANDROID_ABI ]]; then
echo "ANDROID_ABI not specified, using the default one: armeabi-v7a"
ANDROID_ABI=armeabi-v7a
fi
ANDROID_NATIVE_API_LEVEL=android-$ANDROID_API_LEVEL
: ${PY_INCLUDE_PATH?"Python include path must be set"}
: ${PY_LIBRARY?"Python lib path must be set"}
PYTHON_INCLUDE_PATH=$PY_INCLUDE_PATH
PYTHON_LIBRARY=$PY_LIBRARY
# Configure files using cmake
cmake $KRITA_ROOT -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DDEFINE_NO_DEPRECATED=1 \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=$ANDROID_NATIVE_API_LEVEL \
-DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_PATH \
-DPYTHON_LIBRARY=$PYTHON_LIBRARY \
-DEIGEN3_INCLUDE_DIR=/usr/include/eigen3 \
-DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF \
-DBoost_NO_BOOST_CMAKE=TRUE \
-DBoost_NO_SYSTEM_PATHS=TRUE \
-DQTANDROID_EXPORTED_TARGET=krita \
-DANDROID_APK_DIR=$KRITA_ROOT/packaging/android/apk \
-DANDROID_STL=c++_shared \
-DANDROID_ABI=$ANDROID_ABI \
-DCMAKE_FIND_ROOT_PATH="$QT_ANDROID;$BUILD_ROOT/kf5/kde/install/;$BUILD_ROOT/i"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment