wxWidgets/build/bakefiles/mac_bundles.bkl
2003-10-03 12:09:36 +00:00

82 lines
2.7 KiB
XML

<?xml version="1.0" ?>
<!-- $Id$ -->
<makefile>
<!--
Support for application bundles, for wxWindows samples.
-->
<!--
Nasty hack: use $(srcdir) to obtain usable CFBundleIdentifier suffix;
converts $(srcdir) like "../../samples/minimal" to "samples.minimal".
-->
<set var="BUNDLE_IDENTIFIER">
`echo $(DOLLAR)(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`
</set>
<set var="BUNDLE_PLIST">
$(TOP_SRCDIR)src/mac/Info.plist.in
</set>
<set var="BUNDLE_RESOURCE">
$(LIBDIRNAME)/libwx_$(TOOLCHAIN_NAME).$(WXSOVERSION[0]).rsrc
</set>
<set var="BUNDLE_ICONS">
$(TOP_SRCDIR)src/mac/wxmac.icns
</set>
<define-tag name="wx-mac-app-bundle" rules="exe">
<!-- bundle directory: -->
<set var="BUNDLE">$(id).app/Contents</set>
<set var="BUNDLE_TGT">$(BUNDLE)/PkgInfo</set>
<add-target target="$(BUNDLE_TGT)" type="action"/>
<modify-target target="$(BUNDLE_TGT)">
<!-- required data: -->
<depends>$(id)</depends>
<depends-on-file>$(BUNDLE_PLIST)</depends-on-file>
<depends-on-file>$(BUNDLE_RESOURCE)</depends-on-file>
<depends-on-file>$(BUNDLE_ICONS)</depends-on-file>
<command>
<!-- create the directories: -->
mkdir -p $(BUNDLE)
mkdir -p $(BUNDLE)/MacOS
mkdir -p $(BUNDLE)/Resources
<!-- Info.plist: -->
sed -e "s/IDENTIFIER/$(BUNDLE_IDENTIFIER)/" \
-e "s/EXECUTABLE/$(id)/" \
-e "s/VERSION/$(WX_VERSION)/" \
$(BUNDLE_PLIST) >$(BUNDLE)/Info.plist
<!-- PkgInfo: -->
echo -n "APPL????" >$(BUNDLE)/PkgInfo
<!-- make a hardlink to the binary: -->
ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id)
<!-- ditto wxWindows resources and icons: -->
ln -sf $(BUNDLE_RESOURCE) $(BUNDLE)/Resources/$(id).rsrc
ln -sf $(BUNDLE_ICONS) $(BUNDLE)/Resources/wxmac.icns
</command>
</modify-target>
<!-- add pseudo target id_bundle: -->
<add-target target="$(id)_bundle" type="phony"
cond="PLATFORM_MACOSX=='1'"/>
<modify-target target="$(id)_bundle">
<dependency-of>all</dependency-of>
<depends>$(BUNDLE_TGT)</depends>
</modify-target>
<!-- "make clean" should delete the bundle: -->
<modify-target target="clean">
<command>rm -rf $(id).app</command>
</modify-target>
</define-tag>
</makefile>