7 Support for application bundles, for wxWidgets samples.
11 Nasty hack: use $(srcdir) to obtain usable CFBundleIdentifier suffix;
12 converts $(srcdir) like "../../samples/minimal" to "samples.minimal".
14 <set var="BUNDLE_IDENTIFIER">
15 `echo $(DOLLAR)(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`
18 <set var="BUNDLE_PLIST">
19 $(TOP_SRCDIR)src/osx/carbon/Info.plist.in
21 <set var="BUNDLE_ICONS">
22 $(TOP_SRCDIR)src/osx/carbon/wxmac.icns
25 <define-tag name="wx-mac-app-bundle" rules="exe">
27 <!-- bundle directory: -->
28 <set var="BUNDLE">$(id).app/Contents</set>
29 <set var="BUNDLE_TGT">$(BUNDLE)/PkgInfo</set>
30 <set var="BUNDLE_TGT_REF">
31 <if cond="TOOLKIT=='MAC'">$(BUNDLE)/PkgInfo</if>
32 <if cond="TOOLKIT=='COCOA'">$(BUNDLE)/PkgInfo</if>
35 <add-target target="$(BUNDLE_TGT)" type="action"
36 cond="target and PLATFORM_MACOSX=='1'"/>
37 <modify-target target="$(BUNDLE_TGT)">
38 <!-- required data: -->
39 <depends>$(id)</depends>
40 <depends-on-file>$(BUNDLE_PLIST)</depends-on-file>
41 <depends-on-file>$(BUNDLE_ICONS)</depends-on-file>
44 <!-- create the directories: -->
46 mkdir -p $(BUNDLE)/MacOS
47 mkdir -p $(BUNDLE)/Resources
50 sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \
51 -e "s/EXECUTABLE/$(id)/" \
52 -e "s/VERSION/$(WX_VERSION)/" \
53 $(BUNDLE_PLIST) >$(BUNDLE)/Info.plist
56 echo -n "APPL????" >$(BUNDLE)/PkgInfo
58 <!-- make a hardlink to the binary: -->
59 ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id)
61 <!-- ditto wxWidgets resources and icons: -->
62 cp -f $(BUNDLE_ICONS) $(BUNDLE)/Resources/wxmac.icns
66 <!-- add pseudo target id_bundle: -->
67 <add-target target="$(id)_bundle" type="phony"
68 cond="target and PLATFORM_MACOSX=='1'"/>
69 <modify-target target="$(id)_bundle">
70 <dependency-of>all</dependency-of>
71 <depends>$(BUNDLE_TGT_REF)</depends>
74 <!-- "make clean" should delete the bundle: -->
75 <modify-target target="clean">
76 <command>rm -rf $(id).app</command>