]>
Commit | Line | Data |
---|---|---|
1 | <?xml version="1.0" ?> | |
2 | ||
3 | <makefile> | |
4 | ||
5 | <!-- | |
6 | Support for application bundles, for wxWidgets samples. | |
7 | --> | |
8 | ||
9 | <!-- | |
10 | Nasty hack: use $(srcdir) to obtain usable CFBundleIdentifier suffix; | |
11 | converts $(srcdir) like "../../samples/minimal" to "samples.minimal". | |
12 | --> | |
13 | <set var="BUNDLE_IDENTIFIER"> | |
14 | `echo $(DOLLAR)(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'` | |
15 | </set> | |
16 | ||
17 | <set var="BUNDLE_PLIST" overwrite="0"> | |
18 | $(TOP_SRCDIR)src/osx/carbon/Info.plist.in | |
19 | </set> | |
20 | <set var="BUNDLE_ICON" overwrite="0"> | |
21 | $(TOP_SRCDIR)src/osx/carbon/wxmac.icns | |
22 | </set> | |
23 | <set var="BUNDLE_RESOURCES" overwrite="0"></set> | |
24 | ||
25 | <define-tag name="wx-mac-app-bundle" rules="exe"> | |
26 | ||
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> | |
37 | </set> | |
38 | ||
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> | |
47 | ||
48 | <command> | |
49 | <!-- create the directories: --> | |
50 | mkdir -p $(BUNDLE) | |
51 | mkdir -p $(BUNDLE)/MacOS | |
52 | mkdir -p $(BUNDLE)/Resources | |
53 | ||
54 | <!-- Info.plist: --> | |
55 | sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \ | |
56 | -e "s/EXECUTABLE/$(id)/" \ | |
57 | -e "s/VERSION/$(WX_VERSION)/" \ | |
58 | $(BUNDLE_PLIST) >$(BUNDLE)/Info.plist | |
59 | ||
60 | <!-- PkgInfo: --> | |
61 | /bin/echo "APPL????" >$(BUNDLE)/PkgInfo | |
62 | ||
63 | <!-- move the binary: --> | |
64 | ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id) | |
65 | ||
66 | <!-- copy the application icon: --> | |
67 | cp -f $(BUNDLE_ICON) $(BUNDLE)/Resources/wxmac.icns | |
68 | </command> | |
69 | <if cond="BUNDLE_RESOURCES!=''"> | |
70 | <command> | |
71 | <!-- copy all other bundle resources: --> | |
72 | cp -f $(BUNDLE_RESOURCES) $(BUNDLE)/Resources | |
73 | </command> | |
74 | </if> | |
75 | ||
76 | </modify-target> | |
77 | ||
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> | |
84 | </modify-target> | |
85 | ||
86 | <!-- "make clean" should delete the bundle: --> | |
87 | <modify-target target="clean"> | |
88 | <command>rm -rf $(id).app</command> | |
89 | </modify-target> | |
90 | ||
91 | </define-tag> | |
92 | ||
93 | </makefile> |