File indexing completed on 2024-11-17 03:57:23

0001 #!/bin/bash
0002 
0003 # SPDX-FileCopyrightText: 2008-2024 by Gilles Caulier, <caulier dot gilles at gmail dot com>
0004 #
0005 # SPDX-License-Identifier: BSD-3-Clause
0006 #
0007 # Arguments : $1 : install path '/opt/homebrew' (default).
0008 #             $2 : build type   'Debug' to hack (default), 'Release' for production.
0009 #             $3 : target type  'arm64' for Apple Silicon (default). 'x86_64' for Intel MacOS.
0010 #             $4 : Cmake extra configure options.
0011 
0012 # Halt and catch errors
0013 set -eE
0014 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
0015 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
0016 
0017 INSTALL_PREFIX=$1
0018 
0019 if [ "$INSTALL_PREFIX" = "" ]; then
0020     INSTALL_PREFIX="/opt/homebrew"
0021     BUNDLE_INSTALL_DIR="/Applications/digiKam.org"
0022     BUNDLE_DATA_INSTALL_DIR="/Library/Application Support"
0023 else
0024     BUNDLE_INSTALL_DIR="${INSTALL_PREFIX}/Applications/digiKam.org"
0025     BUNDLE_DATA_INSTALL_DIR="${INSTALL_PREFIX}/Library/Application Support"
0026 fi
0027 
0028 BUILD_TYPE=$2
0029 
0030 if [ "$BUILD_TYPE" = "" ]; then
0031     BUILD_TYPE=Debug
0032 fi
0033 
0034 TARGET_TYPE=$3
0035 
0036 if [ "$TARGET_TYPE" = "" ]; then
0037     TARGET_TYPE=arm64
0038 fi
0039 
0040 OPTIONS=$4
0041 
0042 echo "Installing to $INSTALL_PREFIX for target $TARGET_TYPE with build mode $BUILD_TYPE and compilation options $OPTIONS"
0043 
0044 # set devel env from MacOS-X through HomeBrew
0045 export QTDIR=$INSTALL_PREFIX/opt/qt6
0046 export QT_INCLUDE_DIR=$QTDIR/include
0047 export PKG_CONFIG_PATH=$INSTALL_PREFIX/opt/pkg-config/bin:$PKG_CONFIG_PATH
0048 
0049 # Paths rules
0050 ORIG_PATH="$PATH"
0051 export PATH=$INSTALL_PREFIX/bin:$QTDIR/bin:$INSTALL_PREFIX/opt/ccache/bin:$PATH
0052 
0053 # We will work on command line using GNU make
0054 export MAKEFILES_TYPE='Unix Makefiles'
0055 
0056 if [ ! -d "build" ]; then
0057     mkdir build
0058 fi
0059 
0060 cd build
0061 
0062 cmake -G "$MAKEFILES_TYPE" . \
0063       -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
0064       -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}/ \
0065       -DCMAKE_OSX_ARCHITECTURES=${TARGET_TYPE} \
0066       -DCMAKE_LIBRARY_PATH=${INSTALL_PREFIX}/opt/ffmpeg \
0067       -DBUILD_TESTING=ON \
0068       -DBUILD_WITH_CCACHE=ON \
0069       -DBUILD_WITH_QT6=ON \
0070       -DDIGIKAMSC_COMPILE_PO=OFF \
0071       -DDIGIKAMSC_COMPILE_DIGIKAM=ON \
0072       -DENABLE_KFILEMETADATASUPPORT=OFF \
0073       -DENABLE_AKONADICONTACTSUPPORT=OFF \
0074       -DENABLE_INTERNALMYSQL=ON \
0075       -DENABLE_MYSQLSUPPORT=ON \
0076       -DENABLE_GEOLOCATION=ON \
0077       -DENABLE_MEDIAPLAYER=ON \
0078       -DENABLE_DBUS=OFF \
0079       -DENABLE_KIO=OFF \
0080       -DENABLE_APPSTYLES=OFF \
0081       -DENABLE_QWEBENGINE=ON \
0082       -DAPPLE_SUPPRESS_X11_WARNING=ON \
0083       -DCMAKE_COLOR_MAKEFILE=ON \
0084       -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
0085       -DCMAKE_INSTALL_NAME_DIR=${INSTALL_PREFIX}/lib \
0086       -DCMAKE_SYSTEM_PREFIX_PATH="${INSTALL_PREFIX};/usr" \
0087       -DCMAKE_MODULE_PATH="${INSTALL_PREFIX}/share/cmake/Modules;${INSTALL_PREFIX}/share/cmake-3.7/Modules" \
0088       -DKDE_INSTALL_BUNDLEDIR=${BUNDLE_INSTALL_DIR} \
0089       -DKDE_INSTALL_DATADIR=${BUNDLE_DATA_INSTALL_DIR} \
0090       -DQT_QT_INCLUDE_DIR=${QT_INCLUDE_DIR} \
0091       -DQT_LIBRARY_DIR=${QTDIR}/lib \
0092       -DQT_QMAKE_EXECUTABLE=${QTDIR}/bin/qmake \
0093       -Wno-dev \
0094       ${OPTIONS} \
0095       ..
0096 
0097 CMAKE_VAL_RET=$?
0098 
0099 export PATH=$ORIG_PATH
0100 
0101 exit $CMAKE_VAL_RET