Debian Codegraph @

project/bundles/homebrew/tools/tests-add-local-to-bundle.sh

raw
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 # SPDX-FileCopyrightText: 2024 by Michael Miller, <michael underscore miller at msn dot com>
10 #
11 # SPDX-License-Identifier: BSD-3-Clause
12 #
13 # This script is used to move binaries from a local build directory (I use temp.digikam) to the bundle
14 # directory for testing. This can be run only after steps 01-04 have been completed.
15 #
16
17 # Ask to run as root
18 (( EUID != 0 )) && exec sudo -- "$0" "$@"
19
20 # Halt and catch errors
21 set -eE
22 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
23 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
24
25 ORIG_WD="`pwd`"
26
27 cd ..
28 . ./config.sh
29 . ./common.sh
30
31 StartScript
32
33 # Directory where this script is located (default - current directory)
34 BUILDDIR="$PWD"
35
36 # Directory where Packages project files are located
37 PROJECTDIR="$BUILDDIR/installer"
38
39 # Staging area where files to be packaged will be copied
40 TEMPROOT="$BUILDDIR/$RELOCATE_PREFIX"
41
42 DK_APP_CONTENTS="digikam.app/Contents"
43
44 # local binary directory
45 LOCAL_BINS="temp.digikam"
46
47 # copy binaries to bundle location
48 cp "$PWD/$LOCAL_BINS/bin/digikam.app/Contents/MacOS/digikam" "$TEMPROOT/$DK_APP_CONTENTS/MacOS"
49 cp "$PWD/$LOCAL_BINS/bin/identityprovider_utest" "$TEMPROOT/$DK_APP_CONTENTS/MacOS"
50 cp "$PWD/$LOCAL_BINS/bin/faceclassifier_utest" "$TEMPROOT/$DK_APP_CONTENTS/MacOS"
51
52 rsync -av --include="*/" --include="libdigikam*.dylib" --exclude="*" "$PWD/$LOCAL_BINS/bin/" "$TEMPROOT/$DK_APP_CONTENTS/lib"
53
54 # copy QtTest library
55 mkdir -p "$TEMPROOT/$DK_APP_CONTENTS/lib/opt/qt/lib"
56 cp -r /opt/hb-digikam.org.arm64/Cellar/qt/6.7.3/lib/QtTest.framework "$TEMPROOT/$DK_APP_CONTENTS/lib/opt/qt/lib/"
57
58 # relocate binaries
59 FILES=`find "$TEMPROOT/$DK_APP_CONTENTS/lib" -name "libdigikam*.dylib"`
60 for FILE in $FILES ; do
61 copy_lib="$INSTALL_PREFIX/bin/python3 $PWD/package_lib.py --file="$FILE" --bundle-root=$TEMPROOT/$DK_APP_CONTENTS --homebrew=$INSTALL_PREFIX --processed-cache=use --found-cache=use --signed-cache=use --update-binary=1 --copy=0 --preserve_rpath=0 --force=1"
62 eval "$copy_lib"
63 done
64
65 copy_lib="$INSTALL_PREFIX/bin/python3 $PWD/package_lib.py --file="$TEMPROOT/$DK_APP_CONTENTS/MacOS/digikam" --bundle-root=$TEMPROOT/$DK_APP_CONTENTS --homebrew=$INSTALL_PREFIX --processed-cache=use --found-cache=use --signed-cache=use --update-binary=1 --copy=0 --preserve_rpath=0 --force=1"
66 eval "$copy_lib"
67
68 copy_lib="$INSTALL_PREFIX/bin/python3 $PWD/package_lib.py --file="$TEMPROOT/$DK_APP_CONTENTS/MacOS/identityprovider_utest" --bundle-root=$TEMPROOT/$DK_APP_CONTENTS --homebrew=$INSTALL_PREFIX --processed-cache=use --found-cache=use --signed-cache=use --update-binary=1 --copy=0 --preserve_rpath=0 --force=1"
69 eval "$copy_lib"
70
71 copy_lib="$INSTALL_PREFIX/bin/python3 $PWD/package_lib.py --file="$TEMPROOT/$DK_APP_CONTENTS/MacOS/faceclassifier_utest" --bundle-root=$TEMPROOT/$DK_APP_CONTENTS --homebrew=$INSTALL_PREFIX --processed-cache=use --found-cache=use --signed-cache=use --update-binary=1 --copy=0 --preserve_rpath=0 --force=1"
72 eval "$copy_lib"
73
74 cp $PWD/../../../core/data//dnnmodels/dnnmodels.conf $TEMPROOT/$DK_APP_CONTENTS/Resources/digikam/dnnmodels
75 cp $PWD/../../../core/data//dnnmodels/dnnmodels.conf "$HOME/Library/Application Support/digikam/dnnmodels/"
76
77 TerminateScript
78
79 cd "$ORIG_WD"
80
81 date