diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-04-20 13:13:31 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2006-04-20 13:13:31 +0000 |
commit | 0d598246c11082723d92cbb1e089ccb51f967ee5 (patch) | |
tree | 681dfcadf82c9ca9a9dc78f31edf888892a0d6d4 /solenv/bin | |
parent | ccebb5622497bc78dbe51c3c5e8a4ba1375cc681 (diff) |
INTEGRATION: CWS pj53 (1.1.2); FILE ADDED
2006/04/13 12:51:58 pjanik 1.1.2.1: #i61798#: Rename create-bundle to macosx-create-bundle and move it to solenv/bin.
Diffstat (limited to 'solenv/bin')
-rwxr-xr-x | solenv/bin/macosx-create-bundle | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/solenv/bin/macosx-create-bundle b/solenv/bin/macosx-create-bundle new file mode 100755 index 000000000000..970df83820d7 --- /dev/null +++ b/solenv/bin/macosx-create-bundle @@ -0,0 +1,111 @@ +#!/bin/sh +#************************************************************************* +# +# $RCSfile: macosx-create-bundle,v $ +# +# $Revision: 1.2 $ +# +# last change: $Author: hr $ $Date: 2006-04-20 14:13:31 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* + +# Documentation +# ------------- +# +# The purpose of this script to take Mac OS X executables and shared libraries +# and package them into the required Mac OS X bundle format. +# +# This script has the following usage: +# macosx-create-bundle file1 [file2] ... [fileN] +# +# Note that file1 through fileN can in either of the following formats: +# - A file name +# - A file name and a directory to look for missing files. To use this option, +# use the following format: +# filename=directory +# +# The file argument is the file that you want to package into a Mac OS X +# bundle. Currently, this script will only package executables and shared +# libraries. +# +# The output for each executable will be a bundle named <file>.app and +# the output for each shared library will be a symlink from libfoo.jnilib +# back to libfoo.dylib. +# These output directories will be in the same directory as the executable or +# shared library. + +# Code +# ---- + +# Parse command line arguments +if [ $# = 0 ]; then + printf "macosx-create-bundle: error: incorrect number of arguments\n" >&2 + printf "Usage: macosx-create-bundle file1 [file2] ... [fileN]\n" >&2 + exit 1 +fi + +while [ $# != 0 ]; do + inputfile=`echo "$1" | awk -F= '{print $1}'` + sourcedir=`echo "$1" | awk -F= '{print $2}'` + + shift + + inputfilename=`basename "$inputfile"` + outputdir=`dirname "$inputfile"` + + solverlibdir="$SOLARVERSION/$INPATH/lib" + locallibdir="../../../../lib" + + solverbindir="$SOLARVERSION/$INPATH/bin" + localbindir="../../.." + + # Determine file type + filetype=`file -L "$inputfile"` + + # Create bundle based on file type + if printf "$filetype" | grep -q 'Mach-O executable'; then + + # Do nothing as this step is obsolete + : + + elif printf "$filetype" | grep -q 'Mach-O dynamically linked shared library'; then + # Screen out lib\w+static libraries as they are not used directly + if ! printf "$inputfilename" | grep -q -x -E 'lib\w+static.*\.dylib'; then + # Create jnilib link + inputjnilibname="`basename $inputfilename .dylib`.jnilib" + if [ ! -L "$outputdir/$inputjnilibname" ]; then + rm -Rf "$outputdir/$inputjnilibname" + fi + # Link jnilib + ln -sf "$inputfilename" "$outputdir/$inputjnilibname" + + printf "macosx-create-bundle: $outputdir/$inputjnilibname successfully created\n" + fi + else + printf "macosx-create-bundle: error: file is not an executable or shared library.\n" >&2 + exit 1 + fi +done |