dust3d/thirdparty/cgal/CGAL-4.13/scripts/cgal_make_macosx_app

103 lines
2.9 KiB
Bash
Executable File

#!/bin/sh
# Copyright (c) 2005,2006,2013
# Foundation for Research and Technology-Hellas (Greece).
# All rights reserved.
#
# This file is part of CGAL (www.cgal.org); you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; version 3 of the License,
# or (at your option) any later version.
#
# Licensees holding a valid commercial license may use this file in
# accordance with the commercial license agreement provided with the software.
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# $URL$
# $Id$
# SPDX-License-Identifier: LGPL-3.0+
#
# Authors: Herve Bronnimann
# Menelaos Karavelas
# Eric Berberich <eric.berberich@cgal.org>
# This script creates the appropriate directory structure so that a CGAL
# Qt demo can be run on MacOSX
usage()
{
echo "Usage: cgal_make_macosx_app executable"
}
case $# in
0) usage
exit 1
esac
for i do
if [ -x "$i" ] ; then
EXECUTABLE=$i
else
usage
exit 1
fi
done
if [ -z "$EXECUTABLE.app" ] ; then
mkdir $EXECUTABLE.app
fi
test -d $EXECUTABLE.app/Contents/MacOS/ || mkdir -p $EXECUTABLE.app/Contents/MacOS/
strip $EXECUTABLE
cp $EXECUTABLE $EXECUTABLE.app/Contents/MacOS/$EXECUTABLE
rm -f $EXECUTABLE.app/Contents/PkgInfo
echo "APPL????" > $EXECUTABLE.app/Contents/PkgInfo
rm -f $EXECUTABLE.app/Contents/Info.plist
cat > $EXECUTABLE.app/Contents/Info.plist <<ENDINFO
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM
"file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version=\"0.9\">
<dict>
<key>CFBundleIconFile</key>
<string>cgal_app.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by CGAL</string>
<key>CFBundleSignature</key>
<string>ttxt</string>
<key>CFBundleExecutable</key>
<string>$EXECUTABLE</string>
ENDINFO
if [ -d "help" ] ; then
cat >> $EXECUTABLE.app/Contents/Info.plist <<ENDINFO
<key>CFBundleHelpBookFolder</key>
<string>Help</string>
<key>CFBundleHelpBookName</key>
<string>Help</string>
ENDINFO
test -d $EXECUTABLE.app/Contents/Resources/Help || mkdir -p $EXECUTABLE.app/Contents/Resources/Help
cp -r help/* $EXECUTABLE.app/Contents/Resources/Help
ln -s index.html $EXECUTABLE.app/Contents/Resources/Help/Help.html
fi
cat >> $EXECUTABLE.app/Contents/Info.plist <<ENDINFO
<key>NOTE</key>
<string>This file was generated by CGAL/scripts/cgal_make_macosx_app.</string>
</dict>
</plist>
ENDINFO
test -d $EXECUTABLE.app/Contents/Resources || mkdir -p $EXECUTABLE.app/Contents/Resources
DIR=$( cd "$( dirname "$0" )" && pwd )
cp $DIR/../auxiliary/cgal_app.icns $EXECUTABLE.app/Contents/Resources
echo "created $EXECUTABLE.app ..."