File indexing completed on 2024-06-16 04:06:49
0001 #! /bin/bash 0002 0003 # Script to bundle data using previously-built digiKam installation. 0004 # and create a PKG file with Packages application (http://s.sudre.free.fr/Software/Packages/about.html) 0005 # This script must be run as sudo 0006 # 0007 # SPDX-FileCopyrightText: 2015 by Shanti, <listaccount at revenant dot org> 0008 # SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0009 # 0010 # SPDX-License-Identifier: BSD-3-Clause 0011 # 0012 0013 # Ask to run as root 0014 (( EUID != 0 )) && exec sudo -- "$0" "$@" 0015 0016 # Halt and catch errors 0017 set -eE 0018 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG 0019 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR 0020 0021 ################################################################################################# 0022 # Manage script traces to log file 0023 0024 mkdir -p ./logs 0025 exec > >(tee ./logs/build-installer.full.log) 2>&1 0026 0027 ################################################################################################# 0028 0029 echo "04-build-installer.sh : build digiKam bundle PKG." 0030 echo "-------------------------------------------------" 0031 0032 ################################################################################################# 0033 # Pre-processing checks 0034 0035 . ./config.sh 0036 . ./common.sh 0037 StartScript 0038 ChecksRunAsRoot 0039 ChecksXCodeCLI 0040 ChecksCPUCores 0041 OsxCodeName 0042 #RegisterRemoteServers 0043 0044 ################################################################################################# 0045 0046 # Paths rules 0047 ORIG_PATH="$PATH" 0048 ORIG_WD="`pwd`" 0049 0050 export PATH=$INSTALL_PREFIX/bin:/$INSTALL_PREFIX/sbin:$ORIG_PATH 0051 0052 DKRELEASEID=`cat $ORIG_WD/data/RELEASEID.txt` 0053 0054 ################################################################################################# 0055 # Configurations 0056 0057 # Directory where this script is located (default - current directory) 0058 BUILDDIR="$PWD" 0059 0060 # Directory where Packages project files are located 0061 PROJECTDIR="$BUILDDIR/installer" 0062 0063 # Staging area where files to be packaged will be copied 0064 TEMPROOT="$BUILDDIR/$RELOCATE_PREFIX" 0065 0066 # Applications to be launched directly by user (create launch scripts) 0067 KDE_MENU_APPS="\ 0068 digikam \ 0069 showfoto \ 0070 " 0071 0072 # Paths to search for applications above 0073 KDE_APP_PATHS="\ 0074 Applications/digiKam.org \ 0075 " 0076 0077 # Other apps - non-MacOS binaries & libraries to be included with required dylibs 0078 OTHER_APPS="\ 0079 lib/plugins/imageformats/*.so \ 0080 lib/plugins/styles/*.so \ 0081 lib/plugins/digikam/bqm/*.so \ 0082 lib/plugins/digikam/generic/*.so \ 0083 lib/plugins/digikam/editor/*.so \ 0084 lib/plugins/digikam/dimg/*.so \ 0085 lib/plugins/digikam/rawimport/*.so \ 0086 lib/mariadb$MARIADB_SUFFIX/bin/mysql \ 0087 lib/mariadb$MARIADB_SUFFIX/bin/mysqld \ 0088 lib/mariadb$MARIADB_SUFFIX/bin/my_print_defaults \ 0089 lib/mariadb$MARIADB_SUFFIX/bin/mysqladmin \ 0090 lib/mariadb$MARIADB_SUFFIX/bin/mysqltest \ 0091 lib/mariadb$MARIADB_SUFFIX/mysql/*.dylib \ 0092 lib/mariadb$MARIADB_SUFFIX/plugin/*.so \ 0093 bin/kbuildsycoca5 \ 0094 bin/solid-hardware5 \ 0095 bin/ffmpeg \ 0096 libexec/qt5/plugins/imageformats/*.dylib \ 0097 libexec/qt5/plugins/sqldrivers/*.dylib \ 0098 libexec/qt5/plugins/printsupport/*.dylib \ 0099 libexec/qt5/plugins/platforms/*.dylib \ 0100 libexec/qt5/plugins/platformthemes/*.dylib \ 0101 libexec/qt5/plugins/iconengines/*.dylib \ 0102 libexec/qt5/plugins/generic/*.dylib \ 0103 libexec/qt5/plugins/styles/*.dylib \ 0104 libexec/qt5/plugins/bearer/*.dylib \ 0105 " 0106 0107 #lib/sane/*.so \ 0108 0109 binaries="$OTHER_APPS" 0110 0111 # Additional Files/Directories - to be copied recursively but not checked for dependencies 0112 # Note: dSYM directories are copied as well and cleaned later if debug symbols must be removed in final bundle. 0113 OTHER_DIRS="\ 0114 libexec/qt5/translations \ 0115 lib/libdigikam*.dSYM \ 0116 lib/plugins \ 0117 lib/libgphoto2 \ 0118 lib/libgphoto2_port \ 0119 lib/mariadb$MARIADB_SUFFIX \ 0120 lib/ImageMagick* \ 0121 share/mariadb$MARIADB_SUFFIX \ 0122 share/ImageMagick* \ 0123 etc/xdg \ 0124 etc/ImageMagick* \ 0125 etc/mariadb$MARIADB_SUFFIX \ 0126 " 0127 0128 #etc/sane.d \ 0129 0130 # Additional Data Directories - to be copied recursively 0131 OTHER_DATA="\ 0132 share/applications \ 0133 share/opencv4 \ 0134 share/k* \ 0135 share/lensfun \ 0136 share/mime \ 0137 Library/Application/ \ 0138 " 0139 0140 # Packaging tool paths 0141 PACKAGESBUILD="/usr/local/bin/packagesbuild" 0142 RECURSIVE_LIBRARY_LISTER="$BUILDDIR/rll.py" 0143 0144 echo "digiKam version: $DKRELEASEID" 0145 0146 # ./installer sub-dir must be writable by root 0147 chmod 777 ${PROJECTDIR} 0148 0149 ################################################################################################# 0150 # Check if Packages CLI tools are installed 0151 0152 if [[ (! -f "$PACKAGESBUILD") ]] ; then 0153 echo "Packages CLI tool is not installed" 0154 echo "See http://s.sudre.free.fr/Software/Packages/about.html for details." 0155 exit 1 0156 else 0157 echo "Check Packages CLI tool passed..." 0158 fi 0159 0160 ################################################################################################# 0161 # Create temporary dir to build package contents 0162 0163 if [ -d "$TEMPROOT" ] ; then 0164 echo "---------- Removing temporary packaging directory $TEMPROOT" 0165 rm -rf "$TEMPROOT" 0166 fi 0167 0168 echo "Creating $TEMPROOT" 0169 mkdir -p "$TEMPROOT" 0170 0171 ################################################################################################# 0172 # Prepare applications for MacOS 0173 0174 echo "---------- Preparing Applications for MacOS" 0175 0176 for app in $KDE_MENU_APPS ; do 0177 echo " $app" 0178 0179 # Look for application 0180 0181 for searchpath in $KDE_APP_PATHS ; do 0182 0183 # Copy the application if it is found (create directory if necessary) 0184 0185 if [ -d "$INSTALL_PREFIX/$searchpath/$app.app" ] ; then 0186 0187 echo " Found $app in $INSTALL_PREFIX/$searchpath" 0188 0189 # Copy application directory 0190 0191 echo " Copying $app" 0192 cp -pr "$INSTALL_PREFIX/$searchpath/$app.app" "$TEMPROOT" 0193 0194 # Add executable to list of binaries for which we need to collect dependencies for 0195 0196 binaries="$binaries $searchpath/$app.app/Contents/MacOS/$app" 0197 0198 chmod 755 "$TEMPROOT/$app.app" 0199 0200 fi 0201 0202 done 0203 0204 done 0205 0206 ################################################################################################# 0207 # Collect dylib dependencies for all binaries, 0208 # then copy them to the staging area (creating directories as required) 0209 0210 echo "---------- Collecting dependencies for applications, binaries, and libraries..." 0211 0212 cd "$INSTALL_PREFIX" 0213 0214 "$RECURSIVE_LIBRARY_LISTER" $binaries | sort -u | \ 0215 while read lib ; do 0216 lib="`echo $lib | sed "s:$INSTALL_PREFIX/::"`" 0217 0218 if [ ! -e "$TEMPROOT/$lib" ] ; then 0219 dir="${lib%/*}" 0220 0221 if [ ! -d "$TEMPROOT/$dir" ] ; then 0222 echo " Creating $TEMPROOT/$dir" 0223 mkdir -p "$TEMPROOT/$dir" 0224 fi 0225 0226 echo " Copying $INSTALL_PREFIX/$lib to $TEMPROOT/$dir/" 0227 cp -aH "$INSTALL_PREFIX/$lib" "$TEMPROOT/$dir/" 0228 fi 0229 done 0230 0231 ################################################################################################# 0232 # Copy non-binary files and directories, creating parent directories if needed 0233 0234 echo "---------- Copying binary files..." 0235 0236 for path in $OTHER_APPS ; do 0237 dir="${path%/*}" 0238 0239 if [ ! -d "$TEMPROOT/$dir" ] ; then 0240 echo " Creating $TEMPROOT/$dir" 0241 mkdir -p "$TEMPROOT/$dir" 0242 fi 0243 0244 echo " Copying $INSTALL_PREFIX/$path to $TEMPROOT/$dir/" 0245 cp -aH "$INSTALL_PREFIX/$path" "$TEMPROOT/$dir/" 0246 done 0247 0248 echo "---------- Copying directory contents..." 0249 0250 for path in $OTHER_DIRS ; do 0251 dir="${path%/*}" 0252 0253 if [ ! -d "$TEMPROOT/$dir" ] ; then 0254 echo " Creating $TEMPROOT/$dir" 0255 mkdir -p "$TEMPROOT/$dir" 0256 fi 0257 0258 echo " Copying $INSTALL_PREFIX/$path to $TEMPROOT/$dir/" 0259 cp -aH "$INSTALL_PREFIX/$path" "$TEMPROOT/$dir/" 0260 done 0261 0262 0263 echo "---------- Copying data files..." 0264 0265 # Special case with data dirs. QStandardPaths::GenericDataLocation was patched everywhere 0266 # in source code by QStandardPaths::AppDataLocation 0267 0268 for path in $OTHER_DATA ; do 0269 echo " Copying $path" 0270 cp -a "$INSTALL_PREFIX/$path" "$TEMPROOT/digikam.app/Contents/Resources/" 0271 done 0272 0273 # Copy digiKam hi-colors PNG icons-set to the bundle 0274 0275 mkdir -p "$TEMPROOT/digikam.app/Contents/Resources/icons/" 0276 cp -a "$INSTALL_PREFIX/share/icons/hicolor" "$TEMPROOT/digikam.app/Contents/Resources/icons/" 0277 0278 echo "---------- Copying Qt Web Backend files..." 0279 0280 # Qt Web framework bin data files. 0281 # NOTE: Since Qt 5.15.0, QtWebEngine runtime process is now located in 0282 # libexec/qt5/lib/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS 0283 # instead of libexec/qt5/libexec/. No needs to make extra rules for this runtime process. 0284 0285 if [[ $DK_QTWEBENGINE = 0 ]] ; then 0286 0287 # Rules for QtWebKit runtime process 0288 0289 mkdir -p $TEMPROOT/libexec/qt5/libexec/ 0290 0291 # QtWebKit runtime process 0292 0293 [[ -e $INSTALL_PREFIX/libexec/qt5/libexec/QtWebNetworkProcess ]] && cp -a "$INSTALL_PREFIX/libexec/qt5/libexec/QtWebNetworkProcess" "$TEMPROOT/libexec/qt5/libexec/" 0294 [[ -e $INSTALL_PREFIX/libexec/qt5/libexec/QtWebProcess ]] && cp -a "$INSTALL_PREFIX/libexec/qt5/libexec/QtWebProcess" "$TEMPROOT/libexec/qt5/libexec/" 0295 [[ -e $INSTALL_PREFIX/libexec/qt5/libexec/QtWebStorageProcess ]] && cp -a "$INSTALL_PREFIX/libexec/qt5/libexec/QtWebStorageProcess" "$TEMPROOT/libexec/qt5/libexec/" 0296 0297 fi 0298 0299 echo "---------- Copying i18n..." 0300 0301 i18nprefix=$INSTALL_PREFIX/share/ 0302 cd $i18nprefix 0303 0304 FILES=$(cat $ORIG_WD/logs/build-extralibs.full.log | grep "$INSTALL_PREFIX/share/locale/" | cut -d' ' -f3 | awk '{sub("'"$i18nprefix"'","")}1') 0305 0306 for FILE in $FILES ; do 0307 rsync -R "./$FILE" "$TEMPROOT/digikam.app/Contents/Resources/" 0308 done 0309 0310 FILES=$(cat $ORIG_WD/logs/build-digikam.full.log | grep "$INSTALL_PREFIX/share/locale/" | cut -d' ' -f3 | awk '{sub("'"$i18nprefix"'","")}1') 0311 0312 for FILE in $FILES ; do 0313 rsync -R "./$FILE" "$TEMPROOT/digikam.app/Contents/Resources/" 0314 done 0315 0316 # Move Qt translation data files at the right place in the bundle. See Bug #438701. 0317 0318 mv -v $TEMPROOT/libexec/qt5/translations $TEMPROOT/digikam.app/Contents/Resources/ 0319 0320 # To support localized system menu entries from MacOS. See bug #432650. 0321 0322 FILES=$(find "$TEMPROOT/digikam.app/Contents/Resources/locale" -type d -depth 1) 0323 0324 for FILE in $FILES ; do 0325 BASE=$(basename $FILE) 0326 echo "Create localized system menu entry for $BASE" 0327 mkdir "$TEMPROOT/digikam.app/Contents/Resources/$BASE.lproj" 0328 done 0329 0330 # Showfoto resources dir must be merged with digiKam. 0331 0332 cp -a "$TEMPROOT/showfoto.app/Contents/Resources/" "$TEMPROOT/digikam.app/Contents/Resources/" 0333 rm -rf "$TEMPROOT/showfoto.app/Contents/Resources" 0334 0335 cd "$ORIG_WD" 0336 0337 ################################################################################################# 0338 # Move digiKam and KF5 run-time plugins to the right place 0339 0340 cp -a $TEMPROOT/lib/plugins $TEMPROOT/libexec/qt5/ 0341 rm -rf $TEMPROOT/lib/plugins 0342 0343 ################################################################################################# 0344 # Merge Manifest files 0345 0346 echo "---------- Copy Git Revisions Manifest\n" 0347 0348 touch $TEMPROOT/digikam.app/Contents/Resources/MANIFEST.txt 0349 0350 FILES=$(ls $ORIG_WD/data/*_manifest.txt) 0351 0352 for FILE in $FILES ; do 0353 echo $FILE 0354 cat $FILE >> $TEMPROOT/digikam.app/Contents/Resources/MANIFEST.txt 0355 done 0356 0357 ################################################################################################# 0358 # Create package pre-install script 0359 0360 echo "---------- Create package pre-install script" 0361 0362 # Delete /Applications entries, delete existing installation 0363 0364 cat << EOF > "$PROJECTDIR/preinstall" 0365 #!/bin/bash 0366 0367 if [ -d /Applications/digiKam ] ; then 0368 echo "Removing digiKam directory from Applications folder" 0369 rm -r /Applications/digiKam 0370 fi 0371 0372 if [ -d /Applications/digikam.app ] ; then 0373 echo "Removing legacy digikam.app from Applications folder" 0374 rm -r /Applications/digikam.app 0375 fi 0376 0377 if [ -d /Applications/showfoto.app ] ; then 0378 echo "Removing legacy showfoto.app from Applications folder" 0379 rm -r /Applications/showfoto.app 0380 fi 0381 0382 if [ -d "/opt/digikam" ] ; then 0383 echo "Removing legacy /opt/digikam" 0384 rm -rf "/opt/digikam" 0385 fi 0386 EOF 0387 0388 # Pre-install script need to be executable 0389 0390 chmod 755 "$PROJECTDIR/preinstall" 0391 0392 ################################################################################################# 0393 # Create package post-install script 0394 0395 echo "---------- Create package post-install script" 0396 0397 # Creates Applications menu icons 0398 0399 cat << EOF > "$PROJECTDIR/postinstall" 0400 #!/bin/bash 0401 0402 # NOTE: Disabled with relocate bundle 0403 #for app in $INSTALL_PREFIX/Applications/digiKam/*.app ; do 0404 # ln -s "\$app" /Applications/\${app##*/} 0405 #done 0406 EOF 0407 0408 # Post-install script need to be executable 0409 0410 chmod 755 "$PROJECTDIR/postinstall" 0411 0412 ################################################################################################# 0413 # Copy icons-set resource files. 0414 0415 cp $INSTALL_PREFIX/share/icons/breeze/breeze-icons.rcc $TEMPROOT/digikam.app/Contents/Resources/breeze.rcc 0416 cp $INSTALL_PREFIX/share/icons/breeze-dark/breeze-icons-dark.rcc $TEMPROOT/digikam.app/Contents/Resources/breeze-dark.rcc 0417 0418 ################################################################################################# 0419 # Cleanup symbols in binary files to free space. 0420 0421 echo -e "\n---------- Strip symbols in binary files\n" 0422 0423 if [[ $DK_DEBUG = 1 ]] ; then 0424 0425 find $TEMPROOT -name "*.so" | grep -Ev '(digikam|showfoto)' | xargs strip -SXx 0426 find $TEMPROOT -name "*.dylib" | grep -Ev '(digikam|showfoto)' | xargs strip -SXx 0427 0428 else 0429 0430 # no debug symbols at all. 0431 0432 find $TEMPROOT -perm +111 -type f | xargs strip -SXx 2>/dev/null 0433 0434 # Under MacOS, all debug symbols are stored to separated dSYM sub directories near binary files. 0435 0436 DSYMDIRS=`find $TEMPROOT -type d -name "*.dSYM"` 0437 0438 for dsym in $DSYMDIRS ; do 0439 0440 rm -fr $dsym 0441 echo "Remove debug symbols from $dsym" 0442 0443 done 0444 0445 fi 0446 0447 if [[ $DK_DEBUG = 1 ]] ; then 0448 0449 DEBUG_SUF="-debug" 0450 0451 fi 0452 0453 ################################################################################################# 0454 # Relocatable binary files. For details, see these urls: 0455 # 0456 # https://stackoverflow.com/questions/9263256/can-you-please-help-me-understand-how-mach-o-libraries-work-in-mac-os-x 0457 # https://matthew-brett.github.io/docosx/mac_runtime_link.html 0458 # https://thecourtsofchaos.com/2013/09/16/how-to-copy-and-relink-binaries-on-osx/ 0459 0460 echo -e "\n---------- Relocatable binary files" 0461 0462 # Relocatable dynamic libraries with rpath 0463 0464 echo -e "\n--- Relocatable dynamic library files" 0465 0466 DYLIBFILES=(`find $TEMPROOT -name "*.dylib"`) 0467 0468 RelocatableBinaries DYLIBFILES[@] 0469 0470 # Relocatable system objects with rpath 0471 0472 echo -e "\n--- Relocatable system object files" 0473 0474 SOFILES=(`find $TEMPROOT -name "*.so"`) 0475 0476 RelocatableBinaries SOFILES[@] 0477 0478 # Relocatable executables with rpath and patch relative search path. 0479 0480 echo -e "\n--- Relocatable executable files" 0481 0482 EXECFILES=(`find $TEMPROOT -type f -perm +ugo+x ! -name "*.dylib" ! -name "*.so"`) 0483 0484 RelocatableBinaries EXECFILES[@] 0485 0486 echo -e "\n--- Patch RPATH in executable files" 0487 0488 for APP in ${EXECFILES[@]} ; do 0489 0490 ISBINARY=`file "$APP" | grep "Mach-O" || true` 0491 0492 # Do not touch debug extension 0493 ISDSYM=`file "$APP" | grep "dSYM" || true` 0494 0495 # Do not patch applet files which are pure Apple API binaries 0496 BASENAME=`basename "$APP"` 0497 0498 if [[ $ISBINARY ]] && [[ ! $ISDSYM ]] && [[ $BASENAME != "applet" ]] ; then 0499 0500 install_name_tool -add_rpath @executable_path/.. $APP 0501 install_name_tool -add_rpath @executable_path/../.. $APP 0502 install_name_tool -add_rpath @executable_path/../../.. $APP 0503 install_name_tool -add_rpath @executable_path/../../../.. $APP 0504 install_name_tool -add_rpath @executable_path/../../../../.. $APP 0505 install_name_tool -add_rpath @executable_path/../../../../../.. $APP 0506 install_name_tool -add_rpath @executable_path/../../../../../../.. $APP 0507 install_name_tool -add_rpath @executable_path/../../../../../../../.. $APP 0508 install_name_tool -add_rpath @executable_path/../../../../../../../../.. $APP 0509 install_name_tool -add_rpath @executable_path/../../../../../../../../../.. $APP 0510 0511 echo "Patch $APP" 0512 0513 fi 0514 0515 done 0516 0517 ################################################################################################# 0518 # Final stage to manage file places in bundle 0519 0520 echo -e "\n---------- Finalize files in bundle" 0521 0522 mv -v $TEMPROOT/bin $TEMPROOT/digikam.app/Contents/ 0523 mv -v $TEMPROOT/share $TEMPROOT/digikam.app/Contents/ 0524 mv -v $TEMPROOT/etc $TEMPROOT/digikam.app/Contents/ 0525 mv -v $TEMPROOT/lib $TEMPROOT/digikam.app/Contents/ 0526 mv -v $TEMPROOT/libexec $TEMPROOT/digikam.app/Contents/ 0527 0528 ln -sv "../../digikam.app/Contents/bin" "$TEMPROOT/showfoto.app/Contents/bin" 0529 ln -sv "../../digikam.app/Contents/etc" "$TEMPROOT/showfoto.app/Contents/etc" 0530 ln -sv "../../digikam.app/Contents/lib" "$TEMPROOT/showfoto.app/Contents/lib" 0531 ln -sv "../../digikam.app/Contents/libexec" "$TEMPROOT/showfoto.app/Contents/libexec" 0532 ln -sv "../../digikam.app/Contents/share" "$TEMPROOT/showfoto.app/Contents/share" 0533 ln -sv "../../digikam.app/Contents/Resources" "$TEMPROOT/showfoto.app/Contents/Resources" 0534 0535 echo -e "\n---------- Cleanup files in bundle" 0536 0537 # Last cleanup 0538 0539 HEADERFILES=(`find $TEMPROOT -name "*.h" -o -name "*.hpp"`) 0540 0541 for HPP in ${HEADERFILES[@]} ; do 0542 0543 rm -fv $HPP 0544 0545 done 0546 0547 rm -rfv $TEMPROOT/digikam.app/Contents/share/mariadb$MARIADB_SUFFIX/mysql-test 0548 rm -rfv $TEMPROOT/digikam.app/Contents/share/mariadb$MARIADB_SUFFIX/sql-bench 0549 0550 echo -e "\n---------- Patch config and script files in bundle" 0551 0552 MARIADBDIRS=(`find $TEMPROOT -type d -name "mariadb$MARIADB_SUFFIX"`) 0553 0554 for DIR in ${MARIADBDIRS[@]} ; do 0555 0556 MARIADBFILES=(`find $DIR -type f ! -name "*.dylib" ! -name "*.so"`) 0557 0558 for FILE in ${MARIADBFILES[@]} ; do 0559 0560 # to handle only text files 0561 ISTEXT=`file "$FILE" | grep "ASCII text" || true` 0562 0563 if [[ $ISTEXT ]] ; then 0564 0565 NEEDPATCH=`grep "$INSTALL_PREFIX" "$FILE" || true` 0566 0567 if [[ $NEEDPATCH ]] ; then 0568 0569 echo -e "--- Patching $FILE..." 0570 sed -i '' "s|$INSTALL_PREFIX/var|$RELOCATE_PREFIX/digikam.app/Contents/var|g" $FILE 0571 sed -i '' "s|$INSTALL_PREFIX/lib|$RELOCATE_PREFIX/digikam.app/Contents/lib|g" $FILE 0572 sed -i '' "s|$INSTALL_PREFIX/share|$RELOCATE_PREFIX/digikam.app/Contents/share|g" $FILE 0573 sed -i '' "s|$INSTALL_PREFIX/etc|$RELOCATE_PREFIX/digikam.app/Contents/etc|g" $FILE 0574 sed -i '' "s|$INSTALL_PREFIX|$RELOCATE_PREFIX/digikam.app/Contents/|g" $FILE 0575 0576 fi 0577 0578 fi 0579 0580 done 0581 0582 done 0583 0584 ################################################################################################# 0585 # See bug #436624: move mariadb share files at basedir (this must be done after patch operations) 0586 0587 rsync -a "$TEMPROOT/digikam.app/Contents/share/mariadb$MARIADB_SUFFIX" "$TEMPROOT/digikam.app/Contents/lib/mariadb$MARIADB_SUFFIX/share/" 0588 rm -fr "$TEMPROOT/digikam.app/Contents/share/mariadb$MARIADB_SUFFIX" 0589 0590 # At run time, digiKam will check for mariadb folder-name without revision numbers. 0591 0592 ln -sv "../../../../../digikam.app/Contents/lib/mariadb$MARIADB_SUFFIX/share/mariadb$MARIADB_SUFFIX" "$TEMPROOT/digikam.app/Contents/lib/mariadb$MARIADB_SUFFIX/share/mariadb" 0593 ln -sv "../../../digikam.app/Contents/lib/mariadb$MARIADB_SUFFIX" "$TEMPROOT/digikam.app/Contents/lib/mariadb" 0594 ln -sv "../../../digikam.app/Contents/etc/mariadb$MARIADB_SUFFIX" "$TEMPROOT/digikam.app/Contents/etc/mariadb" 0595 0596 ################################################################################################# 0597 # Install ExifTool binary. 0598 0599 cd $DOWNLOAD_DIR 0600 0601 #if [ ! -f "$DOWNLOAD_DIR/Image-ExifTool.tar.gz" ] ; then 0602 wget https://files.kde.org/digikam/exiftool/Image-ExifTool.tar.gz -O Image-ExifTool.tar.gz 0603 #fi 0604 0605 tar -xvf "$DOWNLOAD_DIR/Image-ExifTool.tar.gz" -C "$TEMPROOT/digikam.app/Contents/bin" 0606 cd $TEMPROOT/digikam.app/Contents/bin 0607 EXIFTOOL_DIR=$(ls -d Image-ExifTool*) 0608 ln -sv "./$EXIFTOOL_DIR" "./Image-ExifTool" 0609 ln -sv "./Image-ExifTool/exiftool" "exiftool" 0610 0611 ################################################################################################# 0612 # Build PKG file 0613 0614 echo "---------- Create MacOS package for digiKam $DKRELEASEID" 0615 0616 mkdir -p $ORIG_WD/bundle 0617 rm -f $ORIG_WD/bundle/*x86-64$DEBUG_SUF* || true 0618 0619 if [[ $DK_VERSION != v* ]] ; then 0620 0621 # with non-official release version, use build time-stamp as sub-version string. 0622 DK_SUBVER="-`cat $ORIG_WD/data/BUILDDATE.txt`" 0623 0624 else 0625 0626 # with official release version, disable upload to KDE server, as this break check for new version function. 0627 echo -e "Official release version detected, upload is disabled.\n" 0628 DK_UPLOAD=0 0629 0630 fi 0631 0632 TARGET_INSTALLER=digiKam-$DKRELEASEID$DK_SUBVER-MacOS-x86-64$DEBUG_SUF.pkg 0633 TARGET_PKG_FILE=$BUILDDIR/bundle/$TARGET_INSTALLER 0634 echo -e "Target PKG file : $TARGET_PKG_FILE" 0635 0636 chmod 666 $PROJECTDIR/digikam.pkgproj 0637 0638 $PACKAGESBUILD -v "$PROJECTDIR/digikam.pkgproj" --package-version "$DKRELEASEID" 0639 0640 mv "$PROJECTDIR/build/digikam.pkg" "$TARGET_PKG_FILE" 0641 0642 ################################################################################################# 0643 # Show resume information and future instructions to host PKG file to remote server 0644 0645 echo -e "\n---------- Compute package checksums for digiKam $DKRELEASEID\n" > $TARGET_PKG_FILE.sum 0646 echo "File : $TARGET_PKG_FILE" >> $TARGET_PKG_FILE.sum 0647 echo -n "Size : " >> $TARGET_PKG_FILE.sum 0648 du -h "$TARGET_PKG_FILE" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum 0649 echo -n "SHA256 sum : " >> $TARGET_PKG_FILE.sum 0650 shasum -a256 "$TARGET_PKG_FILE" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum 0651 0652 # Checksums to post on Phabricator at release time. 0653 shasum -a256 "$TARGET_PKG_FILE" > $BUILDDIR/bundle/sha256_release.sum 0654 0655 if [[ $DK_SIGN = 1 ]] ; then 0656 0657 cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv "$TARGET_PKG_FILE" 0658 mv -f $TARGET_PKG_FILE.asc $TARGET_PKG_FILE.sig 0659 0660 echo "File : $TARGET_PKG_FILE.sig" >> $TARGET_PKG_FILE.sum 0661 echo -n "Size : " >> $TARGET_PKG_FILE.sum 0662 du -h "$TARGET_PKG_FILE.sig" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum 0663 echo -n "SHA256 sum : " >> $TARGET_PKG_FILE.sum 0664 shasum -a256 "$TARGET_PKG_FILE.sig" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum 0665 0666 # Checksums to post on Phabricator at release time. 0667 shasum -a256 "$TARGET_PKG_FILE.sig" >> $BUILDDIR/bundle/sha256_release.sum 0668 0669 fi 0670 0671 cat $TARGET_PKG_FILE.sum 0672 0673 if [[ $DK_UPLOAD = 1 ]] ; then 0674 0675 echo -e "---------- Cleanup older bundle Package files from files.kde.org repository \n" 0676 0677 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm *-MacOS-x86-64$DEBUG_SUF.pkg*" 0678 0679 echo -e "---------- Upload new bundle Package files to files.kde.org repository \n" 0680 0681 rsync -r -v --progress -e ssh $BUILDDIR/bundle/$TARGET_INSTALLER $DK_UPLOADURL:$DK_UPLOADDIR 0682 0683 if [[ $DK_SIGN = 1 ]] ; then 0684 scp $BUILDDIR/bundle/$TARGET_INSTALLER.sig $DK_UPLOADURL:$DK_UPLOADDIR 0685 fi 0686 0687 # update remote files list 0688 0689 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "ls digi*" > $ORIG_WD/bundle/ls.txt 0690 tail -n +2 $ORIG_WD/bundle/ls.txt > $ORIG_WD/bundle/ls.tmp 0691 cat $ORIG_WD/bundle/ls.tmp | grep -E '(.pkg |.appimage |.exe )' | grep -Ev '(debug)' > $ORIG_WD/bundle/FILES 0692 rm $ORIG_WD/bundle/ls.tmp 0693 rm $ORIG_WD/bundle/ls.txt 0694 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm FILES" 0695 rsync -r -v --progress -e ssh $BUILDDIR/bundle/FILES $DK_UPLOADURL:$DK_UPLOADDIR 0696 0697 else 0698 echo -e "\n------------------------------------------------------------------" 0699 curl https://download.kde.org/README_UPLOAD 0700 echo -e "------------------------------------------------------------------\n" 0701 fi 0702 0703 ################################################################################################# 0704 0705 TerminateScript