File indexing completed on 2024-06-16 04:06:49

0001 #! /bin/bash
0002 
0003 # Script to build extra libraries using HomeBrew
0004 # This script must be run as sudo
0005 #
0006 # SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier  <caulier dot gilles at gmail dot com>
0007 #
0008 # SPDX-License-Identifier: BSD-3-Clause
0009 #
0010 
0011 # Ask to run as root
0012 (( EUID != 0 )) && exec sudo -- "$0" "$@"
0013 
0014 # Halt and catch errors
0015 set -eE
0016 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
0017 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
0018 
0019 #################################################################################################
0020 # Manage script traces to log file
0021 
0022 mkdir -p ./logs
0023 exec > >(tee ./logs/build-extralibs.full.log) 2>&1
0024 
0025 #################################################################################################
0026 
0027 echo "02-build-extralibs.sh : build extra libraries using HomeBrew."
0028 echo "-------------------------------------------------------------"
0029 
0030 #################################################################################################
0031 # Pre-processing checks
0032 
0033 . ./config.sh
0034 . ./common.sh
0035 StartScript
0036 ChecksRunAsRoot
0037 ChecksXCodeCLI
0038 ChecksCPUCores
0039 OsxCodeName
0040 #RegisterRemoteServers
0041 
0042 #################################################################################################
0043 
0044 # Paths rules
0045 ORIG_PATH="$PATH"
0046 ORIG_WD="`pwd`"
0047 
0048 export PATH=$INSTALL_PREFIX/bin:/$INSTALL_PREFIX/sbin:/$INSTALL_PREFIX/opt/qt6/bin:/$INSTALL_PREFIX/opt/bison/bin:/$INSTALL_PREFIX/opt/gperf/bin:$ORIG_PATH
0049 
0050 # HomeBrew do not create these sym-links as with other shared libs.
0051 
0052 if [ ! -d ${INSTALL_PREFIX}/include/jxl ] ; then
0053     ln -s ${INSTALL_PREFIX}/opt/jpeg-xl/include/jxl ${INSTALL_PREFIX}/include/jxl
0054 fi
0055 
0056 FILES=$(find "${INSTALL_PREFIX}/opt/jpeg-xl/lib/" -name "*.dylib" -depth 1)
0057 
0058 for FILE in $FILES ; do
0059     BASE=$(basename $FILE)
0060 
0061     if [ ! -f ${INSTALL_PREFIX}/lib/${BASE} ] ; then
0062         ln -s ${FILE} ${INSTALL_PREFIX}/lib/${BASE}
0063     fi
0064 done
0065 
0066 #################################################################################################
0067 
0068 # Create the build dir for the 3rdparty deps
0069 if [ ! -d $BUILDING_DIR ] ; then
0070     mkdir $BUILDING_DIR
0071 fi
0072 if [ ! -d $DOWNLOAD_DIR ] ; then
0073     mkdir $DOWNLOAD_DIR
0074 fi
0075 
0076 cd $BUILDING_DIR
0077 
0078 rm -rf $BUILDING_DIR/* || true
0079 
0080 cmake $ORIG_WD/../3rdparty \
0081        -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX \
0082        -DINSTALL_ROOT=$INSTALL_PREFIX \
0083        -DEXTERNALS_DOWNLOAD_DIR=$DOWNLOAD_DIR \
0084        -DKA_VERSION=$DK_KA_VERSION \
0085        -DKP_VERSION=$DK_KP_VERSION \
0086        -DKDE_VERSION=$DK_KDE_VERSION \
0087        -DENABLE_QTVERSION=$DK_QTVERSION \
0088        -DENABLE_QTWEBENGINE=$DK_QTWEBENGINE \
0089        -Wno-dev
0090 
0091 # NOTE: The order to compile each component here is very important.
0092 
0093 # core KF6 frameworks dependencies
0094 cmake --build . --config RelWithDebInfo --target ext_extra-cmake-modules -- -j$CPU_CORES
0095 cmake --build . --config RelWithDebInfo --target ext_kconfig             -- -j$CPU_CORES
0096 cmake --build . --config RelWithDebInfo --target ext_breeze-icons        -- -j$CPU_CORES
0097 cmake --build . --config RelWithDebInfo --target ext_kcoreaddons         -- -j$CPU_CORES
0098 cmake --build . --config RelWithDebInfo --target ext_kwindowsystem       -- -j$CPU_CORES
0099 cmake --build . --config RelWithDebInfo --target ext_solid               -- -j$CPU_CORES
0100 cmake --build . --config RelWithDebInfo --target ext_threadweaver        -- -j$CPU_CORES
0101 cmake --build . --config RelWithDebInfo --target ext_karchive            -- -j$CPU_CORES
0102 cmake --build . --config RelWithDebInfo --target ext_kdbusaddons         -- -j$CPU_CORES
0103 cmake --build . --config RelWithDebInfo --target ext_ki18n               -- -j$CPU_CORES
0104 cmake --build . --config RelWithDebInfo --target ext_kcrash              -- -j$CPU_CORES
0105 cmake --build . --config RelWithDebInfo --target ext_kcodecs             -- -j$CPU_CORES
0106 cmake --build . --config RelWithDebInfo --target ext_kauth               -- -j$CPU_CORES
0107 cmake --build . --config RelWithDebInfo --target ext_kguiaddons          -- -j$CPU_CORES
0108 cmake --build . --config RelWithDebInfo --target ext_kwidgetsaddons      -- -j$CPU_CORES
0109 cmake --build . --config RelWithDebInfo --target ext_kitemviews          -- -j$CPU_CORES
0110 cmake --build . --config RelWithDebInfo --target ext_kcompletion         -- -j$CPU_CORES
0111 
0112 if [[ $DK_QTVERSION == 6 ]] ; then
0113 
0114     cmake --build . --config RelWithDebInfo --target ext_kcolorscheme           -- -j$CPU_CORES
0115 
0116 fi
0117 
0118 cmake --build . --config RelWithDebInfo --target ext_kconfigwidgets      -- -j$CPU_CORES
0119 cmake --build . --config RelWithDebInfo --target ext_kiconthemes         -- -j$CPU_CORES
0120 cmake --build . --config RelWithDebInfo --target ext_kservice            -- -j$CPU_CORES
0121 cmake --build . --config RelWithDebInfo --target ext_kxmlgui             -- -j$CPU_CORES
0122 cmake --build . --config RelWithDebInfo --target ext_kbookmarks          -- -j$CPU_CORES
0123 
0124 cmake --build . --config RelWithDebInfo --target ext_kimageformats       -- -j$CPU_CORES
0125 
0126 # Extra support for digiKam
0127 
0128 cmake --build . --config RelWithDebInfo --target ext_sonnet              -- -j$CPU_CORES
0129 cmake --build . --config RelWithDebInfo --target ext_ktextwidgets        -- -j$CPU_CORES
0130 
0131 # libksane support
0132 #cmake --build . --config RelWithDebInfo --target ext_libksane            -- -j$CPU_CORES
0133 
0134 # Calendar support
0135 cmake --build . --config RelWithDebInfo --target ext_kcalendarcore       -- -j$CPU_CORES
0136 
0137 # Breeze style support
0138 cmake --build . --config RelWithDebInfo --target ext_breeze              -- -j$CPU_CORES
0139 
0140 #################################################################################################
0141 
0142 export PATH=$ORIG_PATH
0143 
0144 TerminateScript