Ticket #14557: appbundle-1.0.tcl

File appbundle-1.0.tcl, 2.6 KB (added by raimue (Rainer Müller), 15 years ago)

Preliminary port group

Line 
1# et:ts=4
2# appbundle-1.0.tcl
3#
4# $Id$
5#
6# Copyright (c) 2009 The MacPorts Project
7# Copyright (c) 2009 Rainer Mueller <raimue@macports.org>
8# All rights reserved.
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions are
12# met:
13#
14# 1. Redistributions of source code must retain the above copyright
15#    notice, this list of conditions and the following disclaimer.
16# 2. Redistributions in binary form must reproduce the above copyright
17#    notice, this list of conditions and the following disclaimer in the
18#    documentation and/or other materials provided with the distribution.
19# 3. Neither the name of Apple Computer, Inc. nor the names of its
20#    contributors may be used to endorse or promote products derived from
21#    this software without specific prior written permission.
22#
23# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34#
35
36options appbundle.create appbundle.binary appbundle.name appbundle.icon
37
38# We can't set the real defaults here for all options, because they might not
39# exist yet at time of sourcing
40default appbundle.create yes
41default appbundle.binary ""
42default appbundle.name ""
43default appbundle.icon ""
44
45platform macosx {
46    post-destroot {
47        if {[tbool appbundle.create]} {
48            if {${appbundle.binary} == ""} {
49                appbundle.binary ${prefix}/bin/${name}
50            }
51            if {${appbundle.name} == ""} {
52                appbundle.name ${name}
53            }
54
55            set app "${destroot}/${applications_dir}/${appbundle.name}.app"
56
57            file mkdir "$app/Contents/MacOS"
58            ln -s "${appbundle.binary}" "$app/Contents/MacOS/${appbundle.name}"
59
60            if {${appbundle.icon} != ""} {
61                file mkdir "$app/Contents/Resources"
62                xinstall -m 444 "${filespath}/${appbundle.icon}" "$app/Contents/Resources/${appbundle.name}"
63            }
64        }
65    }
66}