1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
<?xml version="1.0" ?>
<!-- $Id$ -->
<makefile>
<!--
Support for application bundles, copied from wxWidgets samples and slightly modified.
-->
<!--
Nasty hack: use $(srcdir) to obtain usable CFBundleIdentifier suffix;
converts $(srcdir) like "../../samples/minimal" to "samples.minimal".
-->
<set var="BUNDLE_IDENTIFIER">
`echo $(DOLLAR)(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`
</set>
<set var="BUNDLE_PLIST" overwrite="0">
$(SRCDIR)/build/Info.plist.in
</set>
<set var="BUNDLE_ICON" overwrite="0">
$(SRCDIR)/build/wxmac.icns
</set>
<set var="BUNDLE_RESOURCES" overwrite="0"></set>
<define-tag name="wx-mac-app-bundle" rules="exe">
<!-- bundle directory: -->
<set var="BUNDLE">$(id).app/Contents</set>
<set var="BUNDLE_TGT">$(BUNDLE)/PkgInfo</set>
<set var="BUNDLE_TGT_REF">$(BUNDLE)/PkgInfo</set>
<set var="BUNDLE_PATH">
$(ref("__targetdir",id))
</set>
<!-- The optional tag attribute 'resources' contains a list of file resources -->
<set var="BUNDLE_RESOURCES_PARAM">$(attributes['resources'] if isdefined('attributes') and 'resources' in attributes else '')</set>
<add-target target="$(BUNDLE_TGT)" type="action"
cond="target and PLATFORM_MACOSX=='1'"/>
<modify-target target="$(BUNDLE_TGT)">
<!-- required data: -->
<depends>$(id)</depends>
<depends-on-file>$(BUNDLE_PLIST)</depends-on-file>
<depends-on-file>$(BUNDLE_ICON)</depends-on-file>
<depends-on-file>$(BUNDLE_RESOURCES)</depends-on-file>
<depends-on-file>$(BUNDLE_RESOURCES_PARAM)</depends-on-file>
<command>
<!-- create the directories: -->
mkdir -p $(BUNDLE_PATH)$(BUNDLE)
mkdir -p $(BUNDLE_PATH)$(BUNDLE)/MacOS
mkdir -p $(BUNDLE_PATH)$(BUNDLE)/Resources
<!-- Info.plist: -->
sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \
-e "s/EXECUTABLE/$(id)/" \
-e "s/VERSION/$(WX_VERSION)/" \
$(BUNDLE_PLIST) > $(BUNDLE_PATH)$(BUNDLE)/Info.plist
<!-- PkgInfo: -->
echo -n "APPL????" >$(BUNDLE_PATH)$(BUNDLE)/PkgInfo
<!-- move the binary: -->
mv $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE_PATH)$(BUNDLE)/MacOS/$(id)
<!-- copy the application icon: -->
cp -f $(BUNDLE_ICON) $(BUNDLE_PATH)$(BUNDLE)/Resources/wxmac.icns
</command>
<if cond="BUNDLE_RESOURCES_PARAM!=''">
<command>
<!-- copy bundle resources given in the 'resources' attribute: -->
cp -f $(BUNDLE_RESOURCES_PARAM) $(BUNDLE_PATH)$(BUNDLE)/Resources
</command>
</if>
<if cond="BUNDLE_RESOURCES!=''">
<command>
<!-- copy all other bundle resources: -->
cp -f $(BUNDLE_RESOURCES) $(BUNDLE_PATH)$(BUNDLE)/Resources
</command>
</if>
</modify-target>
<!-- add pseudo target id_bundle: -->
<add-target target="$(id)_bundle" type="phony"
cond="target and PLATFORM_MACOSX=='1'"/>
<modify-target target="$(id)_bundle">
<dependency-of>all</dependency-of>
<depends>$(BUNDLE_TGT_REF)</depends>
</modify-target>
<!-- "make clean" should delete the bundle: -->
<modify-target target="clean">
<command>rm -rf $(id).app</command>
</modify-target>
</define-tag>
</makefile>
|