mac_bundles.bkl 3.3 KB

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