| 1 |
#! /bin/bash |
| 2 |
|
| 3 |
# Script to bundle data using previously-built digiKam installation. |
| 4 |
# and create a PKG file with Packages application (http://s.sudre.free.fr/Software/Packages/about.html) |
| 5 |
# This script must be run as sudo |
| 6 |
# |
| 7 |
# SPDX-FileCopyrightText: 2015 by Shanti, <listaccount at revenant dot org> |
| 8 |
# SPDX-FileCopyrightText: 2015-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 9 |
# |
| 10 |
# SPDX-License-Identifier: BSD-3-Clause |
| 11 |
# |
| 12 |
|
| 13 |
# Ask to run as root |
| 14 |
(( EUID != 0 )) && exec sudo -- "$0" "$@" |
| 15 |
|
| 16 |
# Halt and catch errors |
| 17 |
set -eE |
| 18 |
trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG |
| 19 |
trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR |
| 20 |
|
| 21 |
################################################################################################# |
| 22 |
# Manage script traces to log file |
| 23 |
|
| 24 |
mkdir -p ./logs |
| 25 |
exec > >(tee ./logs/build-installer.full.log) 2>&1 |
| 26 |
|
| 27 |
################################################################################################# |
| 28 |
|
| 29 |
echo "04-build-installer.sh : build digiKam bundle PKG." |
| 30 |
echo "-------------------------------------------------" |
| 31 |
|
| 32 |
################################################################################################# |
| 33 |
# Pre-processing checks |
| 34 |
|
| 35 |
. ./config.sh |
| 36 |
. ./common.sh |
| 37 |
StartScript |
| 38 |
ChecksRunAsRoot |
| 39 |
ChecksXCodeCLI |
| 40 |
ChecksCPUCores |
| 41 |
OsxCodeName |
| 42 |
#RegisterRemoteServers |
| 43 |
|
| 44 |
################################################################################################# |
| 45 |
|
| 46 |
# Paths rules |
| 47 |
ORIG_PATH="$PATH" |
| 48 |
ORIG_WD="`pwd`" |
| 49 |
|
| 50 |
export PATH=$INSTALL_PREFIX/bin:/$INSTALL_PREFIX/sbin:$ORIG_PATH |
| 51 |
|
| 52 |
DKRELEASEID=`cat $ORIG_WD/data/RELEASEID.txt` |
| 53 |
|
| 54 |
################################################################################################# |
| 55 |
# Configurations |
| 56 |
|
| 57 |
# Directory where this script is located (default - current directory) |
| 58 |
BUILDDIR="$PWD" |
| 59 |
|
| 60 |
# Directory where Packages project files are located |
| 61 |
PROJECTDIR="$BUILDDIR/installer" |
| 62 |
|
| 63 |
# Staging area where files to be packaged will be copied |
| 64 |
TEMPROOT="$BUILDDIR/$RELOCATE_PREFIX" |
| 65 |
|
| 66 |
DK_APP_CONTENTS="digikam.app/Contents" |
| 67 |
|
| 68 |
# Applications to be launched directly by user (create launch scripts) |
| 69 |
KDE_MENU_APPS="\ |
| 70 |
digikam \ |
| 71 |
showfoto \ |
| 72 |
" |
| 73 |
|
| 74 |
# Paths to search for applications above |
| 75 |
KDE_APP_PATHS="\ |
| 76 |
Applications/digiKam.org \ |
| 77 |
" |
| 78 |
#bin \ |
| 79 |
|
| 80 |
QT_FRAMEWORKS="\ |
| 81 |
QtQuickTimeline \ |
| 82 |
Qt3DInput \ |
| 83 |
QtQuick3DAssetUtils \ |
| 84 |
QtWebEngineCore \ |
| 85 |
QtDesigner \ |
| 86 |
QtWebEngineQuick \ |
| 87 |
QtQuick3DAssetImport \ |
| 88 |
QtWebEngineWidgets \ |
| 89 |
QtQuickWidgets \ |
| 90 |
QtShaderTools \ |
| 91 |
Qt3DQuickScene2D \ |
| 92 |
QtOpcUa \ |
| 93 |
QtPdf \ |
| 94 |
Qt3DRender \ |
| 95 |
QtQuick3DRuntimeRender \ |
| 96 |
QtGui \ |
| 97 |
QtDBus \ |
| 98 |
QtQuick3DUtils \ |
| 99 |
QtPositioningQuick \ |
| 100 |
Qt3DCore \ |
| 101 |
QtLocation \ |
| 102 |
QtXml \ |
| 103 |
QtSerialPort \ |
| 104 |
QtWebView \ |
| 105 |
QtQuick \ |
| 106 |
QtScxml \ |
| 107 |
QtCore \ |
| 108 |
QtQml \ |
| 109 |
Qt3DExtras \ |
| 110 |
QtWebChannel \ |
| 111 |
QtMultimedia \ |
| 112 |
QtVirtualKeyboard \ |
| 113 |
QtOpenGL \ |
| 114 |
QtQmlCompiler \ |
| 115 |
QtOpenGLWidgets \ |
| 116 |
Qt3DQuick \ |
| 117 |
QtWidgets \ |
| 118 |
QtPositioning \ |
| 119 |
QtQuick3D \ |
| 120 |
Qt3DLogic \ |
| 121 |
QtQuickShapes \ |
| 122 |
QtNetwork \ |
| 123 |
QtSvg \ |
| 124 |
QtWebChannelQuick \ |
| 125 |
QtQmlModels \ |
| 126 |
QtSensors \ |
| 127 |
Qt3DAnimation \ |
| 128 |
QtTextToSpeech \ |
| 129 |
QtWebViewQuick \ |
| 130 |
QtSerialBus \ |
| 131 |
QtConcurrent \ |
| 132 |
QtNetworkAuth \ |
| 133 |
QtPrintSupport \ |
| 134 |
QtStateMachine \ |
| 135 |
QtSvgWidgets \ |
| 136 |
QtMultimediaWidgets \ |
| 137 |
QtSql \ |
| 138 |
QtWebEngineCore \ |
| 139 |
QtMultimediaWidgets \ |
| 140 |
QtNetworkAuth \ |
| 141 |
QtPrintSupport \ |
| 142 |
QtStateMachine \ |
| 143 |
QtSvgWidgets \ |
| 144 |
" |
| 145 |
# Other apps - non-MacOS binaries & libraries to be included with required dylibsQT_PLUGIN_EXT |
| 146 |
|
| 147 |
if [[ $ARCH_TARGET = "x86_64" ]] ; then |
| 148 |
QT_PLUGIN_EXT="so" |
| 149 |
else |
| 150 |
QT_PLUGIN_EXT="dylib" |
| 151 |
fi |
| 152 |
|
| 153 |
# Note: lib/plugins/styles/ files are *.so in both architectures. Why this mess? |
| 154 |
MARIADB_SOURCE_DIR="opt/mariadb" |
| 155 |
|
| 156 |
OTHER_APPS="\ |
| 157 |
share/qt/plugins/imageformats/*.dylib \ |
| 158 |
share/qt/plugins/styles/*.dylib \ |
| 159 |
share/qt/plugins/digikam/bqm/*.so \ |
| 160 |
share/qt/plugins/digikam/generic/*.so \ |
| 161 |
share/qt/plugins/digikam/editor/*.so \ |
| 162 |
share/qt/plugins/digikam/dimg/*.so \ |
| 163 |
share/qt/plugins/digikam/rawimport/*.so \ |
| 164 |
bin/kbuildsycoca$DK_QTVERSION \ |
| 165 |
bin/solid-hardware$DK_QTVERSION \ |
| 166 |
bin/ffmpeg \ |
| 167 |
bin/hunspell \ |
| 168 |
opt/qt$DK_QTVERSION/share/qt/plugins/imageformats/*.dylib \ |
| 169 |
opt/qt$DK_QTVERSION/share/qt/plugins/sqldrivers/*.dylib \ |
| 170 |
opt/qt$DK_QTVERSION/share/qt/plugins/platforms/*.dylib \ |
| 171 |
opt/qt$DK_QTVERSION/share/qt/plugins/iconengines/*.dylib \ |
| 172 |
opt/qt$DK_QTVERSION/share/qt/plugins/generic/*.dylib \ |
| 173 |
opt/qt$DK_QTVERSION/share/qt/plugins/styles/*.dylib \ |
| 174 |
opt/qt$DK_QTVERSION/share/qt/plugins/multimedia/*.dylib \ |
| 175 |
opt/qt$DK_QTVERSION/share/qt/plugins/tls/*.dylib \ |
| 176 |
lib/libhunspell*.dylib \ |
| 177 |
opt/openssl@3/lib/*.dylib \ |
| 178 |
" |
| 179 |
|
| 180 |
if [[ $ARCH_TARGET = "x86_64" ]] ; then |
| 181 |
OTHER_APPS="$OTHER_APPS \ |
| 182 |
opt/zstd/lib/*.dylib \ |
| 183 |
" |
| 184 |
fi |
| 185 |
#lib/plugins/imageformats/*.dylib \ |
| 186 |
|
| 187 |
|
| 188 |
#opt/qt-mariadb/share/qt/plugins/sqldrivers/*.dylib \ |
| 189 |
#lib/sane/*.so \ |
| 190 |
# opt/mariadb/bin/mysql \ |
| 191 |
# opt/mariadb/bin/mysqld \ |
| 192 |
# opt/mariadb/bin/my_print_defaults \ |
| 193 |
# opt/mariadb/bin/mysqladmin \ |
| 194 |
# opt/mariadb/bin/mysqltest \ |
| 195 |
# opt/mariadb/lib/*.dylib \ |
| 196 |
# opt/mariadb/lib/plugin/*.so \ |
| 197 |
|
| 198 |
binaries="$OTHER_APPS" |
| 199 |
|
| 200 |
# Additional Files/Directories - to be copied recursively but not checked for dependencies |
| 201 |
# |
| 202 |
# NOTE: dSYM directories are copied as well and cleaned later if debug symbols must be removed in final bundle. |
| 203 |
# |
| 204 |
# QtWebEngine runtime process and binary archives (.pak) are located in libexec/qt$DK_QTVERSION/lib/QtWebEngineCore.framework/ |
| 205 |
# |
| 206 |
OTHER_DIRS="\ |
| 207 |
share/qt/translations \ |
| 208 |
share/qt/plugins \ |
| 209 |
lib/libdigikam*.dSYM \ |
| 210 |
Cellar/libgphoto2/2.5.31/lib \ |
| 211 |
lib/ImageMagick* \ |
| 212 |
share/ImageMagick* \ |
| 213 |
etc/ImageMagick* \ |
| 214 |
" |
| 215 |
# Cellar/qt/6.7.0_2/lib/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app \ |
| 216 |
# Cellar/qt/6.7.0_2/lib/QtWebEngineCore.framework/Versions/A/Resources \ |
| 217 |
|
| 218 |
# etc/my.cnf |
| 219 |
# etc/my.cnf.default |
| 220 |
# etc/my.cnf.d |
| 221 |
# etc/xdg \ |
| 222 |
# etc/mariadb$MARIADB_SUFFIX \ |
| 223 |
|
| 224 |
#etc/sane.d \ |
| 225 |
|
| 226 |
# Additional Data Directories - to be copied recursively |
| 227 |
OTHER_DATA="\ |
| 228 |
share/opencv4 \ |
| 229 |
share/k* \ |
| 230 |
share/mime \ |
| 231 |
Library/Application/ \ |
| 232 |
share/applications \ |
| 233 |
share/lensfun \ |
| 234 |
share/QtCurve \ |
| 235 |
" |
| 236 |
#share/locale \ |
| 237 |
|
| 238 |
# Packaging tool paths |
| 239 |
PACKAGESBUILD="/usr/local/bin/packagesbuild" |
| 240 |
|
| 241 |
echo "digiKam version: $DKRELEASEID" |
| 242 |
|
| 243 |
# ./installer sub-dir must be writable by root |
| 244 |
chmod 777 ${PROJECTDIR} |
| 245 |
|
| 246 |
################################################################################################# |
| 247 |
# Check if Packages CLI tools are installed |
| 248 |
|
| 249 |
if [[ (! -f "$PACKAGESBUILD") ]] ; then |
| 250 |
echo "Packages CLI tool is not installed" |
| 251 |
echo "See http://s.sudre.free.fr/Software/Packages/about.html for details." |
| 252 |
exit 1 |
| 253 |
else |
| 254 |
echo "Check Packages CLI tool passed..." |
| 255 |
fi |
| 256 |
|
| 257 |
################################################################################################# |
| 258 |
# clean up old cache files |
| 259 |
if [ -f "$ORIG_WD/found_dylibs_cache.pkl" ] ; then |
| 260 |
rm "$ORIG_WD/found_dylibs_cache.pkl" |
| 261 |
fi |
| 262 |
|
| 263 |
if [ -f "$ORIG_WD/processed_dylibs_cache.pkl" ] ; then |
| 264 |
rm "$ORIG_WD/processed_dylibs_cache.pkl" |
| 265 |
fi |
| 266 |
if [ -f "$ORIG_WD/signed_dylibs_cache.pkl" ] ; then |
| 267 |
rm "$ORIG_WD/signed_dylibs_cache.pkl" |
| 268 |
fi |
| 269 |
|
| 270 |
################################################################################################# |
| 271 |
# Create temporary dir to build package contents |
| 272 |
|
| 273 |
if [ -d "$TEMPROOT" ] ; then |
| 274 |
echo "---------- Removing temporary packaging directory $TEMPROOT" |
| 275 |
rm -rf "$TEMPROOT" |
| 276 |
fi |
| 277 |
|
| 278 |
echo "Creating $TEMPROOT" |
| 279 |
mkdir -p "$TEMPROOT" |
| 280 |
|
| 281 |
################################################################################################# |
| 282 |
# Prepare applications for MacOS |
| 283 |
|
| 284 |
echo "---------- Preparing Applications for MacOS" |
| 285 |
|
| 286 |
for app in $KDE_MENU_APPS ; do |
| 287 |
echo " $app" |
| 288 |
|
| 289 |
# Look for application |
| 290 |
|
| 291 |
for searchpath in $KDE_APP_PATHS ; do |
| 292 |
|
| 293 |
# Copy the application if it is found (create directory if necessary) |
| 294 |
|
| 295 |
if [ -d "$INSTALL_PREFIX/$searchpath/$app.app" ] ; then |
| 296 |
|
| 297 |
echo " Found $app in $INSTALL_PREFIX/$searchpath" |
| 298 |
|
| 299 |
# Copy application directory |
| 300 |
|
| 301 |
echo " Copying $app" |
| 302 |
cp -pr "$INSTALL_PREFIX/$searchpath/$app.app" "$TEMPROOT" |
| 303 |
|
| 304 |
# Add executable to list of binaries for which we need to collect dependencies for |
| 305 |
|
| 306 |
binaries="$binaries $searchpath/$app.app/Contents/MacOS/$app" |
| 307 |
|
| 308 |
chmod 755 "$TEMPROOT/$app.app" |
| 309 |
|
| 310 |
fi |
| 311 |
|
| 312 |
done |
| 313 |
|
| 314 |
done |
| 315 |
|
| 316 |
################################################################################################# |
| 317 |
# Copy Qt Frameworks to the staging area (creating directories as required) |
| 318 |
|
| 319 |
echo "---------- Copying Qt frameworks..." |
| 320 |
|
| 321 |
rm -rf $INSTALL_PREFIX/Cellar/qt/.DS_Store || true |
| 322 |
mkdir $TEMPROOT/Frameworks |
| 323 |
QT_FULL_VERSION=`ls "$INSTALL_PREFIX/Cellar/qt/"` |
| 324 |
|
| 325 |
for framework in $QT_FRAMEWORKS ; do |
| 326 |
|
| 327 |
echo "Copying Qt framework: $framework" |
| 328 |
|
| 329 |
# Copy framework |
| 330 |
cp -R "$INSTALL_PREFIX/Cellar/qt/$QT_FULL_VERSION/Frameworks/$framework.framework" "$TEMPROOT/Frameworks" |
| 331 |
cp -R "$INSTALL_PREFIX/Cellar/qt/$QT_FULL_VERSION/lib/$framework.framework" "$TEMPROOT/lib" |
| 332 |
|
| 333 |
done |
| 334 |
|
| 335 |
################################################################################################# |
| 336 |
# Collect dylib dependencies for all binaries, |
| 337 |
# then copy them to the staging area (creating directories as required) |
| 338 |
|
| 339 |
echo "---------- Collecting dependencies for applications, binaries, and libraries..." |
| 340 |
|
| 341 |
cd "$INSTALL_PREFIX" |
| 342 |
|
| 343 |
binary_paths=$(ls $binaries | sort -u) |
| 344 |
|
| 345 |
for bin in $binary_paths ; do |
| 346 |
|
| 347 |
echo "Scan dependencies for $bin" |
| 348 |
|
| 349 |
# Copy original with parsing |
| 350 |
|
| 351 |
lib="${bin/$INSTALL_PREFIX\//}" |
| 352 |
|
| 353 |
if [ ! -e "$TEMPROOT/$lib" ] ; then |
| 354 |
dir="${lib%/*}" |
| 355 |
|
| 356 |
if [ ! -d "$TEMPROOT/$dir" ] ; then |
| 357 |
echo " Creating $TEMPROOT/$dir" |
| 358 |
mkdir -p "$TEMPROOT/$dir" |
| 359 |
fi |
| 360 |
|
| 361 |
echo " Copying $INSTALL_PREFIX/$lib to $TEMPROOT/$dir/" |
| 362 |
cp -aH "$INSTALL_PREFIX/$lib" "$TEMPROOT/$dir/" |
| 363 |
fi |
| 364 |
done |
| 365 |
|
| 366 |
################################################################################################# |
| 367 |
# Copy non-binary files and directories, creating parent directories if needed |
| 368 |
|
| 369 |
echo "---------- Copying binary files..." |
| 370 |
|
| 371 |
for path in $OTHER_APPS ; do |
| 372 |
dir="${path%/*}" |
| 373 |
|
| 374 |
if [ ! -d "$TEMPROOT/$dir" ] ; then |
| 375 |
echo " Creating $TEMPROOT/$dir" |
| 376 |
mkdir -p "$TEMPROOT/$dir" |
| 377 |
fi |
| 378 |
|
| 379 |
echo " Copying $INSTALL_PREFIX/$path to $TEMPROOT/$dir/" |
| 380 |
cp -aH "$INSTALL_PREFIX/$path" "$TEMPROOT/$dir/" |
| 381 |
done |
| 382 |
|
| 383 |
echo "---------- Copying directory contents..." |
| 384 |
|
| 385 |
for path in $OTHER_DIRS ; do |
| 386 |
dir="${path%/*}" |
| 387 |
|
| 388 |
if [ ! -d "$TEMPROOT/$dir" ] ; then |
| 389 |
echo " Creating $TEMPROOT/$dir" |
| 390 |
mkdir -p "$TEMPROOT/$dir" |
| 391 |
fi |
| 392 |
|
| 393 |
echo " Copying $INSTALL_PREFIX/$path to $TEMPROOT/$dir/" |
| 394 |
cp -aHL "$INSTALL_PREFIX/$path" "$TEMPROOT/$dir/" |
| 395 |
done |
| 396 |
|
| 397 |
# See bug #476290 |
| 398 |
#rm -fr $TEMPROOT/libexec/qt$DK_QTVERSION/plugins/imageformats/libqjp2.dylib |
| 399 |
|
| 400 |
echo "---------- Copying data files..." |
| 401 |
|
| 402 |
# Special case with data dirs. QStandardPaths::GenericDataLocation was patched everywhere |
| 403 |
# in source code by QStandardPaths::AppDataLocation |
| 404 |
|
| 405 |
for path in $OTHER_DATA ; do |
| 406 |
echo " Copying $path" |
| 407 |
cp -aL "$INSTALL_PREFIX/$path" "$TEMPROOT/$DK_APP_CONTENTS/Resources/" |
| 408 |
done |
| 409 |
|
| 410 |
# Copy digiKam hi-colors PNG icons-set to the bundle |
| 411 |
|
| 412 |
mkdir -p "$TEMPROOT/digikam.app/Contents/Resources/icons/" |
| 413 |
cp -a "$INSTALL_PREFIX/share/icons/hicolor" "$TEMPROOT/$DK_APP_CONTENTS/Resources/icons/" |
| 414 |
|
| 415 |
echo "---------- Copying i18n..." |
| 416 |
|
| 417 |
i18nprefix=$INSTALL_PREFIX/share/ |
| 418 |
cd $i18nprefix |
| 419 |
|
| 420 |
FILES=$(cat $ORIG_WD/logs/build-extralibs.full.log | grep "$INSTALL_PREFIX/share/locale/" | cut -d' ' -f3 | awk '{sub("'"$i18nprefix"'","")}1') |
| 421 |
|
| 422 |
for FILE in $FILES ; do |
| 423 |
rsync -R "./$FILE" "$TEMPROOT/$DK_APP_CONTENTS/Resources/" |
| 424 |
done |
| 425 |
|
| 426 |
FILES=$(cat $ORIG_WD/logs/build-digikam.full.log | grep "$INSTALL_PREFIX/share/locale/" | cut -d' ' -f3 | awk '{sub("'"$i18nprefix"'","")}1') |
| 427 |
|
| 428 |
for FILE in $FILES ; do |
| 429 |
rsync -R "./$FILE" "$TEMPROOT/$DK_APP_CONTENTS/Resources/" |
| 430 |
done |
| 431 |
|
| 432 |
# Move Qt translation data files at the right place in the bundle. See Bug #438701. |
| 433 |
|
| 434 |
mv -v $TEMPROOT/share/qt/translations $TEMPROOT/$DK_APP_CONTENTS/Resources/ |
| 435 |
|
| 436 |
# To support localized system menu entries from MacOS. See bug #432650. |
| 437 |
|
| 438 |
FILES=$(find "$TEMPROOT/$DK_APP_CONTENTS/Resources/locale" -type d -depth 1) |
| 439 |
|
| 440 |
for FILE in $FILES ; do |
| 441 |
BASE=$(basename $FILE) |
| 442 |
echo "Create localized system menu entry for $BASE" |
| 443 |
mkdir "$TEMPROOT/$DK_APP_CONTENTS/Resources/$BASE.lproj" |
| 444 |
done |
| 445 |
|
| 446 |
# Showfoto resources dir must be merged with digiKam. |
| 447 |
|
| 448 |
cp -a "$TEMPROOT/showfoto.app/Contents/Resources/" "$TEMPROOT/$DK_APP_CONTENTS/Resources/" |
| 449 |
rm -rf "$TEMPROOT/showfoto.app/Contents/Resources" |
| 450 |
|
| 451 |
cd "$ORIG_WD" |
| 452 |
|
| 453 |
################################################################################################# |
| 454 |
# Move digiKam and KF6 run-time plugins to the right place |
| 455 |
|
| 456 |
echo "---------- Move digiKam and KF6 run-time plugins\n" |
| 457 |
|
| 458 |
rm -fr $TEMPROOT/bin/digikam.app |
| 459 |
rm -fr $TEMPROOT/bin/showfoto.app |
| 460 |
|
| 461 |
# cp -a $TEMPROOT/lib/plugins/ $TEMPROOT/share/qt/plugins |
| 462 |
# rm -rf $TEMPROOT/lib/plugins/ |
| 463 |
|
| 464 |
################################################################################################# |
| 465 |
# Copy MariaDB |
| 466 |
|
| 467 |
echo "---------- Copying MariaDB to bundle\n" |
| 468 |
|
| 469 |
rm -rf $INSTALL_PREFIX/Cellar/mariadb/.DS_Store || true |
| 470 |
MARIADB_VERSION=`ls "$INSTALL_PREFIX/Cellar/mariadb"` |
| 471 |
|
| 472 |
echo "MariaDB Version is: - $MARIADB_VERSION -" |
| 473 |
|
| 474 |
mkdir $TEMPROOT/lib/mariadb |
| 475 |
|
| 476 |
rsync -av --exclude="include/*" --exclude="lib/plugin/ha_*" --exclude="support-files/*" --exclude="share/man/*" $INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/ $TEMPROOT/lib/mariadb |
| 477 |
|
| 478 |
|
| 479 |
################################################################################################# |
| 480 |
# Merge Manifest files |
| 481 |
|
| 482 |
echo "---------- Copy Git Revisions Manifest\n" |
| 483 |
|
| 484 |
touch $TEMPROOT/digikam.app/Contents/Resources/MANIFEST.txt |
| 485 |
|
| 486 |
FILES=$(ls $ORIG_WD/data/*_manifest.txt) |
| 487 |
|
| 488 |
for FILE in $FILES ; do |
| 489 |
echo $FILE |
| 490 |
cat $FILE >> $TEMPROOT/digikam.app/Contents/Resources/MANIFEST.txt |
| 491 |
done |
| 492 |
|
| 493 |
################################################################################################# |
| 494 |
# Create package pre-install script |
| 495 |
|
| 496 |
echo "---------- Create package pre-install script" |
| 497 |
|
| 498 |
# Delete /Applications entries, delete existing installation |
| 499 |
|
| 500 |
cat << EOF > "$PROJECTDIR/preinstall" |
| 501 |
#!/bin/bash |
| 502 |
|
| 503 |
if [ -d /Applications/digiKam ] ; then |
| 504 |
echo "Removing digiKam directory from Applications folder" |
| 505 |
rm -r /Applications/digiKam |
| 506 |
fi |
| 507 |
|
| 508 |
if [ -d /Applications/digikam.app ] ; then |
| 509 |
echo "Removing legacy digikam.app from Applications folder" |
| 510 |
rm -r /Applications/digikam.app |
| 511 |
fi |
| 512 |
|
| 513 |
if [ -d /Applications/showfoto.app ] ; then |
| 514 |
echo "Removing legacy showfoto.app from Applications folder" |
| 515 |
rm -r /Applications/showfoto.app |
| 516 |
fi |
| 517 |
|
| 518 |
if [ -d "/opt/digikam" ] ; then |
| 519 |
echo "Removing legacy /opt/digikam" |
| 520 |
rm -rf "/opt/digikam" |
| 521 |
fi |
| 522 |
EOF |
| 523 |
|
| 524 |
# Pre-install script need to be executable |
| 525 |
|
| 526 |
chmod 755 "$PROJECTDIR/preinstall" |
| 527 |
|
| 528 |
################################################################################################# |
| 529 |
# Create package post-install script |
| 530 |
|
| 531 |
echo "---------- Create package post-install script" |
| 532 |
|
| 533 |
# Creates Applications menu icons |
| 534 |
|
| 535 |
cat << EOF > "$PROJECTDIR/postinstall" |
| 536 |
#!/bin/bash |
| 537 |
|
| 538 |
# NOTE: Disabled with relocate bundle |
| 539 |
#for app in $INSTALL_PREFIX/Applications/digiKam/*.app ; do |
| 540 |
# ln -s "\$app" /Applications/\${app##*/} |
| 541 |
#done |
| 542 |
EOF |
| 543 |
|
| 544 |
# Post-install script need to be executable |
| 545 |
|
| 546 |
chmod 755 "$PROJECTDIR/postinstall" |
| 547 |
|
| 548 |
################################################################################################# |
| 549 |
# Copy icons-set resource files. |
| 550 |
|
| 551 |
cp $INSTALL_PREFIX/share/icons/breeze/breeze-icons.rcc $TEMPROOT/$DK_APP_CONTENTS/Resources/breeze.rcc |
| 552 |
|
| 553 |
################################################################################################# |
| 554 |
# Cleanup symbols in binary files to free space. |
| 555 |
|
| 556 |
echo -e "\n---------- Strip symbols in binary files\n" |
| 557 |
|
| 558 |
if [[ $DK_DEBUG = 1 ]] ; then |
| 559 |
|
| 560 |
find $TEMPROOT -name "*.so" | grep -Ev '(digikam|showfoto)' | xargs strip -SXx |
| 561 |
find $TEMPROOT -name "*.dylib" | grep -Ev '(digikam|showfoto)' | xargs strip -SXx |
| 562 |
|
| 563 |
else |
| 564 |
|
| 565 |
# no debug symbols at all. |
| 566 |
|
| 567 |
find $TEMPROOT -perm +111 -type f | xargs strip -SXx 2>/dev/null |
| 568 |
|
| 569 |
# Under MacOS, all debug symbols are stored to separated dSYM sub directories near binary files. |
| 570 |
|
| 571 |
DSYMDIRS=`find $TEMPROOT -type d -name "*.dSYM"` |
| 572 |
|
| 573 |
for dsym in $DSYMDIRS ; do |
| 574 |
|
| 575 |
rm -fr $dsym |
| 576 |
echo "Remove debug symbols from $dsym" |
| 577 |
|
| 578 |
done |
| 579 |
|
| 580 |
fi |
| 581 |
|
| 582 |
if [[ $DK_DEBUG = 1 ]] ; then |
| 583 |
|
| 584 |
DEBUG_SUF="-debug" |
| 585 |
|
| 586 |
fi |
| 587 |
|
| 588 |
################################################################################################# |
| 589 |
# Move directories and fix misc files |
| 590 |
|
| 591 |
echo -e "\n---------- Move and fix files" |
| 592 |
|
| 593 |
# Clean up OpenSSL duplicates |
| 594 |
rm $TEMPROOT/opt/openssl@3/lib/libcrypto.dylib |
| 595 |
rm $TEMPROOT/opt/openssl@3/lib/libssl.dylib |
| 596 |
# fix ssl links |
| 597 |
ln -s "../opt/openssl@3/lib/libcrypto.3.dylib" "$TEMPROOT/lib/crypto" |
| 598 |
ln -s "../opt/openssl@3/lib/libssl.3.dylib" "$TEMPROOT/lib/ssl" |
| 599 |
|
| 600 |
mv -v $TEMPROOT/bin $TEMPROOT/digikam.app/Contents/ |
| 601 |
mv -v $TEMPROOT/share $TEMPROOT/digikam.app/Contents/ |
| 602 |
mv -v $TEMPROOT/etc $TEMPROOT/digikam.app/Contents/ |
| 603 |
mv -v $TEMPROOT/lib $TEMPROOT/digikam.app/Contents/ |
| 604 |
#mv -v $TEMPROOT/libexec $TEMPROOT/digikam.app/Contents/ |
| 605 |
mv -v $TEMPROOT/opt $TEMPROOT/digikam.app/Contents/ |
| 606 |
mv -v $TEMPROOT/Frameworks $TEMPROOT/digikam.app/Contents/ |
| 607 |
if [ ! -d $TEMPROOT/Cellar ] ; then |
| 608 |
mkdir $TEMPROOT/Cellar |
| 609 |
fi |
| 610 |
mv -v $TEMPROOT/Cellar $TEMPROOT/digikam.app/Contents/ |
| 611 |
|
| 612 |
ln -sv "../../digikam.app/Contents/bin" "$TEMPROOT/showfoto.app/Contents/bin" |
| 613 |
ln -sv "../../digikam.app/Contents/etc" "$TEMPROOT/showfoto.app/Contents/etc" |
| 614 |
ln -sv "../../digikam.app/Contents/lib" "$TEMPROOT/showfoto.app/Contents/lib" |
| 615 |
#ln -sv "../../digikam.app/Contents/libexec" "$TEMPROOT/showfoto.app/Contents/libexec" |
| 616 |
ln -sv "../../digikam.app/Contents/share" "$TEMPROOT/showfoto.app/Contents/share" |
| 617 |
ln -sv "../../digikam.app/Contents/Resources" "$TEMPROOT/showfoto.app/Contents/Resources" |
| 618 |
ln -sv "../../digikam.app/Contents/opt" "$TEMPROOT/showfoto.app/Contents/opt" |
| 619 |
ln -sv "../../digikam.app/Contents/Frameworks" "$TEMPROOT/showfoto.app/Contents/Frameworks" |
| 620 |
ln -sv "../../digikam.app/Contents/Cellar" "$TEMPROOT/showfoto.app/Contents/Cellar" |
| 621 |
ln -sv "../../digikam.app/Contents/plugins" "$TEMPROOT/showfoto.app/Contents/plugins" |
| 622 |
|
| 623 |
ln -sv "../lib" $TEMPROOT/digikam.app/Contents/opt/lib |
| 624 |
|
| 625 |
rm -r "$TEMPROOT/Applications" |
| 626 |
|
| 627 |
################################################################################################# |
| 628 |
# Relocatable binary files. For details, see these urls: |
| 629 |
# |
| 630 |
# https://stackoverflow.com/questions/9263256/can-you-please-help-me-understand-how-mach-o-libraries-work-in-mac-os-x |
| 631 |
# https://matthew-brett.github.io/docosx/mac_runtime_link.html |
| 632 |
# https://thecourtsofchaos.com/2013/09/16/how-to-copy-and-relink-binaries-on-osx/ |
| 633 |
|
| 634 |
echo -e "\n---------- Relocatable binary files" |
| 635 |
|
| 636 |
# Relocatable dynamic libraries with rpath |
| 637 |
|
| 638 |
echo -e "\n--- Relocatable dynamic library files" |
| 639 |
|
| 640 |
DYLIBFILES=(`find $TEMPROOT -name "*.dylib"`) |
| 641 |
|
| 642 |
RelocatableBinaries DYLIBFILES[@] |
| 643 |
|
| 644 |
# Relocatable system objects with rpath |
| 645 |
|
| 646 |
echo -e "\n--- Relocatable system object files" |
| 647 |
|
| 648 |
SOFILES=(`find $TEMPROOT -name "*.so"`) |
| 649 |
|
| 650 |
RelocatableBinaries SOFILES[@] |
| 651 |
|
| 652 |
# Relocatable executables with rpath and patch relative search path. |
| 653 |
|
| 654 |
echo -e "\n--- Relocatable executable files" |
| 655 |
|
| 656 |
EXECFILES=(`find $TEMPROOT -type f -perm +ugo+x ! -name "*.dylib" ! -name "*.so"`) |
| 657 |
#EXECFILES=(`find $TEMPROOT -type f ! -name "*.dylib" ! -name "*.so" -print0 | xargs -0 -n 10 file | grep "Mach-O" | cut -d ':' -f 1`) |
| 658 |
|
| 659 |
RelocatableBinaries EXECFILES[@] |
| 660 |
|
| 661 |
# echo -e "\n--- Patch RPATH in executable files" |
| 662 |
|
| 663 |
# for APP in ${EXECFILES[@]} ; do |
| 664 |
|
| 665 |
# ISBINARY=`file "$APP" | grep "Mach-O" || true` |
| 666 |
|
| 667 |
# # Do not touch debug extension |
| 668 |
# ISDSYM=`file "$APP" | grep "dSYM" || true` |
| 669 |
|
| 670 |
# # Do not patch applet files which are pure Apple API binaries |
| 671 |
# BASENAME=`basename "$APP"` |
| 672 |
|
| 673 |
# if [[ $ISBINARY ]] && [[ ! $ISDSYM ]] && [[ $BASENAME != "applet" ]] ; then |
| 674 |
|
| 675 |
# install_name_tool -add_rpath @executable_path/.. $APP |
| 676 |
# install_name_tool -add_rpath @executable_path/../.. $APP |
| 677 |
# # install_name_tool -add_rpath @executable_path/../../.. $APP |
| 678 |
# # install_name_tool -add_rpath @executable_path/../../../.. $APP |
| 679 |
# # install_name_tool -add_rpath @executable_path/../../../../.. $APP |
| 680 |
# # install_name_tool -add_rpath @executable_path/../../../../../.. $APP |
| 681 |
# # install_name_tool -add_rpath @executable_path/../../../../../../.. $APP |
| 682 |
# # install_name_tool -add_rpath @executable_path/../../../../../../../.. $APP |
| 683 |
# # install_name_tool -add_rpath @executable_path/../../../../../../../../.. $APP |
| 684 |
# # install_name_tool -add_rpath @executable_path/../../../../../../../../../.. $APP |
| 685 |
# codesign --force -s - $APP |
| 686 |
|
| 687 |
# echo "Patch $APP" |
| 688 |
|
| 689 |
# fi |
| 690 |
|
| 691 |
# done |
| 692 |
|
| 693 |
# ################################################################################################# |
| 694 |
# # fix ImageMagick config |
| 695 |
# sed -i '' "s|$INSTALL_PREFIX|..|g" $TEMPROOT/$DK_APP_CONTENTS/lib/ImageMagick/config-Q16HDRI/configure.xml |
| 696 |
|
| 697 |
################################################################################################# |
| 698 |
# fix the Qt directories and copy the qt.conf file |
| 699 |
|
| 700 |
echo -e "\n---------- Adjusting Qt" |
| 701 |
|
| 702 |
# Copy qt.conf |
| 703 |
cp "$ORIG_WD/data/qt.conf" "$TEMPROOT/$DK_APP_CONTENTS/Resources/qt.conf" |
| 704 |
#QT_FULL_VERSION=`ls "$TEMPROOT/$DK_APP_CONTENTS/Cellar/qt"` |
| 705 |
|
| 706 |
# symlink Qt dirs |
| 707 |
ln -s "./Resources/QtCurve" "$TEMPROOT/$DK_APP_CONTENTS/share/QtCurve" |
| 708 |
#ln -s "../Cellar/qt/$QT_FULL_VERSION/lib/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess" "$TEMPROOT/$DK_APP_CONTENTS/MacOS/QtWebEngineProcess" |
| 709 |
ln -s "./share/qt/plugins" "$TEMPROOT/$DK_APP_CONTENTS/plugins" |
| 710 |
#ln -s "../../Cellar/qt/$QT_FULL_VERSION/lib/QtWebEngineCore.framework/Versions/A/Resources/qtwebengine_locales" "$TEMPROOT/$DK_APP_CONTENTS/Resources/translations/qtwebengine_locales" |
| 711 |
|
| 712 |
# add additional rpaths and re-sign QtWebEngineProcess |
| 713 |
WEP=`find $TEMPROOT/$DK_APP_CONTENTS -name "QtWebEngineProcess"` |
| 714 |
install_name_tool -add_rpath @loader_path/../../../../../../../../ $WEP |
| 715 |
codesign --force -s - $WEP |
| 716 |
|
| 717 |
# move the QtWebEngine resources |
| 718 |
echo -e "\n ----- Moving QtWebEngine Resources" |
| 719 |
|
| 720 |
#WEBENGINE_RESOURCES=`find "$TEMPROOT/$DK_APP_CONTENTS/Cellar/qt/$QT_FULL_VERSION/lib/QtWebEngineCore.framework/Versions/A/Resources" -name "*.*" -maxdepth 1 ! -name '*.plist'` |
| 721 |
# WEBENGINE_RESOURCES=`find "$TEMPROOT/$DK_APP_CONTENTS/Frameworks/QtWebEngineCore.framework/Versions/A/Resources" -name "*.*" -maxdepth 1 ! -name '*.plist'` |
| 722 |
|
| 723 |
# for WER in $WEBENGINE_RESOURCES ; do |
| 724 |
|
| 725 |
# echo "Moving WER: $WER" |
| 726 |
# mv "$WER" "$TEMPROOT/$DK_APP_CONTENTS/Resources" |
| 727 |
|
| 728 |
# done |
| 729 |
|
| 730 |
################################################################################################# |
| 731 |
# configure MySQL/MariaDB |
| 732 |
|
| 733 |
echo -e "\n ----- Rebasing MariaDB" |
| 734 |
|
| 735 |
# clean up old cache files |
| 736 |
if [ -f "$ORIG_WD/found_dylibs_cache.pkl" ] ; then |
| 737 |
rm "$ORIG_WD/found_dylibs_cache.pkl" |
| 738 |
fi |
| 739 |
|
| 740 |
if [ -f "$ORIG_WD/processed_dylibs_cache.pkl" ] ; then |
| 741 |
rm "$ORIG_WD/processed_dylibs_cache.pkl" |
| 742 |
fi |
| 743 |
if [ -f "$ORIG_WD/signed_dylibs_cache.pkl" ] ; then |
| 744 |
rm "$ORIG_WD/signed_dylibs_cache.pkl" |
| 745 |
fi |
| 746 |
|
| 747 |
# move MariaDB and patch up links to libs |
| 748 |
cp $INSTALL_PREFIX/Library/Application/digikam/database/mysql-global.conf "$TEMPROOT/$DK_APP_CONTENTS/Resources/digikam/database/mysql-global.conf" |
| 749 |
mkdir $TEMPROOT/$DK_APP_CONTENTS/lib/mariadb/opt |
| 750 |
# link missing libs instead of copying them |
| 751 |
ln -s "../../../opt/openssl@3" "$TEMPROOT/$DK_APP_CONTENTS/lib/mariadb/opt/openssl@3" |
| 752 |
ln -s "../../../opt/pcre2" "$TEMPROOT/$DK_APP_CONTENTS/lib/mariadb/opt/pcre2" |
| 753 |
ln -s "../../../opt/lz4" "$TEMPROOT/$DK_APP_CONTENTS/lib/mariadb/opt/lz4" |
| 754 |
ln -s "../../../opt/snappy" "$TEMPROOT/$DK_APP_CONTENTS/lib/mariadb/opt/snappy" |
| 755 |
ln -s "../../../opt/zstd" "$TEMPROOT/$DK_APP_CONTENTS/lib/mariadb/opt/zstd" |
| 756 |
|
| 757 |
# rebase the MariaDB binaries to the MariaDB dir |
| 758 |
# find the binaries |
| 759 |
MARIADB_BINARIES=`find $TEMPROOT/$DK_APP_CONTENTS/lib/mariadb/bin -type f -perm +111` |
| 760 |
|
| 761 |
for FILE in $MARIADB_BINARIES ; do |
| 762 |
|
| 763 |
copy_lib="$INSTALL_PREFIX/bin/python3 $ORIG_WD/package_lib.py --file=$FILE --bundle-root=$TEMPROOT/$DK_APP_CONTENTS/lib/mariadb --homebrew=$INSTALL_PREFIX --processed-cache=update --found-cache=update --signed-cache=update --update-binary=1 --copy=0 --preserve_rpath=0" |
| 764 |
eval "$copy_lib" |
| 765 |
|
| 766 |
done |
| 767 |
|
| 768 |
echo -e "\n---------- Patch config and script files in MariaDB" |
| 769 |
|
| 770 |
MARIADBFILES=`find $TEMPROOT/$DK_APP_CONTENTS/lib/mariadb -type f ! -name "*.dylib" ! -name "*.so"` |
| 771 |
|
| 772 |
for FILE in $MARIADBFILES ; do |
| 773 |
|
| 774 |
# to handle only text files |
| 775 |
ISTEXT=`file "$FILE" | grep -e "ASCII text" || true` |
| 776 |
|
| 777 |
if [[ $ISTEXT ]] ; then |
| 778 |
|
| 779 |
NEEDPATCH=`grep "$INSTALL_PREFIX" "$FILE" || true` |
| 780 |
|
| 781 |
if [[ $NEEDPATCH ]] ; then |
| 782 |
|
| 783 |
echo -e "--- Patching MariaDB text file: $FILE" |
| 784 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/bin|\$DK_MARIADB_DIR/bin|g" $FILE |
| 785 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/var|\$DK_MARIADB_DIR/var|g" $FILE |
| 786 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/lib|\$DK_MARIADB_DIR/lib|g" $FILE |
| 787 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/libexec|\$DK_MARIADB_DIR/libexec|g" $FILE |
| 788 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/share|\$DK_MARIADB_DIR/share|g" $FILE |
| 789 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/etc|\$DK_MARIADB_DIR/etc|g" $FILE |
| 790 |
sed -i '' "s|$INSTALL_PREFIX|\$DK_MARIADB_DIR|g" $FILE |
| 791 |
|
| 792 |
fi |
| 793 |
|
| 794 |
fi |
| 795 |
|
| 796 |
# to handle only Perl files |
| 797 |
ISPERLTEXT=`file "$FILE" | grep -e "Perl script text" || true` |
| 798 |
|
| 799 |
if [[ $ISPERLTEXT ]] ; then |
| 800 |
|
| 801 |
NEEDPATCH=`grep "$INSTALL_PREFIX" "$FILE" || true` |
| 802 |
|
| 803 |
if [[ $NEEDPATCH ]] ; then |
| 804 |
|
| 805 |
echo -e "--- Patching mariaDB Perl file: $FILE" |
| 806 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/bin|\$ENV{DK_MARIADB_DIR}/bin|g" $FILE |
| 807 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/var|\$ENV{DK_MARIADB_DIR}/var|g" $FILE |
| 808 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/lib|\$ENV{DK_MARIADB_DIR}/lib|g" $FILE |
| 809 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/libexec|\$ENV{DK_MARIADB_DIR}/libexec|g" $FILE |
| 810 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/share|\$ENV{DK_MARIADB_DIR}/share|g" $FILE |
| 811 |
sed -i '' "s|$INSTALL_PREFIX/Cellar/mariadb/$MARIADB_VERSION/etc|\$ENV{DK_MARIADB_DIR}/etc|g" $FILE |
| 812 |
sed -i '' "s|$INSTALL_PREFIX|\$ENV{DK_MARIADB_DIR}|g" $FILE |
| 813 |
|
| 814 |
fi |
| 815 |
|
| 816 |
fi |
| 817 |
|
| 818 |
done |
| 819 |
|
| 820 |
################################################################################################# |
| 821 |
# Install ExifTool binary. |
| 822 |
|
| 823 |
echo -e "\n---------- Install ExifTool" |
| 824 |
|
| 825 |
cd $DOWNLOAD_DIR |
| 826 |
|
| 827 |
#if [ ! -f "$DOWNLOAD_DIR/Image-ExifTool.tar.gz" ] ; then |
| 828 |
wget https://files.kde.org/digikam/exiftool/Image-ExifTool.tar.gz -O Image-ExifTool.tar.gz |
| 829 |
#fi |
| 830 |
|
| 831 |
tar -xvf "$DOWNLOAD_DIR/Image-ExifTool.tar.gz" -C "$TEMPROOT/digikam.app/Contents/bin" |
| 832 |
cd $TEMPROOT/digikam.app/Contents/bin |
| 833 |
EXIFTOOL_DIR=$(ls -d Image-ExifTool*) |
| 834 |
ln -sv "./$EXIFTOOL_DIR" "./Image-ExifTool" |
| 835 |
ln -sv "./Image-ExifTool/exiftool" "exiftool" |
| 836 |
|
| 837 |
################################################################################################# |
| 838 |
# Cleanup files in bundle |
| 839 |
|
| 840 |
echo -e "\n---------- Cleanup files in bundle" |
| 841 |
|
| 842 |
# Last cleanup |
| 843 |
|
| 844 |
HEADERFILES=(`find $TEMPROOT -name "*.h" -o -name "*.hpp"`) |
| 845 |
|
| 846 |
for HPP in ${HEADERFILES[@]} ; do |
| 847 |
|
| 848 |
rm -fv $HPP |
| 849 |
|
| 850 |
done |
| 851 |
|
| 852 |
################################################################################################# |
| 853 |
# Build PKG file |
| 854 |
|
| 855 |
echo "---------- Create MacOS package for digiKam $DKRELEASEID" |
| 856 |
|
| 857 |
mkdir -p $ORIG_WD/bundle |
| 858 |
rm -f $ORIG_WD/bundle/*$DEBUG_SUF* || true |
| 859 |
|
| 860 |
if [[ $DK_VERSION != v* ]] ; then |
| 861 |
|
| 862 |
# with non-official release version, use build time-stamp as sub-version string. |
| 863 |
DK_SUBVER="-`cat $ORIG_WD/data/BUILDDATE.txt`" |
| 864 |
|
| 865 |
else |
| 866 |
|
| 867 |
# with official release version, disable upload to KDE server, as this break check for new version function. |
| 868 |
echo -e "Official release version detected, upload is disabled.\n" |
| 869 |
DK_UPLOAD=0 |
| 870 |
|
| 871 |
fi |
| 872 |
|
| 873 |
if [[ $DK_QTVERSION == 5 ]] ; then |
| 874 |
|
| 875 |
QT_SUF="-Qt5" |
| 876 |
|
| 877 |
else |
| 878 |
|
| 879 |
QT_SUF="-Qt6" |
| 880 |
|
| 881 |
fi |
| 882 |
|
| 883 |
TARGET_INSTALLER=digiKam-$DKRELEASEID$DK_SUBVER$QT_SUF-MacOS-$ARCH_TARGET$DEBUG_SUF.pkg |
| 884 |
TARGET_PKG_FILE=$BUILDDIR/bundle/$TARGET_INSTALLER |
| 885 |
echo -e "Target PKG file : $TARGET_PKG_FILE" |
| 886 |
|
| 887 |
chmod 666 $PROJECTDIR/digikam.pkgproj |
| 888 |
|
| 889 |
$PACKAGESBUILD -v "$PROJECTDIR/digikam.pkgproj" --package-version "$DKRELEASEID" |
| 890 |
|
| 891 |
mv "$PROJECTDIR/build/digikam.pkg" "$TARGET_PKG_FILE" |
| 892 |
|
| 893 |
################################################################################################# |
| 894 |
# Show resume information and future instructions to host PKG file to remote server |
| 895 |
|
| 896 |
echo -e "\n---------- Compute package checksums for digiKam $DKRELEASEID\n" > $TARGET_PKG_FILE.sum |
| 897 |
echo "File : $TARGET_PKG_FILE" >> $TARGET_PKG_FILE.sum |
| 898 |
echo -n "Size : " >> $TARGET_PKG_FILE.sum |
| 899 |
du -h "$TARGET_PKG_FILE" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum |
| 900 |
echo -n "SHA256 sum : " >> $TARGET_PKG_FILE.sum |
| 901 |
shasum -a256 "$TARGET_PKG_FILE" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum |
| 902 |
|
| 903 |
# Checksums to post on Phabricator at release time. |
| 904 |
shasum -a256 "$TARGET_PKG_FILE" > $BUILDDIR/bundle/sha256_release.sum |
| 905 |
|
| 906 |
if [[ $DK_SIGN = 1 ]] ; then |
| 907 |
|
| 908 |
cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv "$TARGET_PKG_FILE" |
| 909 |
mv -f $TARGET_PKG_FILE.asc $TARGET_PKG_FILE.sig |
| 910 |
|
| 911 |
echo "File : $TARGET_PKG_FILE.sig" >> $TARGET_PKG_FILE.sum |
| 912 |
echo -n "Size : " >> $TARGET_PKG_FILE.sum |
| 913 |
du -h "$TARGET_PKG_FILE.sig" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum |
| 914 |
echo -n "SHA256 sum : " >> $TARGET_PKG_FILE.sum |
| 915 |
shasum -a256 "$TARGET_PKG_FILE.sig" | { read first rest ; echo $first ; } >> $TARGET_PKG_FILE.sum |
| 916 |
|
| 917 |
# Checksums to post on Phabricator at release time. |
| 918 |
shasum -a256 "$TARGET_PKG_FILE.sig" >> $BUILDDIR/bundle/sha256_release.sum |
| 919 |
|
| 920 |
fi |
| 921 |
|
| 922 |
cat $TARGET_PKG_FILE.sum |
| 923 |
|
| 924 |
if [[ $DK_UPLOAD = 1 ]] ; then |
| 925 |
|
| 926 |
echo -e "---------- Cleanup older bundle Package files from files.kde.org repository \n" |
| 927 |
|
| 928 |
sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm *-MacOS*$DEBUG_SUF.pkg*" |
| 929 |
|
| 930 |
echo -e "---------- Upload new bundle Package files to files.kde.org repository \n" |
| 931 |
|
| 932 |
rsync -r -v --progress -e ssh $BUILDDIR/bundle/$TARGET_INSTALLER $DK_UPLOADURL:$DK_UPLOADDIR |
| 933 |
|
| 934 |
if [[ $DK_SIGN = 1 ]] ; then |
| 935 |
scp $BUILDDIR/bundle/$TARGET_INSTALLER.sig $DK_UPLOADURL:$DK_UPLOADDIR |
| 936 |
fi |
| 937 |
|
| 938 |
# update remote files list |
| 939 |
|
| 940 |
sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "ls digi*" > $ORIG_WD/bundle/ls.txt |
| 941 |
tail -n +2 $ORIG_WD/bundle/ls.txt > $ORIG_WD/bundle/ls.tmp |
| 942 |
cat $ORIG_WD/bundle/ls.tmp | grep -E '(.pkg |.appimage |.exe )' | grep -Ev '(debug)' > $ORIG_WD/bundle/FILES |
| 943 |
rm $ORIG_WD/bundle/ls.tmp |
| 944 |
rm $ORIG_WD/bundle/ls.txt |
| 945 |
sftp -q $DK_UPLOADURL:$DK_UPLOADDIR <<< "rm FILES" |
| 946 |
rsync -r -v --progress -e ssh $BUILDDIR/bundle/FILES $DK_UPLOADURL:$DK_UPLOADDIR |
| 947 |
|
| 948 |
else |
| 949 |
echo -e "\n------------------------------------------------------------------" |
| 950 |
curl https://download.kde.org/README_UPLOAD |
| 951 |
echo -e "------------------------------------------------------------------\n" |
| 952 |
fi |
| 953 |
|
| 954 |
################################################################################################# |
| 955 |
# clean up old cache files |
| 956 |
if [ -f "$ORIG_WD/found_dylibs_cache.pkl" ] ; then |
| 957 |
rm "$ORIG_WD/found_dylibs_cache.pkl" |
| 958 |
fi |
| 959 |
|
| 960 |
if [ -f "$ORIG_WD/processed_dylibs_cache.pkl" ] ; then |
| 961 |
rm "$ORIG_WD/processed_dylibs_cache.pkl" |
| 962 |
fi |
| 963 |
if [ -f "$ORIG_WD/signed_dylibs_cache.pkl" ] ; then |
| 964 |
rm "$ORIG_WD/signed_dylibs_cache.pkl" |
| 965 |
fi |
| 966 |
|
| 967 |
################################################################################################# |
| 968 |
|
| 969 |
TerminateScript |