bump product version to 4.1.6.2
[LibreOffice.git] / solenv / bin / macosx-create-bundle
bloba458e1413a6a0812e034ab12121aa571497b322d
1 #!/bin/sh
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 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 # Documentation
20 # -------------
22 # The purpose of this script to take Mac OS X executables and shared libraries
23 # and package them into the required Mac OS X bundle format.
25 # This script has the following usage:
26 # macosx-create-bundle file1 [file2] ... [fileN]
28 # Note that file1 through fileN can in either of the following formats:
29 # - A file name
30 # - A file name and a directory to look for missing files. To use this option,
31 # use the following format:
32 # filename=directory
34 # The file argument is the file that you want to package into a Mac OS X
35 # bundle. Currently, this script will only package executables and shared
36 # libraries.
38 # The output for each executable will be a bundle named <file>.app and
39 # the output for each shared library will be a symlink from libfoo.jnilib
40 # back to libfoo.dylib.
41 # These output directories will be in the same directory as the executable or
42 # shared library.
44 # Code
45 # ----
47 # Parse command line arguments
48 if [ $# = 0 ]; then
49 printf "macosx-create-bundle: error: incorrect number of arguments\n" >&2
50 printf "Usage: macosx-create-bundle file1 [file2] ... [fileN]\n" >&2
51 exit 1
54 while [ $# != 0 ]; do
55 inputfile=`echo "$1" | awk -F= '{print $1}'`
56 sourcedir=`echo "$1" | awk -F= '{print $2}'`
58 shift
60 inputfilename=`basename "$inputfile"`
61 outputdir=`dirname "$inputfile"`
63 solverlibdir="$SOLARVERSION/$INPATH/lib"
64 locallibdir="../../../../lib"
66 solverbindir="$SOLARVERSION/$INPATH/bin"
67 localbindir="../../.."
69 # Determine file type
70 filetype=`file -L "$inputfile"`
72 # Create bundle based on file type
73 if printf "$filetype" | grep -q 'Mach-O executable'; then
75 # Do nothing as this step is obsolete
78 elif printf "$filetype" | grep -q 'dynamically linked shared library'; then
79 # Screen out lib\w+static libraries as they are not used directly
80 if ! printf "$inputfilename" | grep -q -x -E 'lib\w+static.*\.dylib'; then
81 # Create jnilib link
82 inputjnilibname="`basename $inputfilename .dylib`.jnilib"
83 if [ ! -L "$outputdir/$inputjnilibname" ]; then
84 rm -Rf "$outputdir/$inputjnilibname"
86 # Link jnilib
87 ln -sf "$inputfilename" "$outputdir/$inputjnilibname"
89 #printf "macosx-create-bundle: $outputdir/$inputjnilibname successfully created\n"
91 else
92 printf "macosx-create-bundle: error: file is not an executable or shared library.\n" >&2
93 exit 1
95 done