6 Support for application bundles, for wxWidgets samples.
10 Nasty hack: use $(srcdir) to obtain usable CFBundleIdentifier suffix;
11 converts $(srcdir) like "../../samples/minimal" to "samples.minimal".
13 <set var=
"BUNDLE_IDENTIFIER">
14 `echo $(DOLLAR)(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`
17 <set var=
"BUNDLE_PLIST" overwrite=
"0">
18 $(TOP_SRCDIR)src/osx/carbon/Info.plist.in
20 <set var=
"BUNDLE_ICON" overwrite=
"0">
21 $(TOP_SRCDIR)src/osx/carbon/wxmac.icns
23 <set var=
"BUNDLE_RESOURCES" overwrite=
"0"></set>
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 <!-- TODO Remove Mac -->
32 <if cond=
"TOOLKIT=='MAC'">$(BUNDLE)/PkgInfo
</if>
33 <if cond=
"TOOLKIT=='OSX_CARBON'">$(BUNDLE)/PkgInfo
</if>
34 <if cond=
"TOOLKIT=='OSX_COCOA'">$(BUNDLE)/PkgInfo
</if>
35 <if cond=
"TOOLKIT=='OSX_IPHONE'">$(BUNDLE)/PkgInfo
</if>
36 <if cond=
"TOOLKIT=='COCOA'">$(BUNDLE)/PkgInfo
</if>
39 <add-target target=
"$(BUNDLE_TGT)" type=
"action"
40 cond=
"target and PLATFORM_MACOSX=='1'"/>
41 <modify-target target=
"$(BUNDLE_TGT)">
42 <!-- required data: -->
43 <depends>$(id)
</depends>
44 <depends-on-file>$(BUNDLE_PLIST)
</depends-on-file>
45 <depends-on-file>$(BUNDLE_ICON)
</depends-on-file>
46 <depends-on-file>$(BUNDLE_RESOURCES)
</depends-on-file>
49 <!-- create the directories: -->
51 mkdir -p $(BUNDLE)/MacOS
52 mkdir -p $(BUNDLE)/Resources
55 sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \
56 -e "s/EXECUTABLE/$(id)/" \
57 -e "s/VERSION/$(WX_VERSION)/" \
58 $(BUNDLE_PLIST)
>$(BUNDLE)/Info.plist
61 /bin/echo "APPL????"
>$(BUNDLE)/PkgInfo
63 <!-- move the binary: -->
64 ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id)
66 <!-- copy the application icon: -->
67 cp -f $(BUNDLE_ICON) $(BUNDLE)/Resources/wxmac.icns
69 <if cond=
"BUNDLE_RESOURCES!=''">
71 <!-- copy all other bundle resources: -->
72 cp -f $(BUNDLE_RESOURCES) $(BUNDLE)/Resources
78 <!-- add pseudo target id_bundle: -->
79 <add-target target=
"$(id)_bundle" type=
"phony"
80 cond=
"target and PLATFORM_MACOSX=='1'"/>
81 <modify-target target=
"$(id)_bundle">
82 <dependency-of>all
</dependency-of>
83 <depends>$(BUNDLE_TGT_REF)
</depends>
86 <!-- "make clean" should delete the bundle: -->
87 <modify-target target=
"clean">
88 <command>rm -rf $(id).app
</command>