<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jjgod / blog &#187; iceberg</title>
	<atom:link href="http://blog.jjgod.org/tag/iceberg/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jjgod.org</link>
	<description>Random notes &#38; thoughts by Jiang Jiang.</description>
	<lastBuildDate>Mon, 16 Jan 2012 11:08:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Packaging for Installation on Mac OS X</title>
		<link>http://blog.jjgod.org/2009/05/05/packaging-for-installation-on-mac-os-x/</link>
		<comments>http://blog.jjgod.org/2009/05/05/packaging-for-installation-on-mac-os-x/#comments</comments>
		<pubDate>Mon, 04 May 2009 16:05:15 +0000</pubDate>
		<dc:creator>jjgod</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[iceberg]]></category>
		<category><![CDATA[packaging]]></category>
		<category><![CDATA[pkg]]></category>

		<guid isPermaLink="false">http://blog.jjgod.org/?p=417</guid>
		<description><![CDATA[在 Mac OS X 下为程序打包该用什么格式？这是个很有趣的问题，首先，显然绝大部分的应用程序都应该： 使用手动安装，也就是一个独立的 .app，里面通过 @executable_path/../Frameworks/ 的方式链接所有依赖的第三方库，也就是说，不往系统相关目录里乱放东西。这是 Apple 官方的 Software Delivery Guide 中推荐的安装方式。 支持用 Sparkle 这样的自动更新框架，实际上符合上一点的也就自然可以用 Sparkle 完全自动的完成更新。 用 .zip 格式分发。为什么不用 .dmg？因为 .dmg 不容易直接解压，挂载速度比 .zip 慢得多，增加拖动的手续，所以我支持这篇 zip vs dmg 的观点。 但是如果遇到特殊的情况呢？比如你写的是一个非得往系统目录 (/Library/...) 安装内容的软件呢？比如我最近参与改进的 SunPinyin 输入法，就必须打包为 Installer 支持的 .pkg 格式安装了，否则很难确保软件被正确的安装。 关于这个打包方式，最重要的一点心得是：千万不要用 Apple 自己提供的 PackageMaker，这恐怕是 Apple 开发的最恐怖的一个开发辅助工具了，因为： 它必须用图形界面修改内容 它保存的 .pmdoc 格式非常混乱，而且居然喜欢把绝对路径存入文件中 不支持 Installer Plugins 扩展 [...]]]></description>
			<content:encoded><![CDATA[<p>在 Mac OS X 下为程序打包该用什么格式？这是个很有趣的问题，首先，显然绝大部分的应用程序都应该：</p>

<ul>
<li>使用手动安装，也就是一个独立的 <code>.app</code>，里面通过 <code>@executable_path/../Frameworks/</code> 的方式<a href="http://www.cocoadevcentral.com/articles/000042.php">链接所有依赖的第三方库</a>，也就是说，不往系统相关目录里乱放东西。这是 Apple 官方的 Software Delivery Guide 中<a href="http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Introduction/Introduction.html">推荐的安装方式</a>。</li>
<li>支持用 Sparkle 这样的自动更新框架，实际上符合上一点的也就自然可以用 Sparkle 完全自动的完成更新。</li>
<li>用 <code>.zip</code> 格式分发。为什么不用 <code>.dmg</code>？因为 <code>.dmg</code> 不容易直接解压，挂载速度比 <code>.zip</code> 慢得多，增加拖动的手续，所以我支持这篇 <a href="http://0xced.blogspot.com/2006/11/zip-vs-dmg.html">zip vs dmg</a> 的观点。</li>
</ul>

<p><img src="http://blogs.sun.com/yongsun/resource/sunpinyin_data_download.png" alt="SunPinyin 安装界面" class="noline" /></p>

<p>但是如果遇到特殊的情况呢？比如你写的是一个<strong>非得</strong>往系统目录 (<code>/Library/...</code>) 安装内容的软件呢？比如我最近参与改进的 <a href="http://blogs.sun.com/yongsun/entry/sunpinyin_for_mac_leopard_updated6">SunPinyin 输入法</a>，就必须打包为 Installer 支持的 <code>.pkg</code> 格式安装了，否则很难确保软件被正确的安装。</p>

<p>关于这个打包方式，最重要的一点心得是：千万不要用 Apple 自己提供的 <a href="http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/PackageMakerUserGuide/index.html">PackageMaker</a>，这恐怕是 Apple 开发的最恐怖的一个开发辅助工具了，因为：</p>

<ul>
<li>它必须用图形界面修改内容</li>
<li>它保存的 <code>.pmdoc</code> 格式非常混乱，而且居然喜欢把<em>绝对路径</em>存入文件中</li>
<li>不支持 <a href="http://developer.apple.com/samplecode/InstallerPluginSample/listing1.html">Installer Plugins</a> 扩展</li>
</ul>

<p>那替代的工具是什么呢？是一个非常棒的第三方工具: <a href="http://s.sudre.free.fr/Software/Iceberg.html">Iceberg</a>，它能：</p>

<ul>
<li>打包出 Mac OS X 10.2+ 以上都支持的 <code>.pkg</code> bundle 格式</li>
<li>界面比 PackageMaker 友好得多，而且有非常详尽的文档，也很方便调试</li>
<li>支持 Installer Plugin</li>
</ul>

<p>涉及打包、Sparkle 的 appcast 自动生成，Iceberg 的使用等问题，都可以参考 SunPinyin <a href="http://src.opensolaris.org/source/xref/nv-g11n/inputmethod/sunpinyin/ime/wrapper/macos/packaging/">目前使用的代码</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jjgod.org/2009/05/05/packaging-for-installation-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

