Debian Codegraph @

project/bundles/homebrew/02-build-extralibs.sh

raw
1 #! /bin/bash
2
3 # Script to build extra libraries using HomeBrew
4 # This script must be run as sudo
5 #
6 # SPDX-FileCopyrightText: 2015-2026 by Gilles Caulier <caulier dot gilles at gmail dot com>
7 #
8 # SPDX-License-Identifier: BSD-3-Clause
9 #
10
11 # Ask to run as root
12 (( EUID != 0 )) && exec sudo -- "$0" "$@"
13
14 # Halt and catch errors
15 set -eE
16 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
17 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
18
19 #################################################################################################
20 # Manage script traces to log file
21
22 mkdir -p ./logs
23 exec > >(tee ./logs/build-extralibs.full.log) 2>&1
24
25 #################################################################################################
26
27 echo "02-build-extralibs.sh : build extra libraries using HomeBrew."
28 echo "-------------------------------------------------------------"
29
30 #################################################################################################
31 # Pre-processing checks
32
33 . ./config.sh
34 . ./common.sh
35 StartScript
36 ChecksRunAsRoot
37 ChecksXCodeCLI
38 ChecksCPUCores
39 OsxCodeName
40 #RegisterRemoteServers
41
42 #################################################################################################
43
44 # Paths rules
45 ORIG_PATH="$PATH"
46 ORIG_WD="`pwd`"
47
48 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
49
50 # HomeBrew do not create these sym-links as with other shared libs.
51
52 if [ ! -d ${INSTALL_PREFIX}/include/jxl ] ; then
53 ln -s ${INSTALL_PREFIX}/opt/jpeg-xl/include/jxl ${INSTALL_PREFIX}/include/jxl
54 fi
55
56 FILES=$(find "${INSTALL_PREFIX}/opt/jpeg-xl/lib/" -name "*.dylib" -depth 1)
57
58 for FILE in $FILES ; do
59 BASE=$(basename $FILE)
60
61 if [ ! -f ${INSTALL_PREFIX}/lib/${BASE} ] ; then
62 ln -s ${FILE} ${INSTALL_PREFIX}/lib/${BASE}
63 fi
64 done
65
66 #################################################################################################
67 # activate the python3 venv
68 # source ${INSTALL_PREFIX}/bin/activate
69
70 #################################################################################################
71
72 # Create the build dir for the 3rdparty deps
73 if [ ! -d $BUILDING_DIR ] ; then
74 mkdir $BUILDING_DIR
75 fi
76 if [ ! -d $DOWNLOAD_DIR ] ; then
77 mkdir $DOWNLOAD_DIR
78 fi
79
80 cd $BUILDING_DIR
81
82 rm -rf $BUILDING_DIR/* || true
83
84 cmake $ORIG_WD/../3rdparty \
85 -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX \
86 -DINSTALL_ROOT=$INSTALL_PREFIX \
87 -DEXTERNALS_DOWNLOAD_DIR=$DOWNLOAD_DIR \
88 -DKA_VERSION=$DK_KA_VERSION \
89 -DKP_VERSION=$DK_KP_VERSION \
90 -DKDE_VERSION=$DK_KDE_VERSION \
91 -DENABLE_QTVERSION=$DK_QTVERSION \
92 -DDK_APPLE_PACKAGE_MANAGER=$DK_APPLE_PACKAGE_MANAGER \
93 -DARCH_TARGET=$ARCH_TARGET \
94 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
95 -Wno-dev
96
97 # NOTE: The order to compile each component here is very important.
98
99 # core KF6 frameworks dependencies
100 cmake --build . --config RelWithDebInfo --target ext_extra-cmake-modules -- -j$CPU_CORES
101 cmake --build . --config RelWithDebInfo --target ext_kconfig -- -j$CPU_CORES
102 cmake --build . --config RelWithDebInfo --target ext_breeze-icons -- -j$CPU_CORES
103 cmake --build . --config RelWithDebInfo --target ext_kcoreaddons -- -j$CPU_CORES
104 cmake --build . --config RelWithDebInfo --target ext_kwindowsystem -- -j$CPU_CORES
105 cmake --build . --config RelWithDebInfo --target ext_solid -- -j$CPU_CORES
106 cmake --build . --config RelWithDebInfo --target ext_threadweaver -- -j$CPU_CORES
107 cmake --build . --config RelWithDebInfo --target ext_karchive -- -j$CPU_CORES
108 cmake --build . --config RelWithDebInfo --target ext_kdbusaddons -- -j$CPU_CORES
109 cmake --build . --config RelWithDebInfo --target ext_ki18n -- -j$CPU_CORES
110 cmake --build . --config RelWithDebInfo --target ext_kcrash -- -j$CPU_CORES
111 cmake --build . --config RelWithDebInfo --target ext_kcodecs -- -j$CPU_CORES
112 cmake --build . --config RelWithDebInfo --target ext_kauth -- -j$CPU_CORES
113 cmake --build . --config RelWithDebInfo --target ext_kguiaddons -- -j$CPU_CORES
114 cmake --build . --config RelWithDebInfo --target ext_kwidgetsaddons -- -j$CPU_CORES
115 cmake --build . --config RelWithDebInfo --target ext_kitemviews -- -j$CPU_CORES
116 cmake --build . --config RelWithDebInfo --target ext_kcompletion -- -j$CPU_CORES
117
118 if [[ $DK_QTVERSION == 6 ]] ; then
119
120 cmake --build . --config RelWithDebInfo --target ext_kcolorscheme -- -j$CPU_CORES
121
122 fi
123
124 cmake --build . --config RelWithDebInfo --target ext_kconfigwidgets -- -j$CPU_CORES
125 cmake --build . --config RelWithDebInfo --target ext_kiconthemes -- -j$CPU_CORES
126 cmake --build . --config RelWithDebInfo --target ext_kservice -- -j$CPU_CORES
127 cmake --build . --config RelWithDebInfo --target ext_kxmlgui -- -j$CPU_CORES
128 cmake --build . --config RelWithDebInfo --target ext_kbookmarks -- -j$CPU_CORES
129 cmake --build . --config RelWithDebInfo --target ext_kimageformats -- -j$CPU_CORES
130
131 # Extra support for digiKam
132
133 cmake --build . --config RelWithDebInfo --target ext_sonnet -- -j$CPU_CORES
134 cmake --build . --config RelWithDebInfo --target ext_ktextwidgets -- -j$CPU_CORES
135
136 # libksane support
137 #cmake --build . --config RelWithDebInfo --target ext_libksane -- -j$CPU_CORES
138
139 # Calendar support
140 cmake --build . --config RelWithDebInfo --target ext_kcalendarcore -- -j$CPU_CORES
141
142 # Breeze style support
143 cmake --build . --config RelWithDebInfo --target ext_breeze -- -j$CPU_CORES
144
145 # OpenCV with custom options
146 # cmake --build . --config RelWithDebInfo --target ext_opencv -- -j$CPU_CORES
147
148 #################################################################################################
149
150 CopyDebugSymbols
151
152 export PATH=$ORIG_PATH
153
154 TerminateScript