<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>朱文昊 Albert Zhu &#187; 自由软件社区</title>
	<atom:link href="http://zhuwenhao.com/category/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/feed/" rel="self" type="application/rss+xml" />
	<link>http://zhuwenhao.com</link>
	<description>朱文昊的中文博客－－专注技术，向往自由</description>
	<lastBuildDate>Thu, 10 May 2012 07:20:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C#写的定时关机程序及一些感想</title>
		<link>http://zhuwenhao.com/1020/%e6%8a%80%e6%9c%af/%e7%a8%8b%e5%ba%8f%e8%ae%be%e8%ae%a1%e8%af%ad%e8%a8%80/csharp-%e8%af%ad%e8%a8%80/c%e5%86%99%e7%9a%84%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e7%a8%8b%e5%ba%8f%e5%8f%8a%e4%b8%80%e4%ba%9b%e6%84%9f%e6%83%b3/</link>
		<comments>http://zhuwenhao.com/1020/%e6%8a%80%e6%9c%af/%e7%a8%8b%e5%ba%8f%e8%ae%be%e8%ae%a1%e8%af%ad%e8%a8%80/csharp-%e8%af%ad%e8%a8%80/c%e5%86%99%e7%9a%84%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e7%a8%8b%e5%ba%8f%e5%8f%8a%e4%b8%80%e4%ba%9b%e6%84%9f%e6%83%b3/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 14:17:34 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Csharp 语言]]></category>
		<category><![CDATA[自由软件社区]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=1020</guid>
		<description><![CDATA[前几天老婆想要一个自动关机的软件，这种小软件网上下载不是有广告就可能有病毒，或者觉得不好用。这么简单的软件，自己应该很容易写一个吧。首先用几分钟写出一个bat脚本。（脚本卖萌的地方，不要见笑哦）

View Code BASH1
2
3
4
5
6
7
8
9
10
11
12
13
14
@echo   off 
echo 自动关机程序，献给我亲爱的老婆！
echo 请输入需要关机的延迟时间。
echo 请先保存、关闭重要的程序，到时候会强制关机，不能后悔哦。
:again
echo 关机时间（秒）=
set /p SHUTDELAY=
echo 将在  [...]]]></description>
			<content:encoded><![CDATA[<p>前几天老婆想要一个自动关机的软件，这种小软件网上下载不是有广告就可能有病毒，或者觉得不好用。这么简单的软件，自己应该很容易写一个吧。首先用几分钟写出一个bat脚本。（脚本卖萌的地方，不要见笑哦）</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1020code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10202"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p1020code2"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">echo</span>   off 
<span style="color: #7a0874; font-weight: bold;">echo</span> 自动关机程序，献给我亲爱的老婆！
<span style="color: #7a0874; font-weight: bold;">echo</span> 请输入需要关机的延迟时间。
<span style="color: #7a0874; font-weight: bold;">echo</span> 请先保存、关闭重要的程序，到时候会强制关机，不能后悔哦。
:again
<span style="color: #7a0874; font-weight: bold;">echo</span> 关机时间（秒）=
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #000000; font-weight: bold;">/</span>p <span style="color: #007800;">SHUTDELAY</span>=
<span style="color: #7a0874; font-weight: bold;">echo</span> 将在 <span style="color: #000000; font-weight: bold;">%</span>SHUTDELAY<span style="color: #000000; font-weight: bold;">%</span>秒后关机，确认输入ok然后回车，取消请关闭本窗口。
<span style="color: #7a0874; font-weight: bold;">echo</span> 如果要重新输入关机时间，请按回车。
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #000000; font-weight: bold;">/</span>p <span style="color: #007800;">AGREE</span>=
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #ff0000;">&quot;%AGREE%&quot;</span>==<span style="color: #ff0000;">&quot;ok&quot;</span> shutdown <span style="color: #660033;">-f</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-t</span> <span style="color: #000000; font-weight: bold;">%</span>SHUTDELAY<span style="color: #000000; font-weight: bold;">%</span>  
<span style="color: #000000; font-weight: bold;">if</span> not <span style="color: #ff0000;">&quot;%AGREE%&quot;</span>==<span style="color: #ff0000;">&quot;ok&quot;</span> goto again
<span style="color: #7a0874; font-weight: bold;">echo</span> 老婆的命令已经生效了。请关闭本窗口。
pause<span style="color: #000000; font-weight: bold;">&gt;</span>nul</pre></td></tr></table></div>

<p>当然这样的脚本并不能充分显示老公的“手艺”，于是动手写一个窗体程序。本来可以用C++ MFC，但是想想也太没有挑战性了，顺便想体验一下高生产率的语言带来的好处（<a href="http://coolshell.cn/articles/6548.html" target="_blank">参考此文</a>），所以用C#写了一个小工具。大家可以到我的公开SVN上下载代码。代码基于GPL协议发布。</p>
<p>SVN地址： <a href="http://svn.zhu.im/just-for-fun/CsharpProjs/ShutdownMyPC/" target="_blank">http://svn.zhu.im/just-for-fun/CsharpProjs/ShutdownMyPC/</a></p>
<p>代码中依然有卖萌的地方，切勿拿来交作业什么的。:)</p>
<p>以下是运行界面：最小化后可以隐藏在系统托盘哦</p>
<p><a href="http://zhuwenhao.com/wp-content/uploads/2012/02/0ab98a874d62e780ff1bbf12bee64b12.jpeg"><img class="alignnone size-medium wp-image-1021" title="0ab98a874d62e780ff1bbf12bee64b12" src="http://zhuwenhao.com/wp-content/uploads/2012/02/0ab98a874d62e780ff1bbf12bee64b12-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>但是，这样一个东西在发布给用户（嗯，我老婆一个人）时，遇到了麻烦。原来她办公的电脑时很久很久没有更新的Windows XP，有没有.Net Framework不知道，但肯定没有.net framework 4. 于是想要制作一个安装程序，把framework集成到安装包里。结果，我没有找到任何可用的解决方法。如果按照微软标准做法，使用联机下载方式，那不联网的电脑怎么办？如果使用本地安装包，我本来数k字节的软件，瞬间变成数十M，size可是钱啊。不论时网络传输还是介质拷贝，文件一大什么方法都不优雅了。这简直就是悲剧。幸好，家里的Windows 7在我的悉心呵护下，长期保持自动更新，终于能用来给“客户”演示了。</p>
<p>另外一个感想就是，程序员真的需要坚持不懈的克服“程序员情结”。我写软件为了好玩，加入倒计时声音警告功能、加入了几种色彩警告，不仅没有得到“用户”好评，反而被批“弄那么麻烦干嘛”。是啊，KISS吧，你懂的。（不过我老婆会领会为另外一种意思，两者都很好）</p>
<p>附上exe程序，电脑中已经安装了.Net framework 4.0已经自己愿意且会安装的人可以下载来玩玩：</p>
<p><a href="http://zhuwenhao.com/wp-content/uploads/2012/02/ShutdownMyPC.exe">ShutdownMyPC</a></p>
<p>&nbsp;</p>
<p>下次我会用C++实现尽可能少依赖性的软件了。</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/1020/%e6%8a%80%e6%9c%af/%e7%a8%8b%e5%ba%8f%e8%ae%be%e8%ae%a1%e8%af%ad%e8%a8%80/csharp-%e8%af%ad%e8%a8%80/c%e5%86%99%e7%9a%84%e5%ae%9a%e6%97%b6%e5%85%b3%e6%9c%ba%e7%a8%8b%e5%ba%8f%e5%8f%8a%e4%b8%80%e4%ba%9b%e6%84%9f%e6%83%b3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>转载：理查德·斯托曼一直是对的</title>
		<link>http://zhuwenhao.com/995/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/%e8%bd%ac%e8%bd%bd%ef%bc%9a%e7%90%86%e6%9f%a5%e5%be%b7%c2%b7%e6%96%af%e6%89%98%e6%9b%bc%e4%b8%80%e7%9b%b4%e6%98%af%e5%af%b9%e7%9a%84/</link>
		<comments>http://zhuwenhao.com/995/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/%e8%bd%ac%e8%bd%bd%ef%bc%9a%e7%90%86%e6%9f%a5%e5%be%b7%c2%b7%e6%96%af%e6%89%98%e6%9b%bc%e4%b8%80%e7%9b%b4%e6%98%af%e5%af%b9%e7%9a%84/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 01:28:18 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[自由软件社区]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=995</guid>
		<description><![CDATA[

作者： 阮一峰
日期：  [...]]]></description>
			<content:encoded><![CDATA[<div>
<div>
<p>作者： <a href="http://www.ruanyifeng.com">阮一峰</a></p>
<p>日期： <a href="http://www.ruanyifeng.com/blog/2012/01/"><abbr title="2012-01-19T20:29:14+08:00">2012年1月19日</abbr></a></p>
</div>
</div>
<div id="main-content">
<div>
<p>所有反对<a href="http://www.ruanyifeng.com/blog/2012/01/why_sopa_is_evil.html" target="_blank">SOPA</a>的文章之中，有一篇的题目是<a href="http://www.osnews.com/story/25469/Richard_Stallman_Was_Right_All_Along" target="_blank">《理查德·斯托曼一直是对的》</a>，我印象最深。</p>
</div>
<div id="more">
<p>它指出，最近几个月，美国的公民自由严重倒退。先是<a href="http://en.wikipedia.org/wiki/National_Defense_Authorization_Act_for_Fiscal_Year_2012" target="_blank">《国防授权法案》</a>（NDAA）允许政府可以不经任何程序，无限期拘捕具有恐怖活动嫌疑的人；接着是参与”占领华尔街”运动的民众被污蔑成”恐怖分子”；现在又是SOPA，它企图通过控制传播渠道，来抑制信息的流通。</p>
<p><img src="http://zhuwenhao.com/wp-content/uploads/2012/02/bg2012011901.jpg" alt="" /></p>
<p>这些对公民自由的侵犯，不禁让人联想到，30年前的1983年，有一个叫做<a href="http://www.ruanyifeng.com/blog/2005/03/post_112.html" target="_blank">理查德·斯托曼</a>的程序员，声称<strong>“软件的自由，关系到人类的自由”</strong>。这个观点当时被认为荒唐偏激，但是现在来看，他担心的事情正在变成现实，他其实是对的。</p>
<p><img src="http://zhuwenhao.com/wp-content/uploads/2012/02/bg2012011902.jpg" alt="" /></p>
<p>很多人不赞成理查德·斯托曼，一部分原因是觉得他过于极端，是一个狂热的偏执症患者。比如，他仅有的个人电脑是一台<a href="http://www.lemote.com/en/products/Notebook/2010/0310/112.html" target="_blank">龙芯上网本</a>， 因为这是世界唯一的全部使用自由软件（Bios、硬件驱动、操作系统、应用软件）的电脑；他拒绝使用手机，因为手机的硬件和软件太封闭，使用某个品牌的手 机，几乎等同于接受某家公司的控制；甚至他的头发、他的胡子、他的服装，都让人们觉得这是一个怪人，大可不必理会他的观点。</p>
<p><img src="http://zhuwenhao.com/wp-content/uploads/2012/02/bg2012011903.jpg" alt="" /></p>
<p>他创立的<a href="http://www.fsf.org/" target="_blank">自由软件基金会</a>的主页上这样<a href="http://www.fsf.org/about/" target="_blank">写道</a>：</p>
<blockquote><p>“我们的社会正越来越依赖计算机，我们使用的软件对保证未来社会的自由至关重要。<strong>自由软件使我们能够控制我们使用的技术，让技术造福个人和社会，而不是让技术被商业公司或政府控制，用来限制或监视我们。</strong>”</p>
<p>(As our society grows more dependent on computers, the software we run is of critical importance to securing the future of a free society. Free software is about having control over the technology we use in our homes, schools and businesses, where computers work for our individual and communal benefit, not for proprietary software companies or governments who might seek to restrict and monitor us.)</p></blockquote>
<p>很长时间内，我也认为理查德·斯托曼太极端，对他说的”软件=自由”根本没有感觉，只是觉得自由软件可以免费使用，这点很不错。我从没想过，软件与 大公司的垄断、政府的独裁有什么关系，言论自由、公民权力，这些问题怎么会涉及到编程呢？任何时候，只要自由软件能让我不花钱就用上新功能，我就心满意足 了。</p>
<p>但是近几年来，随着《爱国者法案》、国家防火墙、实名制、SOPA这样的事情越来越多，我逐渐意识到，我是错的，理查德·斯托曼是对的。<strong>如今，政府控制人民不再需要警察和军队了，他们只需要控制软件和硬件就行了。</strong></p>
<p>电脑和网络技术，在现代社会中占据了至关重要的位置。控制了它们，就可以监视人们的一举一动、一言一行，等同于控制言论、思想、真理和权力。你或许 会说，面对面的交谈，就可以免受控制。错！想一想我们怎么安排见面？再想一想，我们身上的每一台设备都与网络相连，这意味着什么？</p>
<p>假设一个邪恶的政府与大资本家联手，企图剥夺人民的自由。只要自由软件存在，他们就不可能完全成功，因为代码和技术细节都是开放的，他们无法掩人耳 目，自由软件将是人民反抗的武器。反过来，如果没有自由软件，代码、协议、操作系统、硬件驱动、文件格式都是保密的，请问你怎么反抗呢？你拿什么反抗呢？ 根本不需要SOPA，你的自由早就在他人的控制之下了。</p>
<p>这就是斯托曼一直重复的警告，可惜大多数人都忽视了他的话，只从经济角度看待代码。直到有一天，代码与我们的自由紧密相关的时候，我们才开始醒悟。<strong>自由软件是抵抗邪恶政府、捍卫自由的武器。</strong>源码包含着力量，我们必须保证，它控制在自由的人们手里。</p>
<p>最终来说，自由软件与商业无关，它只关系到人类的自由。GPL许可证从来不反对用软件挣钱，它只反对你通过限制他人的自由来挣钱。在理查德·斯托曼看来，专有软件剥夺用户的自由，最终将导致灾难性的后果，高度依赖计算机的社会尤其如此。</p>
<p>如果你想推广你的代码，让更多的人使用，那么<a href="http://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html" target="_blank">BSD许可证</a>效果更好。但是，如果你想保证自由从此再不会消失、而是像雪球那样越滚越大，那么GPL许可证是最好的选择。</p>
<p>理查德·斯托曼在30年前，就意识到这一点。他忍受各种艰难困苦，绝不妥协，到处鼓吹自由软件的合理性和必要性。今天我们已经看清楚了，30年了，他一直是对的！</p>
<p>必须让大家明白，软件代码不仅仅是商业产品，更重要的，它是人类自由的一部分。如果我们要保卫自由，就必须支持自由软件。你可以使用闭源软件，但是你应该支持自由软件，因为没有它，就没有我们的自由，不仅未来如此，而且现在已经如此了。</p>
<p>（完）<span id="more-995"></span></p>
</div>
</div>
<div>
<h3>（原）文档信息</h3>
<ul>
<li>版权声明：自由转载-非商用-非衍生-保持署名 | <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh">Creative Commons BY-NC-ND 3.0</a></li>
<li>原文网址：<a href="http://www.ruanyifeng.com/blog/2012/01/richard_stallman_was_right_all_along.html">http://www.ruanyifeng.com/blog/2012/01/richard_stallman_was_right_all_along.html</a></li>
<li>最后修改时间：2012年2月 5日 21:32</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/995/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/%e8%bd%ac%e8%bd%bd%ef%bc%9a%e7%90%86%e6%9f%a5%e5%be%b7%c2%b7%e6%96%af%e6%89%98%e6%9b%bc%e4%b8%80%e7%9b%b4%e6%98%af%e5%af%b9%e7%9a%84/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>提供最新，最完整的Android源代码压缩包下载</title>
		<link>http://zhuwenhao.com/950/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/%e6%8f%90%e4%be%9b%e6%9c%80%e6%96%b0%ef%bc%8c%e6%9c%80%e5%ae%8c%e6%95%b4%e7%9a%84android%e6%ba%90%e4%bb%a3%e7%a0%81%e5%8e%8b%e7%bc%a9%e5%8c%85%e4%b8%8b%e8%bd%bd/</link>
		<comments>http://zhuwenhao.com/950/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/%e6%8f%90%e4%be%9b%e6%9c%80%e6%96%b0%ef%bc%8c%e6%9c%80%e5%ae%8c%e6%95%b4%e7%9a%84android%e6%ba%90%e4%bb%a3%e7%a0%81%e5%8e%8b%e7%bc%a9%e5%8c%85%e4%b8%8b%e8%bd%bd/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 17:02:22 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=950</guid>
		<description><![CDATA[我的Blog里，提供了几种Android源码下载的文章是最受欢迎的了。看来真的又很多人需要打包好的Android源码。
所以我会把自己一个服务器300G的硬盘空间中的大部分拿出来存储和分享Android源代码。如果你需要Android源代码，你可以去看看http://d.zhu.im/android/
如果你要链接到我的文件，最好能再页面上放置友情链接、说句谢谢之类的，我就很开心了。
除了再2011年10月24日以前生成的文件，是我手动产生的，所以会长期保留之外，建议你不要静态链接到源码压缩包，因为硬盘空间不够的时候，旧文件会被删除。我提供了符号链接，你查找名字类似  [...]]]></description>
			<content:encoded><![CDATA[<p>我的Blog里，提供了几种Android源码下载的文章是最受欢迎的了。看来真的又很多人需要打包好的Android源码。<br />
所以我会把自己一个服务器300G的硬盘空间中的大部分拿出来存储和分享Android源代码。如果你需要Android源代码，你可以去看看<a href="http://d.zhu.im/android/" target="_blank">http://d.zhu.im/android/</a><br />
如果你要链接到我的文件，最好能再页面上放置友情链接、说句谢谢之类的，我就很开心了。<br />
除了再2011年10月24日以前生成的文件，是我手动产生的，所以会长期保留之外，建议你不要静态链接到源码压缩包，因为硬盘空间不够的时候，旧文件会被删除。我提供了符号链接，你查找名字类似 “latest-android-&#8217;$VERSION-ID&#8217;.tar.gz”这样的文件，链接到他，可以指向最新同步好的文件。<br />
目前提供三个版本的源码包。<br />
如果你需要其他版本，请提供版本号。如何提供版本号？请先读一下我的自动更新脚本。<br />
我的300G服务器是CentOS的，没法容易地repo sync.所以我写了一个脚本运行在一个Ubuntu机器上。现在地想法是每周运行一次。这个周期是否需要调整，也看各位的反馈了。<br />
脚本如下：<br />
<span id="more-950"></span></p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p950code4'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9504"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
</pre></td><td class="code" id="p950code4"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">LOG_FILE</span>=tmp.output.log
<span style="color: #007800;">SVR_LOG</span>=~<span style="color: #000000; font-weight: bold;">/</span>log.reposync.log
<span style="color: #007800;">SYNC_DATE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">&quot;+%Y%m%d&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#rm -rf android-*</span>
make_latest_link <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #007800;">VER</span>=$<span style="color: #000000; font-weight: bold;">@</span>
        <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-sf</span> android-<span style="color: #007800;">$SYNC_DATE</span>-<span style="color: #007800;">$VER</span>.tar.bz2 latest-android-<span style="color: #007800;">$VER</span>.tar.bz2
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ln -sf android-<span style="color: #007800;">$SYNC_DATE</span>-<span style="color: #007800;">$VER</span>.tar.bz2 latest-android-<span style="color: #007800;">$VER</span>.tar.bz2&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        rsync <span style="color: #660033;">-l</span> latest-android-<span style="color: #007800;">$VER</span>.tar.bz2 d.zhu.im:<span style="color: #000000; font-weight: bold;">/</span>d<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;uploaded latest symbol link by rsync&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
f_check_log_err <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #007800;">ERR_NUM</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'error'</span> <span style="color: #007800;">$LOG_FILE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ERR_NUM</span>&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;
        <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Some Error occurred ERR_NUM=<span style="color: #007800;">$ERR_NUM</span>.&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
                <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-10</span> tmp.output.log <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;rm current folder&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
                <span style="color: #7a0874; font-weight: bold;">cd</span> ..
                <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #007800;">$FOLDER_NAME</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;quit in false&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
                <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
        <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;check tmp log PASS&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
upload_new_android <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #007800;">VERSION</span>=$<span style="color: #000000; font-weight: bold;">@</span>
        <span style="color: #007800;">FOLDER_NAME</span>=android-<span style="color: #007800;">$SYNC_DATE</span>-<span style="color: #007800;">$VERSION</span>
        <span style="color: #007800;">RUN_SH_DATE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">&quot;+%Y%m%d%H%M%S&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Sync start date and time: <span style="color: #007800;">$RUN_SH_DATE</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Working Repo version is <span style="color: #007800;">$VERSION</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #007800;">$FOLDER_NAME</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;mkdir <span style="color: #007800;">$FOLDER_NAME</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$FOLDER_NAME</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;repo init start&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        repo init <span style="color: #660033;">-u</span> https:<span style="color: #000000; font-weight: bold;">//</span>android.googlesource.com<span style="color: #000000; font-weight: bold;">/</span>platform<span style="color: #000000; font-weight: bold;">/</span>manifest <span style="color: #660033;">-b</span> android-<span style="color: #007800;">$VERSION</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$LOG_FILE</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        f_check_log_err <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;repo sync start&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        repo <span style="color: #c20cb9; font-weight: bold;">sync</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$LOG_FILE</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        f_check_log_err <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #7a0874; font-weight: bold;">cd</span> ..
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;tar start&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #c20cb9; font-weight: bold;">tar</span> cjf <span style="color: #007800;">$FOLDER_NAME</span>.tar.bz2 <span style="color: #007800;">$FOLDER_NAME</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;md5sum start&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        md5sum <span style="color: #007800;">$FOLDER_NAME</span>.tar.bz2 <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$FOLDER_NAME</span>.tar.bz2.md5.txt
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;sha1sum start&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        sha1sum <span style="color: #007800;">$FOLDER_NAME</span>.tar.bz2 <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$FOLDER_NAME</span>.tar.bz2.sha1.txt
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;upload start&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #c20cb9; font-weight: bold;">scp</span> <span style="color: #007800;">$FOLDER_NAME</span>.tar.bz2<span style="color: #000000; font-weight: bold;">*</span> d.zhu.im:<span style="color: #000000; font-weight: bold;">/</span>d<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #666666; font-style: italic;">#make latest symbol link and upload by rsync -l</span>
        make_latest_link <span style="color: #007800;">$VERSION</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;rm -rf <span style="color: #007800;">$FOLDER_NAME</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #007800;">$FOLDER_NAME</span><span style="color: #000000; font-weight: bold;">*</span>
        <span style="color: #007800;">RUN_SH_DATE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">&quot;+%Y%m%d%H%M%S&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;finished ALL at time: <span style="color: #007800;">$RUN_SH_DATE</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$SVR_LOG</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
upload_new_android 2.2.2_r1
upload_new_android <span style="color: #000000;">2.3</span>_r1
upload_new_android 2.3.7_r1</pre></td></tr></table></div>

<p>大家看到这里，应该知道版本号是什么意思了。如果你需要什么，请告诉我。</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/950/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/%e6%8f%90%e4%be%9b%e6%9c%80%e6%96%b0%ef%bc%8c%e6%9c%80%e5%ae%8c%e6%95%b4%e7%9a%84android%e6%ba%90%e4%bb%a3%e7%a0%81%e5%8e%8b%e7%bc%a9%e5%8c%85%e4%b8%8b%e8%bd%bd/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Android 2.3 Gingerbread 原版源代码压缩包下载</title>
		<link>http://zhuwenhao.com/831/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-2-3-gingerbread-%e5%8e%9f%e7%89%88%e6%ba%90%e4%bb%a3%e7%a0%81%e5%8e%8b%e7%bc%a9%e5%8c%85%e4%b8%8b%e8%bd%bd/</link>
		<comments>http://zhuwenhao.com/831/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-2-3-gingerbread-%e5%8e%9f%e7%89%88%e6%ba%90%e4%bb%a3%e7%a0%81%e5%8e%8b%e7%bc%a9%e5%8c%85%e4%b8%8b%e8%bd%bd/#comments</comments>
		<pubDate>Wed, 11 May 2011 08:48:45 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=831</guid>
		<description><![CDATA[此前已经发布过Android在PC平台上的源码压缩包下载（Android-x86-2.2, Android-x86-2.3），原因一样，repo sync的过程是痛苦而漫长的，甚至根本下不完整。我在美国的服务器上获取完整源代码后，压缩为gzip包，这样您就可以用下载工具下载了，可以多线程，可以断点续传，哦耶。
Android 2.3 Gingerbread 源代码 gzip压缩包
大小：3423434541  [...]]]></description>
			<content:encoded><![CDATA[<p>此前已经发布过Android在PC平台上的源码压缩包下载（<a href="http://zhuwenhao.com/718/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86-%e5%9f%ba%e4%ba%8e2-2%e7%89%88%e6%9c%ac%e7%9a%84froyo-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bdzip/" target="_blank">Android-x86-2.2</a>, <a href="http://zhuwenhao.com/760/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86%e5%9f%ba%e4%ba%8e2-3%e7%89%88%e6%9c%ac%e7%9a%84gingerbread-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bd/" target="_blank">Android-x86-2.3</a>），原因一样，repo sync的过程是痛苦而漫长的，甚至根本下不完整。我在美国的服务器上获取完整源代码后，压缩为gzip包，这样您就可以用下载工具下载了，可以多线程，可以断点续传，哦耶。</p>
<p><a href="http://zhuwenhao.com/download/android/android-2.3-20110510.tar.gz" target="_blank">Android 2.3 Gingerbread 源代码 gzip压缩包</a></p>
<p>大小：3423434541 字节</p>
<p><a href="http://zhuwenhao.com/download/android/android-2.3-20110510.tar.gz.md5" target="_blank">MD5校验</a>：96c359467e9f19ad0f2bcd5a4f218163</p>
<p><a href="http://zhuwenhao.com/download/android/android-2.3-20110510.tar.gz.sha1" target="_blank">SHA1校验</a>：1a3d1af403c02698d540e2204df095bd27b92199</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/831/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-2-3-gingerbread-%e5%8e%9f%e7%89%88%e6%ba%90%e4%bb%a3%e7%a0%81%e5%8e%8b%e7%bc%a9%e5%8c%85%e4%b8%8b%e8%bd%bd/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Android编译加入第三方动态链接库文件的方法</title>
		<link>http://zhuwenhao.com/824/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android%e7%bc%96%e8%af%91%e5%8a%a0%e5%85%a5%e7%ac%ac%e4%b8%89%e6%96%b9%e5%8a%a8%e6%80%81%e9%93%be%e6%8e%a5%e5%ba%93%e6%96%87%e4%bb%b6%e7%9a%84%e6%96%b9%e6%b3%95/</link>
		<comments>http://zhuwenhao.com/824/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android%e7%bc%96%e8%af%91%e5%8a%a0%e5%85%a5%e7%ac%ac%e4%b8%89%e6%96%b9%e5%8a%a8%e6%80%81%e9%93%be%e6%8e%a5%e5%ba%93%e6%96%87%e4%bb%b6%e7%9a%84%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Fri, 06 May 2011 08:46:55 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=824</guid>
		<description><![CDATA[如果你的代码不想随Android开源发布，或者你的代码用到了闭源的第三方库文件，你可以把需要的库动态链接到自己的程序中，修改Android.mk文件，让Android在打包二进制文件时把指定的.so文件放入系统目录下，以供dlopen使用。
下面是一个通用的示例文件，说明了修改Android.mk的方法。增加

View Code MAKEFILE1
MY_LOCAL_PATH := $(LOCAL_PATH)

的原因是

View Code MAKEFILE1
LOCAL_PATH := $(call  [...]]]></description>
			<content:encoded><![CDATA[<p>如果你的代码不想随Android开源发布，或者你的代码用到了闭源的第三方库文件，你可以把需要的库动态链接到自己的程序中，修改Android.mk文件，让Android在打包二进制文件时把指定的.so文件放入系统目录下，以供dlopen使用。</p>
<p>下面是一个通用的示例文件，说明了修改Android.mk的方法。增加</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p824code8'); return false;">View Code</a> MAKEFILE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p8248"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p824code8"><pre class="makefile" style="font-family:monospace;">MY_LOCAL_PATH := $(LOCAL_PATH)</pre></td></tr></table></div>

<p>的原因是</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p824code9'); return false;">View Code</a> MAKEFILE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p8249"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p824code9"><pre class="makefile" style="font-family:monospace;">LOCAL_PATH := $(call my-dir)</pre></td></tr></table></div>

<p>在一个.mk文件里只能出现一次。</p>
<p>示例文件在编译时，应该把libabc.so放到.mk同一个目录下。</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p824code10'); return false;">View Code</a> MAKEFILE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p82410"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p824code10"><pre class="makefile" style="font-family:monospace;">LOCAL_PATH := $(call my-dir)
MY_LOCAL_PATH := $(LOCAL_PATH)
include $(CLEAR_VARS)
&nbsp;
LOCAL_PREBUILT_LIBS := libabc.so
&nbsp;
include $(BUILD_MULTI_PREBUILT)
&nbsp;
LOCAL_PATH := $(MY_LOCAL_PATH)
include $(CLEAR_VARS)
&nbsp;
LOCAL_SRC_FILES := main.cpp
LOCAL_MODULE := mytest
LOCAL_SHARED_LIBRARIES := libabc
&nbsp;
include $(BUILD_EXECUTABLE)</pre></td></tr></table></div>

<p>感谢rktb，参考<a href="http://www.mail-archive.com/android-framework@googlegroups.com/msg00990.html" target="_blank">原文地址</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/824/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android%e7%bc%96%e8%af%91%e5%8a%a0%e5%85%a5%e7%ac%ac%e4%b8%89%e6%96%b9%e5%8a%a8%e6%80%81%e9%93%be%e6%8e%a5%e5%ba%93%e6%96%87%e4%bb%b6%e7%9a%84%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android-x86基于2.3版本的Gingerbread x86打包下载</title>
		<link>http://zhuwenhao.com/760/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86%e5%9f%ba%e4%ba%8e2-3%e7%89%88%e6%9c%ac%e7%9a%84gingerbread-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bd/</link>
		<comments>http://zhuwenhao.com/760/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86%e5%9f%ba%e4%ba%8e2-3%e7%89%88%e6%9c%ac%e7%9a%84gingerbread-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bd/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 05:58:44 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=760</guid>
		<description><![CDATA[几个月前的我发布了一个打包的Android Froyo版本,大受欢迎,有很多留言和访问. 参考该博文链接.
现在我发布一下打包好的Android 2.3 Gingerbread 版本的文件, 使用 tar -czf 参数打包. 可能依然无法在你的机器上 sync, 有需要更新版本的,请留言给我.
下载链接是:
Android 2.3  [...]]]></description>
			<content:encoded><![CDATA[<p>几个月前的我发布了一个打包的Android Froyo版本,大受欢迎,有很多留言和访问. 参考<a href="http://zhuwenhao.com/718/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86-%e5%9f%ba%e4%ba%8e2-2%e7%89%88%e6%9c%ac%e7%9a%84froyo-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bdzip/">该博文链接</a>.<br />
现在我发布一下打包好的Android 2.3 Gingerbread 版本的文件, 使用 tar -czf 参数打包. 可能依然无法在你的机器上 sync, 有需要更新版本的,请留言给我.<br />
下载链接是:<br />
Android 2.3 Gingerbread<br />
<a href="http://zhuwenhao.com/download/android-gingerbread-20110408.tar.gz">文件名android-gingerbread-20110408.tar.gz</a><br />
size:3446063892字节<br />
MD5:<a href="http://zhuwenhao.com/download/android-gingerbread-20110408.tar.gz.md5">fc225ab4dd1d3ef43849b0d5a5d45c54</a><br />
SHA1:<a href="http://zhuwenhao.com/download/android-gingerbread-20110408.tar.gz.sha1">4326d716bba5cb6c68e3969d20cca242b575deed</a></p>
<p>&nbsp;</p>
<p>提示：这个版本必须要在64位编译环境下编译，而目标版本是32位的时候，就要用交叉编译环境了，如果看到什么库不对的提示，请先检查64位系统下的32位编译器和链接库都是不是安装好了。</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/760/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86%e5%9f%ba%e4%ba%8e2-3%e7%89%88%e6%9c%ac%e7%9a%84gingerbread-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bd/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>解决Android-x86 Froyo版本鼠标移动过慢的方法 Fix Mouse Move Slow Issue in Froyo-x86</title>
		<link>http://zhuwenhao.com/731/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/%e8%a7%a3%e5%86%b3android-x86-froyo%e7%89%88%e6%9c%ac%e9%bc%a0%e6%a0%87%e7%a7%bb%e5%8a%a8%e8%bf%87%e6%85%a2%e7%9a%84%e6%96%b9%e6%b3%95-fix-mouse-move-slow-issue-in-froyo-x86/</link>
		<comments>http://zhuwenhao.com/731/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/%e8%a7%a3%e5%86%b3android-x86-froyo%e7%89%88%e6%9c%ac%e9%bc%a0%e6%a0%87%e7%a7%bb%e5%8a%a8%e8%bf%87%e6%85%a2%e7%9a%84%e6%96%b9%e6%b3%95-fix-mouse-move-slow-issue-in-froyo-x86/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 01:33:25 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=731</guid>
		<description><![CDATA[解决办法，编译的时候使用如下参数开启3D硬件加速，完美解决鼠标移动慢的问题，响应速度快了很多。
需要增加的参数： BOARD_USES_I915= BOARD_USES_I915C=true
编译命令： make usb_img BOARD_USES_I915= BOARD_USES_I915C=true TARGET_PRODUCT=eeepc
或：           make iso_img BOARD_USES_I915= BOARD_USES_I915C=true TARGET_PRODUCT=eeepc
Solving mouse move too slow problem in  [...]]]></description>
			<content:encoded><![CDATA[<p>解决办法，编译的时候使用如下参数开启3D硬件加速，完美解决鼠标移动慢的问题，响应速度快了很多。</p>
<p>需要增加的参数： BOARD_USES_I915= BOARD_USES_I915C=true</p>
<p>编译命令： make usb_img BOARD_USES_I915= BOARD_USES_I915C=true TARGET_PRODUCT=eeepc</p>
<p>或：           make iso_img BOARD_USES_I915= BOARD_USES_I915C=true TARGET_PRODUCT=eeepc</p>
<p>Solving mouse move too slow problem in froyo-x86 version of Android-x86. Append these parameters to enable 3D hardware acceleration in &#8216;make&#8217; command. System speed is busted!</p>
<p>Parameters add : BOARD_USES_I915= BOARD_USES_I915C=true</p>
<p>make command of usb image : make usb_img BOARD_USES_I915= BOARD_USES_I915C=true TARGET_PRODUCT=eeepc</p>
<p>make command of iso image  : make iso_img BOARD_USES_I915= BOARD_USES_I915C=true TARGET_PRODUCT=eeepc</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/731/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/%e8%a7%a3%e5%86%b3android-x86-froyo%e7%89%88%e6%9c%ac%e9%bc%a0%e6%a0%87%e7%a7%bb%e5%8a%a8%e8%bf%87%e6%85%a2%e7%9a%84%e6%96%b9%e6%b3%95-fix-mouse-move-slow-issue-in-froyo-x86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android-x86 基于2.2版本的froyo x86打包下载zip</title>
		<link>http://zhuwenhao.com/718/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86-%e5%9f%ba%e4%ba%8e2-2%e7%89%88%e6%9c%ac%e7%9a%84froyo-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bdzip/</link>
		<comments>http://zhuwenhao.com/718/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86-%e5%9f%ba%e4%ba%8e2-2%e7%89%88%e6%9c%ac%e7%9a%84froyo-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bdzip/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 00:59:16 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=718</guid>
		<description><![CDATA[Android-x86 使用repo sync直接从服务器建立和更新git库非常的不稳定，链接经常中断，搞了一星期也没有下载好。后来在服务器上直接下载，很快就同步好了，可见主要问题还是网络的国际出口不稳定造成的。然后在服务器端打成zip包下载，就快多了。
由于Android-x86.org组织不提供类似的下载，我就共享一下我制作好的zip包，sync日期是2010年11月28日。
下载包5G左右。
地址 ： http://zhuwenhao.com/download/android-froyo.zip
由于服务器资源有限，本下载不保证长期提供。
 Update:  [...]]]></description>
			<content:encoded><![CDATA[<p>Android-x86 使用repo sync直接从服务器建立和更新git库非常的不稳定，链接经常中断，搞了一星期也没有下载好。后来在服务器上直接下载，很快就同步好了，可见主要问题还是网络的国际出口不稳定造成的。然后在服务器端打成zip包下载，就快多了。</p>
<p>由于Android-x86.org组织不提供类似的下载，我就共享一下我制作好的zip包，sync日期是2010年11月28日。</p>
<p>下载包5G左右。</p>
<p><del datetime="2011-04-08T08:51:20+00:00">地址 ： http://zhuwenhao.com/download/android-froyo.zip</del></p>
<p>由于服务器资源有限，本下载不保证长期提供。</p>
<ul> <ins datetime="2011-04-08T09:04:45+00:00"><strong>Update: 本文件已删除,请下载下面的较新链接,硬盘没空间了,欢迎赞助 <img src='http://zhuwenhao.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong> </ins></ul>
<p>另请注意，以下文件有问题，会编译不通过。</p>
<p>frameworks/base/opengl/tests/gl_jni/jni/gl_code.cpp</p>
<p>解决的办法是在该文件的末尾加一个空行。如果先修改一下，就免得编译两遍了。</p>
<p>！更新！</p>
<p>2011年1月4日 repo sync 操作，重新打包。下载：</p>
<p><a title="android-froyo-2011-01-04.zip" href="http://zhuwenhao.com/download/android-froyo-2011-01-04.zip">android-froyo-2011-01-04.zip</a></p>
<p>这个版本我没有编译测试过，有问题请留言告知大家，谢谢。</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/718/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android-x86-%e5%9f%ba%e4%ba%8e2-2%e7%89%88%e6%9c%ac%e7%9a%84froyo-x86%e6%89%93%e5%8c%85%e4%b8%8b%e8%bd%bdzip/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Android编译C代码时链接其他库文件的方法(附make file详解手册)</title>
		<link>http://zhuwenhao.com/709/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android%e7%bc%96%e8%af%91c%e4%bb%a3%e7%a0%81%e6%97%b6%e9%93%be%e6%8e%a5%e5%85%b6%e4%bb%96%e5%ba%93%e6%96%87%e4%bb%b6%e7%9a%84%e6%96%b9%e6%b3%95%e9%99%84make-file%e8%af%a6%e8%a7%a3%e6%89%8b%e5%86%8c/</link>
		<comments>http://zhuwenhao.com/709/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android%e7%bc%96%e8%af%91c%e4%bb%a3%e7%a0%81%e6%97%b6%e9%93%be%e6%8e%a5%e5%85%b6%e4%bb%96%e5%ba%93%e6%96%87%e4%bb%b6%e7%9a%84%e6%96%b9%e6%b3%95%e9%99%84make-file%e8%af%a6%e8%a7%a3%e6%89%8b%e5%86%8c/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 16:13:47 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=709</guid>
		<description><![CDATA[Android的内核基本就是Linux。在Android-x86的代码基础上，可以编译自己的Android系统。
常常需要在自己的C代码里链接第三方提供的库文件，例如以.a文件提供。此时需要修改Android.mk文件来加进需要连接的库。LOCAL_LDLIBS不是做这个的，一个可行的方法是使用LOCAL_LDFLAGS通知编译器。例如
LOCAL_LDFLAGS -L$(LOCAL_PATH)  [...]]]></description>
			<content:encoded><![CDATA[<p>Android的内核基本就是Linux。在Android-x86的代码基础上，可以编译自己的Android系统。</p>
<p>常常需要在自己的C代码里链接第三方提供的库文件，例如以.a文件提供。此时需要修改Android.mk文件来加进需要连接的库。LOCAL_LDLIBS不是做这个的，一个可行的方法是使用LOCAL_LDFLAGS通知编译器。例如</p>
<blockquote><p>LOCAL_LDFLAGS -L$(LOCAL_PATH) -lxxxx</p></blockquote>
<p>其中xxxx是被链接模块的名字，不含后缀和前缀lib</p>
<p>注意-L后面使用相对路径似乎不行。</p>
<p>后面附上来自http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html</p>
<p>的Android系统makefile的文档，因为很难准确google到，转载记录一下。Android的资料水都太大了。</p>
<p><span id="more-709"></span>全文转载，as is.</p>
<h1><a name="My_Project_">Android Build System</a></h1>
<p><!-- Status is one of: Draft, Current, Needs Update, Obsolete --><a name="My_Project_"> <strong>Status:</strong> <em>Draft </em> <small>(as of May 18, 2006)</small> </a></p>
<p><a name="My_Project_"><strong>Contents</strong></a></p>
<p><!-- this div expands out to a list of contents based on the H2 and H3 headings. Believe it! --><a name="My_Project_"> </a></p>
<h2><a name="My_Project_">Objective</a></h2>
<p><a name="My_Project_">The primary goals of reworking the build system are (1) to make dependencies work more reliably, so that when files need to rebuilt, they are, and (2) to improve performance of the build system so that unnecessary modules are not rebuilt, and so doing a top-level build when little or nothing needs to be done for a build takes as little time as possible.</a></p>
<h2><a name="My_Project_">Principles and Use Cases and Policy</a></h2>
<p><a name="My_Project_">Given the above objective, these are the overall principles and use cases that we will support.  This is not an exhaustive list.</a></p>
<h3><a name="My_Project_">Multiple Targets</a></h3>
<p><a name="My_Project_">It needs to be possible to build the Android platform for multiple targets. This means:</a></p>
<ul><a name="My_Project_"> </a></p>
<li><a name="My_Project_">The build system will support building tools for the host platform,     both ones that are used in the build process itself, and developer tools     like the simulator.</a></li>
<p><a name="My_Project_"> </a></p>
<li><a name="My_Project_">The build system will need to be able to build tools on Linux     (definitely Goobuntu and maybe Grhat), MacOS, and to some degree on     Windows.</a></li>
<p><a name="My_Project_"> </a></p>
<li><a name="My_Project_">The build system will need to be able to build the OS on Linux, and in     the short-term, MacOS.  Note that this is a conscious decision to stop     building the OS on Windows.  We are going to rely on the emulator there     and not attempt to use the simulator.  This is a requirement change now     that the emulator story is looking brighter.</a></li>
</ul>
<h3><a name="My_Project_">Non-Recursive Make</a></h3>
<p><a name="My_Project_">To achieve the objectives, the build system will be rewritten to use make non-recursively.  For more background on this, read </a><a href="http://aegis.sourceforge.net/auug97.pdf">Recursive Make Considered Harmful</a>.  For those that don&#8217;t want PDF, here is the <a href="http://72.14.203.104/search?q=cache:HwuX7YF2uBIJ:aegis.sourceforge.net/auug97.pdf&amp;hl=en&amp;gl=us&amp;ct=clnk&amp;cd=2&amp;client=firefox">Google translated version</a>.</p>
<h3>Rapid Compile-Test Cycles</h3>
<p>When developing a component, for example a C++ shared library, it must be possible to easily rebuild just that component, and not have to wait more than a couple seconds for dependency checks, and not have to wait for unneeded components to be built.</p>
<h3>Both Environment and Config File Based Settings</h3>
<p>To set the target, and other options, some people on the team like to have a configuration file in a directory so they do not have an environment setup script to run, and others want an environment setup script to run so they can run builds in different terminals on the same tree, or switch back and forth in one terminal.  We will support both.</p>
<h3>Object File Directory / make clean</h3>
<p>Object files and other intermediate files will be generated into a directory that is separate from the source tree.  The goal is to have make clean be “rm -rf ” in the tree root directory.  The primary goals of this are to simplify searching the source tree, and to make “make clean” more reliable.</p>
<h3>SDK</h3>
<p>The SDK will be a tarball that will allow non-OS-developers to write apps. The apps will actually be built by first building the SDK, and then building the apps against that SDK.  This will hopefully (1) make writing apps easier for us, because we won&#8217;t have to rebuild the OS as much, and we can use the standard java-app development tools, and (2) allow us to dog-food the SDK, to help ensure its quality.  Cedric has suggested (and I agree) that apps built from the SDK should be built with ant.  Stay tuned for more details as we figure out exactly how this will work.</p>
<h3>Dependecies</h3>
<p>Dependencies should all be automatic.  Unless there is a custom tool involved (e.g. the webkit has several), the dependencies for shared and static libraries, .c, .cpp, .h, .java, java libraries, etc., should all work without intervention in the Android.mk file.</p>
<h3>Hiding command lines</h3>
<p>The default of the build system will be to hide the command lines being executed for make steps.  It will be possible to override this by specifying the showcommands pseudo-target, and possibly by setting an environment variable.</p>
<h3>Wildcard source files</h3>
<p>Wildcarding source file will be discouraged.  It may be useful in some scenarios.  The default <code>$(wildcard *)</code> will not work due to the current directory being set to the root of the build tree.</p>
<h3>Multiple targets in one directory</h3>
<p>It will be possible to generate more than one target from a given subdirectory.  For example, libutils generates a shared library for the target and a static library for the host.</p>
<h3>Makefile fragments for modules</h3>
<p><strong>Android.mk</strong> is the standard name for the makefile fragments that control the building of a given module.  Only the top directory should have a file named “Makefile”.</p>
<h3>Use shared libraries</h3>
<p>Currently, the simulator is not built to use shared libraries.  This should be fixed, and now is a good time to do it.  This implies getting shared libraries to work on Mac OS.</p>
<h2>Nice to Have</h2>
<p>These things would be nice to have, and this is a good place to record them, however these are not promises.</p>
<h3>Simultaneous Builds</h3>
<p>The hope is to be able to do two builds for different combos in the same tree at the same time, but this is a stretch goal, not a requirement. Doing two builds in the same tree, not at the same time must work.  (update: it&#8217;s looking like we&#8217;ll get the two builds at the same time working)</p>
<h3>Deleting headers (or other dependecies)</h3>
<p>Problems can arise if you delete a header file that is referenced in “.d” files.  The easy way to deal with this is “make clean”.  There should be a better way to handle it. (from fadden)</p>
<p>One way of solving this is introducing a dependency on the directory.  The problem is that this can create extra dependecies and slow down the build. It&#8217;s a tradeoff.</p>
<h3>Multiple builds</h3>
<p>General way to perform builds across the set of known platforms.  This would make it easy to perform multiple platform builds when testing a change, and allow a wide-scale “make clean”.  Right now the buildspec.mk or environment variables need to be updated before each build. (from fadden)</p>
<h3>Aftermarket Locales and Carrier</h3>
<p>We will eventually need to add support for creating locales and carrier customizations to the SDK, but that will not be addressed right now.</p>
<h2><a id="usage">Usage</a></h2>
<p><a id="usage">You&#8217;ve read (or scrolled past) all of the motivations for this build system, and you want to know how to use it.  This is the place.</a></p>
<h3><a id="usage">Your first build</a></h3>
<p><a id="usage">The </a><a href="http://android.git.kernel.org/building.html">Building</a> document describes how do do builds.</p>
<h3>build/envsetup.sh functions</h3>
<p>If you source the file build/envsetup.sh into your bash environment, <code>. build/envsetup.sh</code>you&#8217;ll get a few helpful shell functions:</p>
<ul>
<li><strong>printconfig</strong> &#8211; Prints the current configuration as set by the lunch and choosecombo commands.</li>
<li><strong>m</strong> &#8211; Runs <code>make</code> from the top of the tree.  This is useful because you can run make from within subdirectories.  If you have the <code>TOP</code> environment variable set, it uses that.  If you don&#8217;t, it looks up the tree from the current directory, trying to find the top of the tree.</li>
<li><strong>croot</strong> &#8211; <code>cd</code> to the top of the tree.</li>
<li><strong>sgrep</strong> &#8211; grep for the regex you provide in all .c, .cpp, .h, .java, and .xml files below the current directory.</li>
</ul>
<h3>Build flavors/types</h3>
<p>When building for a particular product, it&#8217;s often useful to have minor variations on what is ultimately the final release build.  These are the currently-defined “flavors” or “types” (we need to settle on a real name for these).</p>
<table border="1">
<tbody>
<tr>
<td><code>eng<code> </code></code></td>
<td>This is the default flavor. A plain “<code>make</code>” is the         same as “<code>make eng</code>“.  <code>droid</code> is an alias         for <code>eng</code>.</p>
<ul>
<li>Installs modules tagged with: <code>eng</code>, <code>debug</code>,             <code>shell_</code>$(TARGET_SHELL),             <code>user</code>, and/or <code>development</code>.</li>
<li>Installs non-APK modules that have no tags specified.</li>
<li>Installs APKs according to the product definition files, in             addition to tagged APKs.</li>
<li><code>ro.secure=0</code></li>
<li><code>ro.debuggable=1</code></li>
<li><code>ro.kernel.android.checkjni=1</code></li>
<li><code>adb</code> is enabled by default.</li>
</ul>
</td>
</tr>
<tr>
<td><code>user<code> </code></code></td>
<td>“<code>make user</code>“This is the flavor intended to be the final release bits.</p>
<ul>
<li>Installs modules tagged with <code>shell_</code>$(TARGET_SHELL) and <code>user</code>.</li>
<li>Installs non-APK modules that have no tags specified.</li>
<li>Installs APKs according to the product definition files; tags             are ignored for APK modules.</li>
<li><code>ro.secure=1</code></li>
<li><code>ro.debuggable=0</code></li>
<li><code>adb</code> is disabled by default.</li>
</ul>
</td>
</tr>
<tr>
<td><code>userdebug<code> </code></code></td>
<td>“<code>make userdebug</code>“The same as <code>user</code>, except:</p>
<ul>
<li>Also installs modules tagged with <code>debug</code>.</li>
<li><code>ro.debuggable=1</code></li>
<li><code>adb</code> is enabled by default.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>If you build one flavor and then want to build another, you should run “<code>make installclean</code>” between the two makes to guarantee that you don&#8217;t pick up files installed by the previous flavor.  “<code>make clean</code>” will also suffice, but it takes a lot longer.</p>
<h3>More pseudotargets</h3>
<p>Sometimes you want to just build one thing.  The following pseudotargets are there for your convenience:</p>
<ul>
<li><strong>droid</strong> &#8211; <code>make droid</code> is the normal build.  This target is here because the default target has to have a name.</li>
<li><strong>all</strong> &#8211; <code>make all</code> builds everything <code>make droid</code> does, plus everything whose <code>LOCAL_MODULE_TAGS</code> do not include the “droid” tag.  The build server runs this to make sure that everything that is in the tree and has an Android.mk builds.</li>
<li><strong>clean-$(LOCAL_MODULE)</strong> and <strong>clean-$(LOCAL_PACKAGE_NAME)</strong> &#8211;  Let you selectively clean one target.  For example, you can type <code>make clean-libutils</code> and it will delete libutils.so and all of the intermediate files, or you can type <code>make clean-Home</code> and it will clean just the Home app.</li>
<li><strong>clean</strong> &#8211; <code>make clean</code> deletes all of the output and intermediate files for this configuration.  This is the same as <code>rm -rf out/&lt;configuration&gt;/</code></li>
<li><strong>clobber</strong> &#8211; <code>make clobber</code> deletes all of the output and intermediate files for all configurations.  This is the same as <code>rm -rf out/</code>.</li>
<li><strong>dataclean</strong> &#8211; <code>make dataclean</code> deletes contents of the data  directory inside the current combo directory.  This is especially useful on the simulator and emulator, where the persistent data remains present between  builds.</li>
<li><strong>showcommands</strong> &#8211; <code>showcommands</code> is a modifier target which causes the build system to show the actual command lines for the build steps, instead of the brief descriptions.  Most people don&#8217;t like seeing the actual commands, because they&#8217;re quite long and hard to read, but if you need to for debugging purposes, you can add <code>showcommands</code> to the list of targets you build.  For example <code>make showcommands</code> will build the default android configuration, and <code>make runtime showcommands</code> will build just the runtime, and targets that it depends on, while displaying the full command lines.  Please note that there are a couple places where the commands aren&#8217;t shown here.  These are considered bugs, and should be fixed, but they&#8217;re often hard to track down.  Please let <a href="mailto:android-build-team">android-build-team</a> know if you find any.</li>
<li><strong>LOCAL_MODULE</strong> &#8211; Anything you specify as a <code>LOCAL_MODULE</code> in an Android.mk is made into a pseudotarget.  For example, <code>make runtime</code> might be shorthand for <code>make out/linux-x86-debug/system/bin/runtime</code> (which would work), and <code>make libkjs</code> might be shorthand for <code>make out/linux-x86-debug/system/lib/libkjs.so</code> (which would also work).</li>
<li><strong>targets</strong> &#8211; <code>make targets</code> will print a list of all of the LOCAL_MODULE names you can make.</li>
</ul>
<h3><a name="templates">How to add another component to the build &#8211; Android.mk templates</a></h3>
<p><a name="templates">You have a new library, a new app, or a new executable.  For each of the common types of modules, there is a corresponding file in the templates directory.  It will usually be enough to copy one of these, and fill in your own values.  Some of the more esoteric values are not included in the templates, but are instead just documented here, as is the documentation on using custom tools to generate files.</a></p>
<p><a name="templates">Mostly, you can just look for the TODO comments in the templates and do what it says.  Please remember to delete the TODO comments when you&#8217;re done to keep the files clean.  The templates have minimal documentation in them, because they&#8217;re going to be copied, and when that gets stale, the copies just won&#8217;t get updated.  So read on&#8230;</a></p>
<h4><a name="templates">Apps</a></h4>
<p><a name="templates">Use the <code>templates/apps</code> file.</a></p>
<p><a name="templates">This template is pretty self-explanitory.  See the variables below for more details.</a></p>
<h4><a name="templates">Java Libraries</a></h4>
<p><a name="templates">Use the <code>templates/java_library</code> file.</a></p>
<p><a name="templates">The interesting thing here is the value of LOCAL_MODULE, which becomes the name of the jar file.  (Actually right now, we&#8217;re not making jar files yet, just directories of .class files,  but the directory is named according to what you put in LOCAL_MODULE).  This name will be what goes in the  LOCAL_JAVA_LIBRARIES variable in modules that depend on your java library.</a></p>
<h4><a name="templates">C/C++ Executables</a></h4>
<p><a name="templates">Use the <code>templates/executable</code> file, or the <code>templates/executable_host</code> file.</a></p>
<p><a name="templates">This template has a couple extra options that you usually don&#8217;t need. Please delete the ones you don&#8217;t need, and remove the TODO comments.  It makes the rest of them easier to read, and you can always refer back to the templates if you need them again later.</a></p>
<p><a name="templates">By default, on the target these are built into /system/bin, and on the host, they&#8217;re built into /host/bin.  These can be overridden by setting <code>LOCAL_MODULE_PATH</code>.  See </a><a href="http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html#moving-targets">Putting targets elsewhere</a> for more.</p>
<h4>Shared Libraries</h4>
<p>Use the <code>templates/shared_library</code> file, or the <code>templates/shared_library_host</code> file.</p>
<p>Remember that on the target, we use shared libraries, and on the host, we use static libraries, since executable size isn&#8217;t as big an issue, and it simplifies distribution in the SDK.</p>
<h4>Static Libraries</h4>
<p>Use the <code>templates/static_library</code> file, or the <code>templates/static_library_host</code> file.</p>
<p>Remember that on the target, we use shared libraries, and on the host, we use static libraries, since executable size isn&#8217;t as big an issue, and it simplifies distribution in the SDK.</p>
<h4><a name="custom-tools">Using Custom Tools</a></h4>
<p><a name="custom-tools">If you have a tool that generates source files for you, it&#8217;s possible to have the build system get the dependencies correct for it.  Here are a couple of examples.  <code>$@</code> is the make built-in variable for “the current target.” The <span style="color: red;">red</span> parts are the parts you&#8217;ll need to change.</a></p>
<p><a name="custom-tools">You need to put this after you have declared <code>LOCAL_PATH</code> and <code>LOCAL_MODULE</code>, because the <code>$(local-intermediates-dir)</code> and <code>$(local-host-intermediates-dir)</code> macros use these variables to determine where to put the files. </a></p>
<h5><a name="custom-tools">Example 1</a></h5>
<p><a name="custom-tools">Here, there is one generated file, called chartables.c, which doesn&#8217;t depend on anything.  And is built by the tool built to $(HOST_OUT_EXECUTABLES)/dftables.  Note on the second to last line that a dependency is created on the tool.</a></p>
<pre><a name="custom-tools">intermediates:= $(local-intermediates-dir)
GEN := $(intermediates)/<span style="color: red;">chartables.c</span>
$(GEN): PRIVATE_CUSTOM_TOOL = <span style="color: red;">$(HOST_OUT_EXECUTABLES)/dftables $@</span>
$(GEN): <span style="color: red;">$(HOST_OUT_EXECUTABLES)/dftables</span>
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
</a></pre>
<h5><a name="custom-tools">Example 2</a></h5>
<p><a name="custom-tools">Here as a hypothetical example, we use use cat as if it were to transform a file.  Pretend that it does something useful.  Note how we use a target-specific variable called PRIVATE_INPUT_FILE to store the name of the input file.</a></p>
<pre><a name="custom-tools">intermediates:= $(local-intermediates-dir)
GEN := $(intermediates)/<span style="color: red;">file.c</span>
$(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/<span style="color: red;">input.file</span>
$(GEN): PRIVATE_CUSTOM_TOOL = <span style="color: red;">cat $(PRIVATE_INPUT_FILE) &gt; $@</span>
$(GEN): <span style="color: red;">$(LOCAL_PATH)/file.c</span>
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
</a></pre>
<h5><a name="custom-tools">Example 3</a></h5>
<p><a name="custom-tools">If you have several files that are all similar in name, and use the same tool, you can combine them.  (here the *.lut.h files are the generated ones, and the *.cpp files are the input files)</a></p>
<pre><a name="custom-tools">intermediates:= $(local-intermediates-dir)
GEN := $(addprefix $(intermediates)<span style="color: red;">/kjs/, \
            array_object.lut.h \
            bool_object.lut.h \</span>
        )
$(GEN): PRIVATE_CUSTOM_TOOL = <span style="color: red;">perl libs/WebKitLib/WebKit/JavaScriptCore/kjs/create_hash_table $&lt; -i &gt; $@</span>
$(GEN): $(intermediates)/<span style="color: red;">%.lut.h</span> : $(LOCAL_PATH)/<span style="color: red;">%.cpp</span>
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
</a></pre>
<h3><a name="platform-specific">Platform specific conditionals</a></h3>
<p><a name="platform-specific">Sometimes you need to set flags specifically for different platforms.  Here is a list of which values the different build-system defined variables will be set to and some examples.</a></p>
<p><a name="platform-specific">For a device build, <code>TARGET_OS</code> is <code>linux</code> (we&#8217;re using linux!), and <code>TARGET_ARCH</code> is <code>arm</code>.</a></p>
<p><a name="platform-specific">For a simulator build, <code>TARGET_OS</code> and <code>TARGET_ARCH</code> are set to the same as <code>HOST_OS</code> and <code>HOST_ARCH</code> are on your platform.  <code>TARGET_PRODUCT</code> is the name of the target hardware/product you are building for.  The value <code>sim</code> is used for the simulator.  We haven&#8217;t thought through the full extent of customization that will happen here, but likely there will be additional UI configurations specified here as well.</a></p>
<table cellspacing="25">
<tbody>
<tr>
<td align="center" valign="top"><strong>HOST_OS</strong><br />
linux<br />
darwin<br />
(cygwin)</td>
<td align="center" valign="top"><strong>HOST_ARCH</strong><br />
x86</td>
<td align="center" valign="top"><strong>HOST_BUILD_TYPE</strong><br />
release<br />
debug</td>
</tr>
<tr>
<td align="center" valign="top"><strong>TARGET_OS</strong><br />
linux<br />
darwin<br />
(cygwin)</td>
<td align="center" valign="top"><strong>TARGET_ARCH</strong><br />
arm<br />
x86</td>
<td align="center" valign="top"><strong>TARGET_BUILD_TYPE</strong><br />
release<br />
debug</td>
<td align="center" valign="top"><strong>TARGET_PRODUCT</strong><br />
sim<br />
dream<br />
sooner</td>
</tr>
</tbody>
</table>
<h4><a name="platform-specific">TARGET_SIMULATOR</a></h4>
<p><a name="platform-specific">If we&#8217;re building the simulator, as opposed to the arm or emulator builds, <code>TARGET_SIMULATOR</code> will be set to <code>true</code>. </a></p>
<h4><a name="platform-specific">Some Examples</a></h4>
<pre><a name="platform-specific">ifeq ($(TARGET_SIMULATOR),true)
LOCAL_CFLAGS += -DSIMULATOR
endif

ifeq ($(TARGET_BUILD_TYPE),release)
LOCAL_CFLAGS += -DNDEBUG=1
endif

# from libutils
ifeq ($(TARGET_OS),linux)
# Use the futex based mutex and condition variable
# implementation from android-arm because it's shared mem safe
LOCAL_SRC_FILES += futex_synchro.c
LOCAL_LDLIBS += -lrt -ldl
endif

</a></pre>
<h3><a name="moving-modules">Putting modules elsewhere</a></h3>
<p><a name="moving-modules">If you have modules that normally go somewhere, and you need to have them build somewhere else, read this.  One use of this is putting files on the root filesystem instead of where they normally go in /system. Add these lines to your Android.mk:</a></p>
<pre><a name="moving-modules">LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
</a></pre>
<p><a name="moving-modules">For executables and libraries, you need to also specify a <code>LOCAL_UNSTRIPPED_PATH</code> location, because on target builds, we keep the unstripped executables so GDB can find the symbols. </a></p>
<p><a name="moving-modules">Look in <code>config/envsetup.make</code> for all of the variables defining places to build things.</a></p>
<p><a name="moving-modules">FYI: If you&#8217;re installing an executable to /sbin, you probably also want to set <code>LOCAL_FORCE_STATIC_EXCUTABLE := true</code> in your Android.mk, which will force the linker to only accept static libraries.</a></p>
<h3><a name="moving-modules">Android.mk variables</a></h3>
<p><a name="moving-modules">These are the variables that you&#8217;ll commonly see in Android.mk files, listed alphabetically.</a></p>
<p><a name="moving-modules">But first, a note on variable naming: </a></p>
<ul><a name="moving-modules"> </a></p>
<li><a name="moving-modules"><strong>LOCAL_</strong> &#8211; These variables are set per-module.  They are cleared     by the <code>include $(CLEAR_VARS)</code> line, so you can rely on them     being empty after including that file.  Most of the variables you&#8217;ll use     in most modules are LOCAL_ variables.</a></li>
<p><a name="moving-modules"> </a></p>
<li><a name="moving-modules"><strong>PRIVATE_</strong> &#8211; These variables are make-target-specific variables.  That     means they&#8217;re only usable within the commands for that module.  It also     means that they&#8217;re unlikely to change behind your back from modules that     are included after yours.  This </a><a href="http://www.gnu.org/software/make/manual/make.html#Target_002dspecific">link to the make documentation</a> describes more about target-specific variables.  Please note that there     are a couple of these laying around the tree that aren&#8217;t prefixed with     PRIVATE_.  It is safe, and they will be fixed as they are discovered.     Sorry for the confusion.</li>
<li><strong>INTERNAL_</strong> &#8211; These variables are critical to functioning of     the build system, so you shouldn&#8217;t create variables named like this, and     you probably shouldn&#8217;t be messing with these variables in your makefiles.</li>
<li><strong>HOST_</strong> and <strong>TARGET_</strong> &#8211; These contain the directories     and definitions that are specific to either the host or the target builds.     Do not set variables that start with HOST_ or TARGET_ in your makefiles.</li>
<li><strong>BUILD_</strong> and <strong>CLEAR_VARS</strong> &#8211; These contain the names of     well-defined template makefiles to include.  Some examples are CLEAR_VARS     and BUILD_HOST_PACKAGE.</li>
<li>Any other name is fair-game for you to use in your Android.mk.  However,     remember that this is a non-recursive build system, so it is possible that     your variable will be changed by another Android.mk included later, and be     different when the commands for your rule / module are executed.</li>
</ul>
<h4>LOCAL_ASSET_FILES</h4>
<p>In Android.mk files that <code>include $(BUILD_PACKAGE)</code> set this to the set of files you want built into your app.  Usually:</p>
<p><code>LOCAL_ASSET_FILES += $(call find-subdir-assets)</code></p>
<p>This will probably change when we switch to ant for the apps&#8217; build system.</p>
<h4>LOCAL_CC</h4>
<p>If you want to use a different C compiler for this module, set LOCAL_CC to the path to the compiler.  If LOCAL_CC is blank, the appropriate default compiler is used.</p>
<h4>LOCAL_CXX</h4>
<p>If you want to use a different C++ compiler for this module, set LOCAL_CXX to the path to the compiler.  If LOCAL_CXX is blank, the appropriate default compiler is used.</p>
<h4>LOCAL_CFLAGS</h4>
<p>If you have additional flags to pass into the C or C++ compiler, add them here.  For example:</p>
<p><code>LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1</code></p>
<h4>LOCAL_CPPFLAGS</h4>
<p>If you have additional flags to pass into <em>only</em> the C++ compiler, add them here.  For example:</p>
<p><code>LOCAL_CPPFLAGS += -ffriend-injection</code></p>
<p><code>LOCAL_CPPFLAGS</code> is guaranteed to be after <code>LOCAL_CFLAGS</code> on the compile line, so you can use it to override flags listed in <code>LOCAL_CFLAGS</code>.</p>
<h4>LOCAL_CPP_EXTENSION</h4>
<p>If your C++ files end in something other than “<code>.cpp</code>“, you can specify the custom extension here.  For example:</p>
<p><code>LOCAL_CPP_EXTENSION := .cc</code></p>
<p>Note that all C++ files for a given module must have the same extension; it is not currently possible to mix different extensions.</p>
<h4>LOCAL_NO_DEFAULT_COMPILER_FLAGS</h4>
<p>Normally, the compile line for C and C++ files includes global include paths and global cflags.  If <code>LOCAL_NO_DEFAULT_COMPILER_FLAGS</code> is non-empty, none of the default includes or flags will be used when compiling C and C++ files in this module. <code>LOCAL_C_INCLUDES</code>, <code>LOCAL_CFLAGS</code>, and <code>LOCAL_CPPFLAGS</code> will still be used in this case, as will any <code>DEBUG_CFLAGS</code> that are defined for the module.</p>
<h4>LOCAL_COPY_HEADERS</h4>
<p>This will be going away.</p>
<p>The set of files to copy to the install include tree.  You must also supply <code>LOCAL_COPY_HEADERS_TO</code>.</p>
<p>This is going away because copying headers messes up the error messages, and may lead to people editing those headers instead of the correct ones.  It also makes it easier to do bad layering in the system, which we want to avoid.  We also aren&#8217;t doing a C/C++ SDK, so there is no ultimate requirement to copy any headers.</p>
<h4>LOCAL_COPY_HEADERS_TO</h4>
<p>This will be going away.</p>
<p>The directory within “include” to copy the headers listed in <code>LOCAL_COPY_HEADERS</code> to.</p>
<p>This is going away because copying headers messes up the error messages, and may lead to people editing those headers instead of the correct ones.  It also makes it easier to do bad layering in the system, which we want to avoid.  We also aren&#8217;t doing a C/C++ SDK, so there is no ultimate requirement to copy any headers.</p>
<h4>LOCAL_C_INCLUDES</h4>
<p>Additional directories to instruct the C/C++ compilers to look for header files in.  These paths are rooted at the top of the tree.  Use <code>LOCAL_PATH</code> if you have subdirectories of your own that you want in the include paths.  For example:</p>
<p><code> LOCAL_C_INCLUDES += extlibs/zlib-1.2.3<br />
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src </code></p>
<p>You should not add subdirectories of include to <code>LOCAL_C_INCLUDES</code>, instead you should reference those files in the <code>#include</code> statement with their subdirectories.  For example:</p>
<p><code>#include &lt;utils/KeyedVector.h&gt;</code><br />
not <code>#include &lt;KeyedVector.h&gt;</code></p>
<p>There are some components that are doing this wrong, and should be cleaned up.</p>
<h4>LOCAL_MODULE_TAGS</h4>
<p>Set <code>LOCAL_MODULE_TAGS</code> to any number of whitespace-separated tags.  If the tag list is empty or contains <code>droid</code>, the module will get installed as part of a <code>make droid</code>.  Modules with the tag <code>shell_</code>$(TARGET_SHELL) will also be installed. Otherwise, it will only get installed by running <code>make &lt;your-module&gt;</code> or with the <code>make all</code> pseudotarget.</p>
<h4>LOCAL_REQUIRED_MODULES</h4>
<p>Set <code>LOCAL_REQUIRED_MODULES</code> to any number of whitespace-separated module names, like “libblah” or “Email”.  If this module is installed, all of the modules that it requires will be installed as well.  This can be used to, e.g., ensure that necessary shared libraries or providers are installed when a given app is installed.</p>
<h4>LOCAL_FORCE_STATIC_EXECUTABLE</h4>
<p>If your executable should be linked statically, set  <code>LOCAL_FORCE_STATIC_EXECUTABLE:=true</code>.  There is a very short list of libraries that we have in static form (currently only libc).  This is really only used for executables in /sbin on the root filesystem.</p>
<h4>LOCAL_GENERATED_SOURCES</h4>
<p>Files that you add to <code>LOCAL_GENERATED_SOURCES</code> will be automatically generated and then linked in when your module is built. See the <a href="http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html#custom-tools">Custom Tools</a> template makefile for an example.</p>
<h4>LOCAL_JAVACFLAGS</h4>
<p>If you have additional flags to pass into the javac compiler, add them here.  For example:</p>
<p><code>LOCAL_JAVACFLAGS += -Xlint:deprecation</code></p>
<h4>LOCAL_JAVA_LIBRARIES</h4>
<p>When linking Java apps and libraries, <code>LOCAL_JAVA_LIBRARIES</code> specifies which sets of java classes to include.  Currently there are two of these: <code>core</code> and <code>framework</code>. In most cases, it will look like this:</p>
<p><code>LOCAL_JAVA_LIBRARIES := core framework</code></p>
<p>Note that setting <code>LOCAL_JAVA_LIBRARIES</code> is not necessary (and is not allowed) when building an APK with “<code>include $(BUILD_PACKAGE)</code>“.  The appropriate libraries will be included automatically.</p>
<h4>LOCAL_LDFLAGS</h4>
<p>You can pass additional flags to the linker by setting <code>LOCAL_LDFLAGS</code>.  Keep in mind that the order of parameters is very important to ld, so test whatever you do on all platforms.</p>
<h4>LOCAL_LDLIBS</h4>
<p><code>LOCAL_LDLIBS</code> allows you to specify additional libraries that are not part of the build for your executable or library.  Specify the libraries you want in -lxxx format; they&#8217;re passed directly to the  link line.  However, keep in mind that there will be no dependency generated for these libraries.  It&#8217;s most useful in simulator builds where you want to use a library preinstalled on the host.  The linker (ld) is a particularly fussy beast, so it&#8217;s sometimes necessary to pass other flags here if you&#8217;re doing something sneaky. Some examples:</p>
<p><code>LOCAL_LDLIBS += -lcurses -lpthread<br />
LOCAL_LDLIBS += -Wl,-z,origin </code></p>
<h4>LOCAL_NO_MANIFEST</h4>
<p>If your package doesn&#8217;t have a manifest (AndroidManifest.xml), then set <code>LOCAL_NO_MANIFEST:=true</code>.  The common resources package does this.</p>
<h4>LOCAL_PACKAGE_NAME</h4>
<p><code>LOCAL_PACKAGE_NAME</code> is the name of an app.  For example, Dialer, Contacts, etc.  This will probably change or go away when we switch to an ant-based build system for the apps.</p>
<h4>LOCAL_PATH</h4>
<p>The directory your Android.mk file is in. You can set it by putting the following as the first line in your Android.mk:</p>
<p><code>LOCAL_PATH := $(my-dir)</code></p>
<p>The <code>my-dir</code> macro uses the  <code><a href="http://www.gnu.org/software/make/manual/make.html#MAKEFILE_005fLIST-Variable">MAKEFILE_LIST</a></code> variable, so you must call it before you include any other makefiles.  Also, consider that any subdirectories you inlcude might reset LOCAL_PATH, so do your own stuff before you include them.  This also means that if you try to write several <code>include</code> lines that reference <code>LOCAL_PATH</code>, it won&#8217;t work, because those included makefiles might reset LOCAL_PATH.</p>
<h4>LOCAL_POST_PROCESS_COMMAND</h4>
<p>For host executables, you can specify a command to run on the module after it&#8217;s been linked.  You might have to go through some contortions to get variables right because of early or late variable evaluation:</p>
<p><code>module := $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)<br />
LOCAL_POST_PROCESS_COMMAND := /Developer/Tools/Rez -d __DARWIN__ -t APPL\<br />
-d __WXMAC__ -o $(module) Carbon.r </code></p>
<h4>LOCAL_PREBUILT_EXECUTABLES</h4>
<p>When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to executables that you want copied.  They&#8217;re located automatically into the right bin directory.</p>
<h4>LOCAL_PREBUILT_LIBS</h4>
<p>When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to libraries that you want copied.  They&#8217;re located automatically into the right lib directory.</p>
<h4>LOCAL_SHARED_LIBRARIES</h4>
<p>These are the libraries you directly link against.  You don&#8217;t need to pass transitively included libraries.  Specify the name without the suffix:</p>
<p><code>LOCAL_SHARED_LIBRARIES := \<br />
libutils \<br />
libui \<br />
libaudio \<br />
libexpat \<br />
libsgl </code></p>
<h4>LOCAL_SRC_FILES</h4>
<p>The build system looks at <code>LOCAL_SRC_FILES</code> to know what source files to compile &#8212; .cpp .c .y .l .java.  For lex and yacc files, it knows how to correctly do the intermediate .h and .c/.cpp files automatically.  If the files are in a subdirectory of the one containing the Android.mk, prefix them with the directory name:</p>
<p><code>LOCAL_SRC_FILES := \<br />
file1.cpp \<br />
dir/file2.cpp </code></p>
<h4>LOCAL_STATIC_LIBRARIES</h4>
<p>These are the static libraries that you want to include in your module. Mostly, we use shared libraries, but there are a couple of places, like executables in sbin and host executables where we use static libraries instead.</p>
<p><code>LOCAL_STATIC_LIBRARIES := \<br />
libutils \<br />
libtinyxml </code></p>
<h4>LOCAL_MODULE</h4>
<p><code>LOCAL_MODULE</code> is the name of what&#8217;s supposed to be generated from your Android.mk.  For exmample, for libkjs, the <code>LOCAL_MODULE</code> is “libkjs” (the build system adds the appropriate suffix &#8212; .so .dylib .dll). For app modules, use <code>LOCAL_PACKAGE_NAME</code> instead of  <code>LOCAL_MODULE</code>.  We&#8217;re planning on switching to ant for the apps, so this might become moot.</p>
<h4>LOCAL_MODULE_PATH</h4>
<p>Instructs the build system to put the module somewhere other than what&#8217;s normal for its type.  If you override this, make sure you also set <code>LOCAL_UNSTRIPPED_PATH</code> if it&#8217;s an executable or a shared library so the unstripped binary has somewhere to go.  An error will occur if you forget to.</p>
<p>See <a href="http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html#moving-modules">Putting modules elsewhere</a> for more.</p>
<h4>LOCAL_UNSTRIPPED_PATH</h4>
<p>Instructs the build system to put the unstripped version of the module somewhere other than what&#8217;s normal for its type.  Usually, you override this because you overrode <code>LOCAL_MODULE_PATH</code> for an executable or a shared library.  If you overrode <code>LOCAL_MODULE_PATH</code>, but not  <code>LOCAL_UNSTRIPPED_PATH</code>, an error will occur.</p>
<p>See <a href="http://android.git.kernel.org/?p=platform/build.git;a=blob_plain;f=core/build-system.html#moving-modules">Putting modules elsewhere</a> for more.</p>
<h4>LOCAL_WHOLE_STATIC_LIBRARIES</h4>
<p>These are the static libraries that you want to include in your module without allowing the linker to remove dead code from them. This is mostly useful if you want to add a static library to a shared library and have the static library&#8217;s content exposed from the shared library.</p>
<p><code>LOCAL_WHOLE_STATIC_LIBRARIES := \<br />
libsqlite3_android<br />
</code></p>
<h4>LOCAL_YACCFLAGS</h4>
<p>Any flags to pass to invocations of yacc for your module.  A known limitation here is that the flags will be the same for all invocations of YACC for your module.  This can be fixed.  If you ever need it to be, just ask.</p>
<p><code>LOCAL_YACCFLAGS := -p kjsyy</code></p>
<h2>Implementation Details</h2>
<p>You should never have to touch anything in the config directory unless you&#8217;re adding a new platform, new tools, or adding new features to the build system.  In general, please consult with the build system owner(s) (<a href="mailto:android-build-team">android-build-team</a>) before you go mucking around in here.  That said, here are some notes on what&#8217;s going on under the hood.</p>
<h3>Environment Setup / buildspec.mk Versioning</h3>
<p>In order to make easier for people when the build system changes, when it is necessary to make changes to buildspec.mk or to rerun the environment setup scripts, they contain a version number in the variable BUILD_ENV_SEQUENCE_NUMBER.  If this variable does not match what the build system expects, it fails printing an error message explaining what happened. If you make a change that requires an update, you need to update two places so this message will be printed.</p>
<ul>
<li>In config/envsetup.make, increment the         CORRECT_BUILD_ENV_SEQUENCE_NUMBER definition.</li>
<li>In buildspec.mk.default, update the BUILD_ENV_SEQUENCE_DUMBER         definition to match the one in config/envsetup.make</li>
</ul>
<p>The scripts automatically get the value from the build system, so they will trigger the warning as well.</p>
<h3>Additional makefile variables</h3>
<p>You probably shouldn&#8217;t use these variables.  Please consult <a href="mailto:android-build-team">android-build-team</a> before using them. These are mostly there for workarounds for other issues, or things that aren&#8217;t completely done right.</p>
<h4>LOCAL_ADDITIONAL_DEPENDENCIES</h4>
<p>If your module needs to depend on anything else that isn&#8217;t actually built in to it, you can add those make targets to  <code>LOCAL_ADDITIONAL_DEPENDENCIES</code>.  Usually this is a workaround for some other dependency that isn&#8217;t created automatically.</p>
<h4>LOCAL_BUILT_MODULE</h4>
<p>When a module is built, the module is created in an intermediate directory then copied to its final location.  LOCAL_BUILT_MODULE is the full path to the intermediate file.  See LOCAL_INSTALLED_MODULE for the path to the final installed location of the module.</p>
<h4>LOCAL_HOST</h4>
<p>Set by the host_xxx.make includes to tell base_rules.make and the other includes that we&#8217;re building for the host.  Kenneth did this as part of openbinder, and I would like to clean it up so the rules, includes and definitions aren&#8217;t duplicated for host and target.</p>
<h4>LOCAL_INSTALLED_MODULE</h4>
<p>The fully qualified path name of the final location of the module. See LOCAL_BUILT_MODULE for the location of the intermediate file that the make rules should actually be constructing.</p>
<h4>LOCAL_REPLACE_VARS</h4>
<p>Used in some stuff remaining from the openbinder for building scripts with particular values set,</p>
<h4>LOCAL_SCRIPTS</h4>
<p>Used in some stuff remaining from the openbinder build system that we might find handy some day.</p>
<h4>LOCAL_MODULE_CLASS</h4>
<p>Which kind of module this is.  This variable is used to construct other variable names used to locate the modules.  See base_rules.make and envsetup.make.</p>
<h4>LOCAL_MODULE_NAME</h4>
<p>Set to the leaf name of the LOCAL_BUILT_MODULE.  I&#8217;m not sure, but it looks like it&#8217;s just used in the WHO_AM_I variable to identify in the pretty printing what&#8217;s being built.</p>
<h4>LOCAL_MODULE_SUFFIX</h4>
<p>The suffix that will be appended to <code>LOCAL_MODULE</code> to form <code>LOCAL_MODULE_NAME</code>.  For example, .so, .a, .dylib.</p>
<h4>LOCAL_STRIP_MODULE</h4>
<p>Calculated in base_rules.make to determine if this module should actually be stripped or not, based on whether <code>LOCAL_STRIPPABLE_MODULE</code> is set, and whether the combo is configured to ever strip modules.  With Iliyan&#8217;s stripping tool, this might change.</p>
<h4>LOCAL_STRIPPABLE_MODULE</h4>
<p>Set by the include makefiles if that type of module is strippable.  Executables and shared libraries are.</p>
<h4>LOCAL_SYSTEM_SHARED_LIBRARIES</h4>
<p>Used while building the base libraries: libc, libm, libdl.  Usually it should be set to “none,” as it is in $(CLEAR_VARS).  When building these libraries, it&#8217;s set to the ones they link against.  For example, libc, libstdc++ and libdl don&#8217;t link against anything, and libm links against libc.  Normally, when the value is none, these libraries are automatically linked in to executables and libraries, so you don&#8217;t need to specify them manually.</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/709/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/android/android%e7%bc%96%e8%af%91c%e4%bb%a3%e7%a0%81%e6%97%b6%e9%93%be%e6%8e%a5%e5%85%b6%e4%bb%96%e5%ba%93%e6%96%87%e4%bb%b6%e7%9a%84%e6%96%b9%e6%b3%95%e9%99%84make-file%e8%af%a6%e8%a7%a3%e6%89%8b%e5%86%8c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TrueCrypt开源的硬盘优盘实时加密软件</title>
		<link>http://zhuwenhao.com/705/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86/truecrypt%e5%bc%80%e6%ba%90%e7%9a%84%e7%a1%ac%e7%9b%98%e4%bc%98%e7%9b%98%e5%ae%9e%e6%97%b6%e5%8a%a0%e5%af%86%e8%bd%af%e4%bb%b6/</link>
		<comments>http://zhuwenhao.com/705/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86/truecrypt%e5%bc%80%e6%ba%90%e7%9a%84%e7%a1%ac%e7%9b%98%e4%bc%98%e7%9b%98%e5%ae%9e%e6%97%b6%e5%8a%a0%e5%af%86%e8%bd%af%e4%bb%b6/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 15:19:06 +0000</pubDate>
		<dc:creator>朱文昊 Albert Zhu</dc:creator>
				<category><![CDATA[加密解密]]></category>

		<guid isPermaLink="false">http://zhuwenhao.com/?p=705</guid>
		<description><![CDATA[在最近这场360和腾讯的斗争中，以及斗争的结局，让我感到了深深的惊恐。
这场大戏外行看热闹，内行看门道。其深远的现实意义以及历史意义，已经到了只可意会、不可言传的地步。
如果你重视自己的信息安全，除了要在远离实名制网站、流氓软件之外，还要加密所有的网络连接，本地硬盘当然也不能不加密。这是一款开源的免费（许可证不是GPL）的软件，用于在读写过程中加密解密数据，构建一个他人难以窥探的数据存储方案。他甚至可以加密整个硬盘，包括操作系统在内。
网站地址： http://www.truecrypt.org/
新手指南：http://www.truecrypt.org/docs/?s=tutorial
]]></description>
			<content:encoded><![CDATA[<p>在最近这场360和腾讯的斗争中，以及斗争的结局，让我感到了深深的惊恐。</p>
<p>这场大戏外行看热闹，内行看门道。其深远的现实意义以及历史意义，已经到了只可意会、不可言传的地步。</p>
<p>如果你重视自己的信息安全，除了要在远离实名制网站、流氓软件之外，还要加密所有的网络连接，本地硬盘当然也不能不加密。这是一款开源的免费（许可证不是GPL）的软件，用于在读写过程中加密解密数据，构建一个他人难以窥探的数据存储方案。他甚至可以加密整个硬盘，包括操作系统在内。</p>
<p>网站地址： http://www.truecrypt.org/</p>
<p>新手指南：http://www.truecrypt.org/docs/?s=tutorial</p>
]]></content:encoded>
			<wfw:commentRss>http://zhuwenhao.com/705/%e6%8a%80%e6%9c%af/%e8%87%aa%e7%94%b1%e8%bd%af%e4%bb%b6%e7%a4%be%e5%8c%ba/%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86/truecrypt%e5%bc%80%e6%ba%90%e7%9a%84%e7%a1%ac%e7%9b%98%e4%bc%98%e7%9b%98%e5%ae%9e%e6%97%b6%e5%8a%a0%e5%af%86%e8%bd%af%e4%bb%b6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

