Also make make dist for wxMac work
[wxWidgets.git] / build / bakefiles / mac_bundles.bkl
CommitLineData
425c0d76
VS
1<?xml version="1.0" ?>
2<!-- $Id$ -->
3
4<makefile>
5
6 <!--
77ffb593 7 Support for application bundles, for wxWidgets samples.
425c0d76
VS
8 -->
9
10 <!--
11 Nasty hack: use $(srcdir) to obtain usable CFBundleIdentifier suffix;
12 converts $(srcdir) like "../../samples/minimal" to "samples.minimal".
13 -->
14 <set var="BUNDLE_IDENTIFIER">
15 `echo $(DOLLAR)(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`
16 </set>
17
a0b10e1b 18 <set var="BUNDLE_PLIST" overwrite="0">
732c71cf 19 $(TOP_SRCDIR)src/osx/carbon/Info.plist.in
425c0d76 20 </set>
78a9167e 21 <set var="BUNDLE_ICON" overwrite="0">
732c71cf 22 $(TOP_SRCDIR)src/osx/carbon/wxmac.icns
425c0d76 23 </set>
78a9167e 24 <set var="BUNDLE_RESOURCES" overwrite="0"></set>
425c0d76
VS
25
26 <define-tag name="wx-mac-app-bundle" rules="exe">
27
28 <!-- bundle directory: -->
29 <set var="BUNDLE">$(id).app/Contents</set>
54eba47d 30 <set var="BUNDLE_TGT">$(BUNDLE)/PkgInfo</set>
0e6450e1
VS
31 <set var="BUNDLE_TGT_REF">
32 <if cond="TOOLKIT=='MAC'">$(BUNDLE)/PkgInfo</if>
33 <if cond="TOOLKIT=='COCOA'">$(BUNDLE)/PkgInfo</if>
34 </set>
b6460890
VS
35
36 <add-target target="$(BUNDLE_TGT)" type="action"
37 cond="target and PLATFORM_MACOSX=='1'"/>
54eba47d 38 <modify-target target="$(BUNDLE_TGT)">
425c0d76
VS
39 <!-- required data: -->
40 <depends>$(id)</depends>
41 <depends-on-file>$(BUNDLE_PLIST)</depends-on-file>
78a9167e
SC
42 <depends-on-file>$(BUNDLE_ICON)</depends-on-file>
43 <depends-on-file>$(BUNDLE_RESOURCES)</depends-on-file>
425c0d76
VS
44
45 <command>
46 <!-- create the directories: -->
47 mkdir -p $(BUNDLE)
48 mkdir -p $(BUNDLE)/MacOS
49 mkdir -p $(BUNDLE)/Resources
50
51 <!-- Info.plist: -->
52 sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \
53 -e "s/EXECUTABLE/$(id)/" \
54 -e "s/VERSION/$(WX_VERSION)/" \
55 $(BUNDLE_PLIST) >$(BUNDLE)/Info.plist
56
57 <!-- PkgInfo: -->
58 echo -n "APPL????" >$(BUNDLE)/PkgInfo
59
60 <!-- make a hardlink to the binary: -->
61 ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id)
62
78a9167e
SC
63 <!-- copy the application icon: -->
64 cp -f $(BUNDLE_ICON) $(BUNDLE)/Resources/wxmac.icns
65 </command>
66 <if cond="BUNDLE_RESOURCES!=''">
67 <command>
68 <!-- copy all other bundle resources: -->
69 cp -f $(BUNDLE_RESOURCES) $(BUNDLE)/Resources
70 </command>
71 </if>
72
425c0d76
VS
73 </modify-target>
74
75 <!-- add pseudo target id_bundle: -->
76 <add-target target="$(id)_bundle" type="phony"
b6460890 77 cond="target and PLATFORM_MACOSX=='1'"/>
425c0d76
VS
78 <modify-target target="$(id)_bundle">
79 <dependency-of>all</dependency-of>
0e6450e1 80 <depends>$(BUNDLE_TGT_REF)</depends>
425c0d76
VS
81 </modify-target>
82
83 <!-- "make clean" should delete the bundle: -->
84 <modify-target target="clean">
85 <command>rm -rf $(id).app</command>
86 </modify-target>
87
88 </define-tag>
89
90</makefile>