"Fossies" - the Fresh Open Source Software Archive

Member "digikam-6.3.0/project/bundles/macports/03-build-digikam.sh" (4 Sep 2019, 4582 Bytes) of package /linux/misc/digikam-6.3.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "03-build-digikam.sh": 6.2.0_vs_6.3.0.

    1 #! /bin/bash
    2 
    3 # Script to build digiKam using MacPorts
    4 # This script must be run as sudo
    5 #
    6 # Copyright (c) 2015-2019, Gilles Caulier, <caulier dot gilles at gmail dot com>
    7 #
    8 # Redistribution and use is allowed according to the terms of the BSD license.
    9 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
   10 #
   11 
   12 # Ask to run as root
   13 (( EUID != 0 )) && exec sudo -- "$0" "$@"
   14 
   15 # Halt and catch errors
   16 set -eE
   17 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
   18 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
   19 
   20 #################################################################################################
   21 # Manage script traces to log file
   22 
   23 mkdir -p ./logs
   24 exec > >(tee ./logs/build-digikam.full.log) 2>&1
   25 
   26 #################################################################################################
   27 
   28 echo "03-build-digikam.sh : build digiKam using MacPorts."
   29 echo "---------------------------------------------------"
   30 
   31 #################################################################################################
   32 # Pre-processing checks
   33 
   34 . ./config.sh
   35 . ./common.sh
   36 StartScript
   37 ChecksRunAsRoot
   38 ChecksXCodeCLI
   39 ChecksCPUCores
   40 OsxCodeName
   41 #RegisterRemoteServers
   42 
   43 #################################################################################################
   44 
   45 # Pathes rules
   46 ORIG_PATH="$PATH"
   47 ORIG_WD="`pwd`"
   48 
   49 export PATH=$INSTALL_PREFIX/bin:/$INSTALL_PREFIX/sbin:$ORIG_PATH
   50 
   51 #################################################################################################
   52 # Build digiKam in temporary directory and installation
   53 
   54 if [ -d "$DK_BUILDTEMP/digikam-$DK_VERSION" ] ; then
   55 
   56     echo "---------- Updating existing $DK_BUILDTEMP"
   57 
   58     cd "$DK_BUILDTEMP"
   59     cd digikam-$DK_VERSION
   60 
   61     git reset --hard
   62     git pull
   63 
   64     mkdir -p build
   65 
   66 else
   67 
   68     echo "---------- Creating $DK_BUILDTEMP"
   69     mkdir -p "$DK_BUILDTEMP"
   70 
   71     if [ $? -ne 0 ] ; then
   72         echo "---------- Cannot create $DK_BUILDTEMP directory."
   73         echo "---------- Aborting..."
   74         exit;
   75     fi
   76 
   77     cd "$DK_BUILDTEMP"
   78     echo -e "\n\n"
   79     echo "---------- Downloading digiKam $DK_VERSION"
   80 
   81     git clone --progress --verbose $DK_GITURL digikam-$DK_VERSION
   82     cd digikam-$DK_VERSION
   83 
   84     if [ $? -ne 0 ] ; then
   85         echo "---------- Cannot clone repositories."
   86         echo "---------- Aborting..."
   87         exit;
   88     fi
   89 
   90     git checkout $DK_VERSION
   91 
   92     mkdir build
   93 
   94 fi
   95 
   96 echo -e "\n\n"
   97 echo "---------- Configure digiKam $DK_VERSION"
   98 
   99 sed -e "s/DIGIKAMSC_CHECKOUT_PO=OFF/DIGIKAMSC_CHECKOUT_PO=ON/g" ./bootstrap.macports > ./tmp.macports ; mv -f ./tmp.macports ./bootstrap.macports
  100 sed -e "s/DIGIKAMSC_COMPILE_PO=OFF/DIGIKAMSC_COMPILE_PO=ON/g"   ./bootstrap.macports > ./tmp.macports ; mv -f ./tmp.macports ./bootstrap.macports
  101 sed -e "s/DBUILD_TESTING=ON/DBUILD_TESTING=OFF/g"               ./bootstrap.macports > ./tmp.macports ; mv -f ./tmp.macports ./bootstrap.macports
  102 sed -e "s/DENABLE_DBUS=ON/DENABLE_DBUS=OFF/g"                   ./bootstrap.macports > ./tmp.macports ; mv -f ./tmp.macports ./bootstrap.macports
  103 chmod +x ./bootstrap.macports
  104 
  105 cp -f $ORIG_WD/fixbundledatapath.sh $DK_BUILDTEMP/digikam-$DK_VERSION
  106 
  107 ./fixbundledatapath.sh
  108 
  109 ./bootstrap.macports "$INSTALL_PREFIX" "debugfull" "x86_64" "-Wno-dev"
  110 
  111 if [ $? -ne 0 ]; then
  112     echo "---------- Cannot configure digiKam $DK_VERSION."
  113     echo "---------- Aborting..."
  114     exit;
  115 fi
  116 
  117 cat ./build/core/app/utils/digikam_version.h | grep "digikam_version\[\]" | awk '{print $6}' | tr -d '";' > $ORIG_WD/data/RELEASEID.txt
  118 
  119 echo -e "\n\n"
  120 echo "---------- Building digiKam $DK_VERSION"
  121 
  122 cd build
  123 make -j$CPU_CORES
  124 
  125 if [ $? -ne 0 ]; then
  126     echo "---------- Cannot compile digiKam $DK_VERSION."
  127     echo "---------- Aborting..."
  128     exit;
  129 fi
  130 
  131 echo -e "\n\n"
  132 echo "---------- Installing digiKam $DK_VERSION"
  133 echo -e "\n\n"
  134 
  135 make install/fast && cd "$ORIG_WD" && rm -rf "$DK_BUILDTEMP"
  136 
  137 if [ $? -ne 0 ]; then
  138     echo "---------- Cannot install digiKam $DK_VERSION."
  139     echo "---------- Aborting..."
  140     exit;
  141 fi
  142 
  143 #################################################################################################
  144 # Install Extra Plugins
  145 
  146 cd $BUILDING_DIR
  147 
  148 rm -rf $BUILDING_DIR/* || true
  149 
  150 cmake $ORIG_WD/../3rdparty \
  151        -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX \
  152        -DINSTALL_ROOT=$INSTALL_PREFIX \
  153        -DEXTERNALS_DOWNLOAD_DIR=$DOWNLOAD_DIR \
  154        -Wno-dev
  155 
  156 cmake --build . --config RelWithDebInfo --target ext_gmic_qt -- -j$CPU_CORES
  157 
  158 #################################################################################################
  159 
  160 export PATH=$ORIG_PATH
  161 
  162 TerminateScript