1<?xml version="1.0" ?> 2<!-- $Id: mac_bundles.bkl 53922 2008-06-02 10:38:31Z VS $ --> 3 4<makefile> 5 6 <!-- 7 Support for application bundles, for wxWidgets samples. 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 18 <set var="BUNDLE_PLIST"> 19 $(TOP_SRCDIR)src/mac/carbon/Info.plist.in 20 </set> 21 <set var="BUNDLE_ICONS"> 22 $(TOP_SRCDIR)src/mac/carbon/wxmac.icns 23 </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 <if cond="TOOLKIT=='MAC'">$(BUNDLE)/PkgInfo</if> 32 <if cond="TOOLKIT=='COCOA'">$(BUNDLE)/PkgInfo</if> 33 </set> 34 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> 42 43 <command> 44 <!-- create the directories: --> 45 mkdir -p $(BUNDLE) 46 mkdir -p $(BUNDLE)/MacOS 47 mkdir -p $(BUNDLE)/Resources 48 49 <!-- Info.plist: --> 50 sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \ 51 -e "s/EXECUTABLE/$(id)/" \ 52 -e "s/VERSION/$(WX_VERSION)/" \ 53 $(BUNDLE_PLIST) >$(BUNDLE)/Info.plist 54 55 <!-- PkgInfo: --> 56 echo -n "APPL????" >$(BUNDLE)/PkgInfo 57 58 <!-- make a hardlink to the binary: --> 59 ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id) 60 61 <!-- ditto wxWidgets resources and icons: --> 62 cp -f $(BUNDLE_ICONS) $(BUNDLE)/Resources/wxmac.icns 63 </command> 64 </modify-target> 65 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> 72 </modify-target> 73 74 <!-- "make clean" should delete the bundle: --> 75 <modify-target target="clean"> 76 <command>rm -rf $(id).app</command> 77 </modify-target> 78 79 </define-tag> 80 81</makefile> 82