7 Support for application bundles, for wxWindows 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/mac/Info.plist.in
21 <set var="BUNDLE_RESOURCE">
22 $(LIBDIRNAME)/libwx_$(TOOLCHAIN_NAME).$(WXSOVERSION[0]).rsrc
24 <set var="BUNDLE_ICONS">
25 $(TOP_SRCDIR)src/mac/wxmac.icns
28 <define-tag name="wx-mac-app-bundle" rules="exe">
30 <!-- bundle directory: -->
31 <set var="BUNDLE">$(id).app/Contents</set>
33 <add-target target="$(BUNDLE)" type="action"/>
34 <modify-target target="$(BUNDLE)">
35 <!-- required data: -->
36 <depends>$(id)</depends>
37 <depends-on-file>$(BUNDLE_PLIST)</depends-on-file>
38 <depends-on-file>$(BUNDLE_RESOURCE)</depends-on-file>
39 <depends-on-file>$(BUNDLE_ICONS)</depends-on-file>
42 <!-- create the directories: -->
44 mkdir -p $(BUNDLE)/MacOS
45 mkdir -p $(BUNDLE)/Resources
48 sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \
49 -e "s/EXECUTABLE/$(id)/" \
50 -e "s/VERSION/$(WX_VERSION)/" \
51 $(BUNDLE_PLIST) >$(BUNDLE)/Info.plist
54 echo -n "APPL????" >$(BUNDLE)/PkgInfo
56 <!-- make a hardlink to the binary: -->
57 ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id)
59 <!-- ditto wxWindows resources and icons: -->
60 ln -f $(BUNDLE_RESOURCE) $(BUNDLE)/Resources/$(id).rsrc
61 ln -f $(BUNDLE_ICONS) $(BUNDLE)/Resources/wxmac.icns
65 <!-- add pseudo target id_bundle: -->
66 <add-target target="$(id)_bundle" type="phony"
67 cond="PLATFORM_MACOSX=='1'"/>
68 <modify-target target="$(id)_bundle">
69 <dependency-of>all</dependency-of>
70 <depends>$(BUNDLE)</depends>
73 <!-- "make clean" should delete the bundle: -->
74 <modify-target target="clean">
75 <command>rm -rf $(id).app</command>