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/.
12 # Use of unset variable is an error
15 # If any part of a pipeline of commands fails, the whole pipeline fails
18 if [ `uname` != Darwin
]; then
19 echo This is
for macOS only
>&2
24 echo Usage
: $0 app-bundle-1 app-bundle-2 output-app-bundle
29 echo The directory
$3 exists already
34 echo $3 exists and is a
file
38 if [ ! -d "$1" ]; then
39 echo No such directory
: $1
43 if [ ! -d "$2" ]; then
44 echo No such directory
: $2
48 ONE
=$
(cd "$1" && /bin
/pwd)
49 TWO
=$
(cd "$2" && /bin
/pwd)
51 OUT
=$
(cd "$3" && /bin
/pwd)
53 # Create all directories
60 while read dirname; do
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.
69 find .
-type l
-or -type f
74 if test -L "$fname"; then
75 ln -s $
(readlink
"$fname") "$OUT/$fname"
76 elif test -f "$fname"; then
81 */Frameworks
/LibreOfficePython.framework
/Versions
/*/LibreOfficePython | \
82 */Frameworks
/LibreOfficePython.framework
/Versions
/*/Resources
/Python.app
/Contents
/MacOS
/LibreOfficePython | \
83 */Library
/Spotlight
/OOoSpotlightImporter.mdimporter
/Contents
/MacOS
/OOoSpotlightImporter
)
84 lipo
-create -output "$OUT/$fname" "$fname" "$ONE/$fname"
86 # Ignore differences in these files. Let's hope it's just the timestamps.
90 */_sysconfigdata_m_darwin_darwin.py | \
91 */Contents
/Resources
/firebird
/security3.fdb | \
92 */Contents
/Resources
/autocorr
/acor_
*.dat | \
93 */Contents
/Resources
/resource
/*/LC_MESSAGES
/*.mo | \
94 */Contents
/Resources
/config
/images_
*.
zip)
95 cp "$fname" "$OUT/$fname"
98 case $
(file --brief "$fname") in
99 Mach-O\
64-bit\ executable\
*)
100 lipo
-create -output "$OUT/$fname" "$fname" "$ONE/$fname"
103 cmp -s "$fname" "$ONE/$fname" ||
104 echo "$fname differs and is not an executable!?" >&2
105 cp "$fname" "$OUT/$fname"
109 # We ignore some files that can't be built for macOS on arm64 for now
111 .
/Contents
/Frameworks
/LibreOfficePython.framework
/Versions
/3.7/lib
/python
*/lib-dynload
/_ctypes.cpython-
*m.so
)
114 echo "$fname does not exist in $TWO" >&2
117 cp "$ONE/$fname" "$OUT/$fname"
122 # Look for files in 2 that don't exist in 1
125 find .
-type f
-print
130 if test -f "$fname"; then
133 echo "$fname does not exist in $ONE" >&2
134 cp "$TWO/$fname" "$OUT/$fname"
141 # indent-tabs-mode: nil