lok: getSlideShowInfo: interactions: check that properties are available
[LibreOffice.git] / bin / merge-app-bundles
blob34f84274ec5db52e83a73fa8bf099d1117e387d5
1 #!/usr/bin/env bash
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # Exit on errors
10 set -e
12 # Use of unset variable is an error
13 set -u
15 # If any part of a pipeline of commands fails, the whole pipeline fails
16 set -o pipefail
18 if [ `uname` != Darwin ]; then
19 echo This is for macOS only >&2
20 exit 1
23 if [ $# != 3 ]; then
24 echo Usage: $0 app-bundle-1 app-bundle-2 output-app-bundle
25 exit 1
28 if [ -d "$3" ]; then
29 echo The directory $3 exists already
30 exit 1
33 if [ -f "$3" ]; then
34 echo $3 exists and is a file
35 exit 1
38 if [ ! -d "$1" ]; then
39 echo No such directory: $1
40 exit 1
43 if [ ! -d "$2" ]; then
44 echo No such directory: $2
45 exit 1
48 ONE=$(cd "$1" && /bin/pwd)
49 TWO=$(cd "$2" && /bin/pwd)
50 mkdir "$3"
51 OUT=$(cd "$3" && /bin/pwd)
53 # Create all directories
55 cd "$ONE"
56 find . -type d -print
57 ) |
59 cd "$OUT"
60 while read dirname; do
61 mkdir -p "$dirname"
62 done
65 # Check which files in 1 exist in 2, and if they are executable, merge them into a fat copy. For
66 # other files, just use one copy, assuming they are equivalent in most cases.
68 cd "$ONE"
69 find . -type l -or -type f
70 ) |
72 cd "$TWO"
73 while read fname; do
74 if test -L "$fname"; then
75 ln -s $(readlink "$fname") "$OUT/$fname"
76 elif test -f "$fname"; then
77 case "$fname" in
78 *.so | \
79 *.jnilib | \
80 *.jnilib.* | \
81 *.dylib | \
82 *.dylib.* | \
83 */Frameworks/LibreOfficePython.framework/Versions/*/LibreOfficePython | \
84 */Frameworks/LibreOfficePython.framework/Versions/*/Resources/Python.app/Contents/MacOS/LibreOfficePython | \
85 */Library/Spotlight/OOoSpotlightImporter.mdimporter/Contents/MacOS/OOoSpotlightImporter)
86 lipo -create -output "$OUT/$fname" "$fname" "$ONE/$fname"
88 # Ignore differences in these files. Let's hope it's just the timestamps.
89 *.ot[tp] | \
90 *.bau | \
91 *.pyc | \
92 */_sysconfigdata_m_darwin_darwin.py | \
93 */Contents/Resources/firebird/security3.fdb | \
94 */Contents/Resources/autocorr/acor_*.dat | \
95 */Contents/Resources/resource/*/LC_MESSAGES/*.mo | \
96 */Contents/Resources/config/images_*.zip)
97 cp "$fname" "$OUT/$fname"
100 case $(file --brief "$fname") in
101 Mach-O\ 64-bit\ executable\ *)
102 lipo -create -output "$OUT/$fname" "$fname" "$ONE/$fname"
105 cmp -s "$fname" "$ONE/$fname" ||
106 echo "$fname differs and is not an executable!?" >&2
107 cp "$fname" "$OUT/$fname"
108 esac
109 esac
110 else
111 # We ignore some files that can't be built for macOS on arm64 for now
112 case "$fname" in
113 ./Contents/Frameworks/LibreOfficePython.framework/Versions/3.*/lib/python*/lib-dynload/_ctypes.cpython-*m.so)
116 echo "$fname does not exist in $TWO" >&2
118 esac
119 cp "$ONE/$fname" "$OUT/$fname"
121 done
124 # Look for files in 2 that don't exist in 1
126 cd "$TWO"
127 find . -type f -print
130 cd "$ONE"
131 while read fname; do
132 if test -f "$fname"; then
134 else
135 echo "$fname does not exist in $ONE" >&2
136 cp "$TWO/$fname" "$OUT/$fname"
138 done
141 # Local Variables:
142 # tab-width: 4
143 # indent-tabs-mode: nil
144 # fill-column: 100
145 # End: