wxWidgets/build/bakefiles/mac_bundles.bkl
Vadim Zeitlin 81c4fa449b Use CMake-compatible variable names in configure Info.plist files
This will allow reusing them for CMake as well, and is required in order
to be able to do it as CMake variables names are fixed.
2021-08-15 18:39:34 +02:00

103 lines
4.2 KiB
XML

<?xml version="1.0" ?>
<makefile>
<!--
Support for application bundles, for wxWidgets samples.
-->
<set var="BUNDLE_PLIST" overwrite="0">
$(TOP_SRCDIR)src/osx/carbon/Info.plist.in
</set>
<set var="BUNDLE_ICON" overwrite="0">
$(TOP_SRCDIR)src/osx/carbon/wxmac.icns
</set>
<set var="BUNDLE_RESOURCES" overwrite="0"></set>
<set var="BUNDLE_FONT_RESOURCES" overwrite="0"></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>
<set var="BUNDLE_TGT_REF">
<!-- TODO Remove Mac -->
<if cond="TOOLKIT=='MAC'">$(BUNDLE)/PkgInfo</if>
<if cond="TOOLKIT=='OSX_CARBON'">$(BUNDLE)/PkgInfo</if>
<if cond="TOOLKIT=='OSX_COCOA'">$(BUNDLE)/PkgInfo</if>
<if cond="TOOLKIT=='OSX_IPHONE'">$(BUNDLE)/PkgInfo</if>
<if cond="TOOLKIT=='COCOA'">$(BUNDLE)/PkgInfo</if>
</set>
<add-target target="$(BUNDLE_TGT)" type="action"
cond="target and PLATFORM_MACOSX=='1'"/>
<modify-target target="$(BUNDLE_TGT)">
<!-- required data: -->
<depends>$(id)</depends>
<depends-on-file>$(BUNDLE_PLIST)</depends-on-file>
<depends-on-file>$(BUNDLE_ICON)</depends-on-file>
<depends-on-file>$(BUNDLE_RESOURCES)</depends-on-file>
<depends-on-file>$(BUNDLE_FONT_RESOURCES)</depends-on-file>
<command>
<!-- create the directories: -->
mkdir -p $(BUNDLE)
mkdir -p $(BUNDLE)/MacOS
mkdir -p $(BUNDLE)/Resources
<!-- Info.plist: -->
sed -e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.$(id)/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_EXECUTABLE_NAME}/$(id)/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_BUNDLE_NAME}/$(id)/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_COPYRIGHT}/Copyright 2002-2021 wxWidgets/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_BUNDLE_VERSION}/$(WX_VERSION)/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_INFO_STRING}/$(id) version $(WX_VERSION), (c) 2002-2021 wxWidgets/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_LONG_VERSION_STRING}/$(WX_VERSION), (c) 2002-2021 wxWidgets/" \
-e "s/\$(DOLLAR)$(DOLLAR){MACOSX_BUNDLE_SHORT_VERSION_STRING}/$(WX_RELEASE)/" \
$(BUNDLE_PLIST) >$(BUNDLE)/Info.plist
<!-- PkgInfo: -->
/bin/echo "APPL????" >$(BUNDLE)/PkgInfo
<!-- move the binary: -->
ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id)
<!-- copy the application icon: -->
cp -f $(BUNDLE_ICON) $(BUNDLE)/Resources/wxmac.icns
</command>
<if cond="BUNDLE_RESOURCES!=''">
<command>
<!-- copy all other bundle resources: -->
cp -f $(BUNDLE_RESOURCES) $(BUNDLE)/Resources
</command>
</if>
<if cond="BUNDLE_FONT_RESOURCES!=''">
<!--
Special case of font resources, which must be copied into
the Fonts subdirectory used in src/osx/carbon/Info.plist.in file.
-->
<command>
mkdir -p $(BUNDLE)/Resources/Fonts
cp -f $(BUNDLE_FONT_RESOURCES) $(BUNDLE)/Resources/Fonts
</command>
</if>
</modify-target>
<!-- add pseudo target id_bundle: -->
<add-target target="$(id)_bundle" type="phony"
cond="target and PLATFORM_MACOSX=='1'"/>
<modify-target target="$(id)_bundle">
<dependency-of>all</dependency-of>
<depends>$(BUNDLE_TGT_REF)</depends>
</modify-target>
<!-- "make clean" should delete the bundle: -->
<modify-target target="clean">
<command>rm -rf $(id).app</command>
</modify-target>
</define-tag>
</makefile>