File indexing completed on 2024-11-10 04:05:17
0001 #!/bin/bash 0002 # 0003 # SPDX-License-Identifier: GPL-3.0-or-later 0004 # 0005 # 0006 # Build all Krita's dependencies on Ubuntu 14.04. 0007 # 0008 # Prerequisites: cmake git build-essential libxcb-keysyms1-dev plus all deps for Qt5 0009 # 0010 0011 # Halt on errors and be verbose about what we are doing 0012 set -e 0013 set -x 0014 0015 # Read in our parameters 0016 export BUILD_PREFIX=$1 0017 export KRITA_SOURCES=$2 0018 0019 # qjsonparser, used to add metadata to the plugins needs to work in a en_US.UTF-8 environment. 0020 # That's not always the case, so make sure it is 0021 export LC_ALL=en_US.UTF-8 0022 export LANG=en_us.UTF-8 0023 0024 # We want to use $prefix/deps/usr/ for all our dependencies 0025 export DEPS_INSTALL_PREFIX=$BUILD_PREFIX/deps/usr/ 0026 export DOWNLOADS_DIR=$BUILD_PREFIX/downloads/ 0027 0028 # Setup variables needed to help everything find what we build 0029 ARCH=`dpkg --print-architecture` 0030 export LD_LIBRARY_PATH=$DEPS_INSTALL_PREFIX/lib:$LD_LIBRARY_PATH 0031 export PATH=$DEPS_INSTALL_PREFIX/bin:$PATH 0032 export PKG_CONFIG_PATH=$DEPS_INSTALL_PREFIX/share/pkgconfig:$DEPS_INSTALL_PREFIX/lib/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH 0033 export CMAKE_PREFIX_PATH=$DEPS_INSTALL_PREFIX:$CMAKE_PREFIX_PATH 0034 0035 source ${KRITA_SOURCES}/packaging/linux/appimage/override_compiler.sh.inc 0036 0037 # A krita build layout looks like this: 0038 # krita/ -- the source directory 0039 # downloads/ -- downloads of the dependencies from files.kde.org 0040 # deps-build/ -- build directory for the dependencies 0041 # deps/ -- the location for the built dependencies 0042 # build/ -- build directory for krita itself 0043 # krita.appdir/ -- install directory for krita and the dependencies 0044 0045 # Make sure our downloads directory exists 0046 if [ ! -d $DOWNLOADS_DIR ] ; then 0047 mkdir -p $DOWNLOADS_DIR 0048 fi 0049 0050 # Make sure our build directory exists 0051 if [ ! -d $BUILD_PREFIX/deps-build/ ] ; then 0052 mkdir -p $BUILD_PREFIX/deps-build/ 0053 fi 0054 0055 # The 3rdparty dependency handling in Krita also requires the install directory to be pre-created 0056 if [ ! -d $DEPS_INSTALL_PREFIX ] ; then 0057 mkdir -p $DEPS_INSTALL_PREFIX 0058 fi 0059 0060 # Switch to our build directory as we're basically ready to start building... 0061 cd $BUILD_PREFIX/deps-build/ 0062 0063 0064 mkdir -p extra-build-tools 0065 export PATH=$(pwd)/extra-build-tools:$PATH 0066 0067 # Our docker images are rather old, so we cannot use packaged versions for Meson 0068 if ! meson --version > /dev/null 2>&1; then 0069 echo The Meson Build system was not found installing... 0070 MESON_VERSION=0.57.1 0071 wget -nc https://github.com/mesonbuild/meson/releases/download/$MESON_VERSION/meson-$MESON_VERSION.tar.gz 0072 tar xf meson-$MESON_VERSION.tar.gz 0073 mkdir -p $HOME/.local/bin 0074 ln -s $(pwd)/meson-$MESON_VERSION/meson.py $(pwd)/extra-build-tools/meson 0075 rm meson-$MESON_VERSION.tar.gz 0076 fi 0077 0078 if ! ninja --version > /dev/null 2>&1; then 0079 echo The Ninja Build system was not found installing... 0080 NINJA_VERSION=1.10.2 0081 wget -nc https://github.com/ninja-build/ninja/releases/download/v$NINJA_VERSION/ninja-linux.zip 0082 unzip -o ninja-linux.zip 0083 ln -s $(pwd)/ninja $(pwd)/extra-build-tools/ninja 0084 rm ninja-linux.zip 0085 fi 0086 0087 QT_DEBUG=off 0088 if [[ -n $QT_ENABLE_DEBUG_INFO ]]; then 0089 QT_DEBUG=on 0090 fi 0091 0092 QT_ASAN=off 0093 if [[ -n $QT_ENABLE_ASAN ]]; then 0094 QT_ASAN=on 0095 QT_DEBUG=on 0096 0097 # moc and qmake may fail during compilation of Qt itself, 0098 # don't stop the build because of that 0099 export ASAN_OPTIONS=halt_on_error=0 0100 fi 0101 0102 SUBMAKE_JOBS=`grep -c processor /proc/cpuinfo` 0103 0104 if [ $SUBMAKE_JOBS -gt 2 ]; then 0105 let "jobs = ${SUBMAKE_JOBS} - 2" 0106 SUBMAKE_JOBS=$jobs 0107 fi 0108 0109 # Configure the dependencies for building 0110 cmake $KRITA_SOURCES/3rdparty \ 0111 -DCMAKE_INSTALL_PREFIX=$DEPS_INSTALL_PREFIX \ 0112 -DINSTALL_ROOT=$DEPS_INSTALL_PREFIX \ 0113 -DEXTERNALS_DOWNLOAD_DIR=$DOWNLOADS_DIR \ 0114 -DQT_ENABLE_DEBUG_INFO=$QT_DEBUG \ 0115 -DSUBMAKE_JOBS=${SUBMAKE_JOBS} \ 0116 -G Ninja 0117 0118 # Now start building everything we need, in the appropriate order 0119 #cmake --build . --config RelWithDebInfo --target ext_png 0120 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_tiff 0121 #cmake --build . --config RelWithDebInfo --target ext_jpeg 0122 0123 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_boost 0124 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_fftw3 0125 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_eigen3 0126 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_expat 0127 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_exiv2 0128 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_lcms2 0129 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_ocio 0130 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_openexr 0131 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_giflib 0132 #cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_gsl 0133 #cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_fontconfig 0134 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_qt 0135 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_python 0136 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_libraw 0137 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_kcrash 0138 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_sip 0139 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_pyqt 0140 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_quazip 0141 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_openjpeg 0142 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_nasm 0143 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_libx265 0144 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_libde265 0145 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_libheif 0146 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_seexpr 0147 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_mypaint 0148 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_fcitx5-qt 0149 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_webp 0150 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_jpegxl 0151 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_xsimd 0152 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_freetype 0153 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_poppler 0154 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_fribidi 0155 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_unibreak 0156 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_fontconfig 0157 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_ffmpeg 0158 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_lager 0159 cmake --build . --config RelWithDebInfo --parallel ${SUBMAKE_JOBS} --target ext_mlt