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

<channel>
	<title>邪恶的小星星 &#187; firefox</title>
	<atom:link href="http://www.xmxsuperstar.com/archives/tag/firefox/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xmxsuperstar.com</link>
	<description>Just Another Thinking</description>
	<lastBuildDate>Sun, 18 Dec 2011 06:08:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Ubuntu PGO方式编译Firefox笔记</title>
		<link>http://www.xmxsuperstar.com/archives/491/ubuntu-pgo%e6%96%b9%e5%bc%8f%e7%bc%96%e8%af%91firefox%e7%ac%94%e8%ae%b0.html</link>
		<comments>http://www.xmxsuperstar.com/archives/491/ubuntu-pgo%e6%96%b9%e5%bc%8f%e7%bc%96%e8%af%91firefox%e7%ac%94%e8%ae%b0.html#comments</comments>
		<pubDate>Tue, 10 Nov 2009 11:52:50 +0000</pubDate>
		<dc:creator>邪恶的小星星</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[sourcecode]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.xmxsuperstar.com/?p=491</guid>
		<description><![CDATA[在上一篇blog里用最简单的方式编译了firefox，今天用PGO方式重新优化编译了一下。 官方的PGO编译文档参考https://developer.mozilla.org/en/Building_with_Profile-Guided_Optimization 首先将.mozconfig修改如下： 其中 ac_add_options &#8211;enable-optimize=&#8221;-O2 -march=native -mtune=native -pipe -fomit-frame-pointer&#8221;, ac_add_options &#8211;enable-jemalloc, ac_add_options &#8211;enable-strip, ac_add_options &#8211;enable-install-strip 这四个选项是优化编译选项。 ac_add_options &#8211;enable-profile-guided-optimization 这个选项表示用PGO方式编译，而 mk_add_options PROFILE_GEN_SCRIPT=&#8221;sh /home/xmx/run-firefox.sh&#8221; 这个选项指定了PGO编译第一遍结束后执行的脚本。 而run-firefox.sh的内容如下： 配置结束后在源码顶层目录执行： 注意执行的是profiledbuild而不是之前简单的build 然后就开第一次编译，等待。。。 第一次编译结束后会自动调用run-firefox.sh脚本，运行刚刚编译完的firefox（第一次编译的时候千万不要运行原来的firefox，以免这里出错）。按照平时的上网习惯看一些网页，然后关掉，第二次编译便自动开始了。第二次编译会以第一次编译后运行产生的profile调优，通常能获得相当不错的性能提升。 第二次编译结束后便和普通编译一样了： 在ff-opt/dist下就已经生成了一个打包好的firefox包，解压到任何地方运行就可以了。]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://www.xmxsuperstar.com/archives/489/ubuntu-8-04-hardy-%e4%bb%8e%e6%ba%90%e7%a0%81%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85firefox%e8%a7%a3%e5%86%b3%e5%ad%97%e4%bd%93%e6%b8%b2%e6%9f%93%e9%97%ae%e9%a2%98.html">上一篇blog</a>里用最简单的方式编译了firefox，今天用PGO方式重新优化编译了一下。<br />
官方的PGO编译文档参考<a href="https://developer.mozilla.org/en/Building_with_Profile-Guided_Optimization">https://developer.mozilla.org/en/Building_with_Profile-Guided_Optimization</a><br />
首先将.mozconfig修改如下：</p>
<pre class="brush: bash; title: ; notranslate">
mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt
mk_add_options PROFILE_GEN_SCRIPT=&quot;sh /home/xmx/run-firefox.sh&quot;
ac_add_options --enable-application=browser
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-default-toolkit=cairo-gtk2 --enable-system-cairo
ac_add_options --enable-official-branding
ac_add_options --enable-optimize=&quot;-O2 -march=native -mtune=native -pipe -fomit-frame-pointer&quot;
ac_add_options --enable-jemalloc
ac_add_options --enable-strip
ac_add_options --enable-install-strip
ac_add_options --enable-profile-guided-optimization
</pre>
<p>其中<br />
ac_add_options &#8211;enable-optimize=&#8221;-O2 -march=native -mtune=native -pipe -fomit-frame-pointer&#8221;, ac_add_options &#8211;enable-jemalloc, ac_add_options &#8211;enable-strip, ac_add_options &#8211;enable-install-strip<br />
这四个选项是优化编译选项。<br />
ac_add_options &#8211;enable-profile-guided-optimization 这个选项表示用PGO方式编译，而 mk_add_options PROFILE_GEN_SCRIPT=&#8221;sh /home/xmx/run-firefox.sh&#8221; 这个选项指定了PGO编译第一遍结束后执行的脚本。<br />
而run-firefox.sh的内容如下：</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh make -f client.mk profiledbuild
export NO_EM_RESTART=1
mkdir $OBJDIR/_profileprofile
$OBJDIR/dist/bin/firefox -no-remote -profile $OBJDIR/_profileprofile
</pre>
<p>配置结束后在源码顶层目录执行：</p>
<pre class="brush: bash; title: ; notranslate">
make -f client.mk profiledbuild
</pre>
<p>注意执行的是profiledbuild而不是之前简单的build<br />
然后就开第一次编译，等待。。。<br />
第一次编译结束后会自动调用run-firefox.sh脚本，运行刚刚编译完的firefox（第一次编译的时候千万不要运行原来的firefox，以免这里出错）。按照平时的上网习惯看一些网页，然后关掉，第二次编译便自动开始了。第二次编译会以第一次编译后运行产生的profile调优，通常能获得相当不错的性能提升。<br />
第二次编译结束后便和普通编译一样了：</p>
<pre class="brush: bash; title: ; notranslate">
cd ff-opt
make package
</pre>
<p>在ff-opt/dist下就已经生成了一个打包好的firefox包，解压到任何地方运行就可以了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xmxsuperstar.com/archives/491/ubuntu-pgo%e6%96%b9%e5%bc%8f%e7%bc%96%e8%af%91firefox%e7%ac%94%e8%ae%b0.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ubuntu 8.04 hardy 从源码编译安装firefox解决字体渲染问题</title>
		<link>http://www.xmxsuperstar.com/archives/489/ubuntu-8-04-hardy-%e4%bb%8e%e6%ba%90%e7%a0%81%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85firefox%e8%a7%a3%e5%86%b3%e5%ad%97%e4%bd%93%e6%b8%b2%e6%9f%93%e9%97%ae%e9%a2%98.html</link>
		<comments>http://www.xmxsuperstar.com/archives/489/ubuntu-8-04-hardy-%e4%bb%8e%e6%ba%90%e7%a0%81%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85firefox%e8%a7%a3%e5%86%b3%e5%ad%97%e4%bd%93%e6%b8%b2%e6%9f%93%e9%97%ae%e9%a2%98.html#comments</comments>
		<pubDate>Mon, 09 Nov 2009 06:00:41 +0000</pubDate>
		<dc:creator>邪恶的小星星</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[sourcecode]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.xmxsuperstar.com/?p=489</guid>
		<description><![CDATA[最近发布的ubuntu 9.10 karmic 装在我的笔记本上问题重重，经过一番痛苦的折腾后，彻底放弃，降级回8.04 hardy。 但是hardy的源里面的firefox还是3.0版的，于是去Mozila官网下载最新的3.5.5编译好的包。但是运行后发现字体渲染不受System->Pereference->Appearance->Fonts中渲染设置的控制。 一通Google，在主目录下面放置.fonts.conf文件，如下内容： 但是情况依旧。 把hintstyle用hintfull，hintmedium，hintslight尝试，意外的发现hintfull，hintmedium的效果是一样的。再一通Google，猜测Mozilla的官方编译包没有用&#8211;enable-system-cairo选项编译，于是只好自己重新编译。 好在编译firefox不是很复杂，网上相关的文章也多，比如http://gastly.iblogger.org/how-to-compile-firefox-35b4-from-source-with-nice-fonts/ 首先安装必要的工具和相关的库： 然后从http://releases.mozilla.org/pub/mozilla.org/firefox/releases/下载最新的源码 然后解开源码包，进入源码目录，新建一个.mozconfig文件，包含如下内容： 这些选项的含义可以在https://developer.mozilla.org/en/Configuring_Build_Options查到，其中重要的是： 只有开启了这个选项，firefox才能正确的渲染字体。 这一选项会让编译出的浏览器的userAgent为firefox，使用Mozilla的firefox图标，否则userAgent为Shiretoko，使用的是一个蓝色地球的图标，如果遇上对userAgent检查严格的网站可能会有问题。但是注意Mozilla是不允许分发非官方的构建时使用firefox的名称和图标的。 之后： 开始编译，编译完成后： 这里的ff-opt目录就是上面在.mozconfig文件中第二行配置的，执行make package后会在ff-opt/dist/下生成一个类似名如：firefox-3.5.5.en-US.linux-i686.tar.bz2的包，解压运行其中的firefox就可以了。 当然也可以在源码顶层目录中执行 会安装在/usr/local下面。 现在字体可以正常的接受~/.fonts.conf的控制了（但依旧不接受 System->Pereference->Appearance->Fonts 的控制，囧）。]]></description>
			<content:encoded><![CDATA[<p>最近发布的ubuntu 9.10 karmic 装在我的笔记本上问题重重，经过一番痛苦的折腾后，彻底放弃，降级回8.04 hardy。<br />
但是hardy的源里面的firefox还是3.0版的，于是去Mozila官网下载最新的3.5.5编译好的包。但是运行后发现字体渲染不受System->Pereference->Appearance->Fonts中渲染设置的控制。<br />
一通Google，在主目录下面放置.fonts.conf文件，如下内容：</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version='1.0'?&gt;
&lt;match target=&quot;pattern&quot; &gt;
	&lt;edit mode=&quot;assign&quot; name=&quot;hinting&quot; &gt;
		&lt;bool&gt;true&lt;/bool&gt;
	&lt;/edit&gt;
	&lt;edit mode=&quot;assign&quot; name=&quot;hintstyle&quot; &gt;
		&lt;const&gt;hintfull&lt;/const&gt;
	&lt;/edit&gt;
	&lt;edit mode=&quot;assign&quot; name=&quot;autohint&quot; &gt;
		&lt;bool&gt;false&lt;/bool&gt;
	&lt;/edit&gt;
	&lt;edit mode=&quot;assign&quot; name=&quot;antialias&quot; &gt;
		&lt;bool&gt;true&lt;/bool&gt;
	&lt;/edit&gt;
	&lt;edit mode=&quot;assign&quot; name=&quot;rgba&quot; &gt;
		&lt;const&gt;rgb&lt;/const&gt;
	&lt;/edit&gt;
&lt;/match&gt;
</pre>
<p>但是情况依旧。<br />
把hintstyle用hintfull，hintmedium，hintslight尝试，意外的发现hintfull，hintmedium的效果是一样的。再一通Google，猜测Mozilla的官方编译包没有用&#8211;enable-system-cairo选项编译，于是只好自己重新编译。<br />
好在编译firefox不是很复杂，网上相关的文章也多，比如<a href="http://gastly.iblogger.org/how-to-compile-firefox-35b4-from-source-with-nice-fonts/">http://gastly.iblogger.org/how-to-compile-firefox-35b4-from-source-with-nice-fonts/</a><br />
首先安装必要的工具和相关的库：</p>
<pre class="brush: bash; title: ; notranslate">
$ sudo apt-get build-dep firefox-3.0
$ sudo apt-get install libcairo2 libcairo2-dev libasound2-dev libcurl4-openssl-dev libnotify-dev
</pre>
<p>然后从<a href="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/">http://releases.mozilla.org/pub/mozilla.org/firefox/releases/</a>下载最新的源码<br />
然后解开源码包，进入源码目录，新建一个.mozconfig文件，包含如下内容：</p>
<pre class="brush: bash; title: ; notranslate">
mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt
ac_add_options --enable-application=browser
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-default-toolkit=cairo-gtk2 --enable-system-cairo
ac_add_options --enable-optimize=&quot;-O2&quot;
ac_add_options --enable-official-branding
</pre>
<p>这些选项的含义可以在<a href="https://developer.mozilla.org/en/Configuring_Build_Options">https://developer.mozilla.org/en/Configuring_Build_Options</a>查到，其中重要的是：</p>
<pre class="brush: bash; title: ; notranslate">
ac_add_options --enable-default-toolkit=cairo-gtk2 --enable-system-cairo
</pre>
<p>只有开启了这个选项，firefox才能正确的渲染字体。</p>
<pre class="brush: bash; title: ; notranslate">
ac_add_options --enable-official-branding
</pre>
<p>这一选项会让编译出的浏览器的userAgent为firefox，使用Mozilla的firefox图标，否则userAgent为Shiretoko，使用的是一个蓝色地球的图标，如果遇上对userAgent检查严格的网站可能会有问题。但是注意Mozilla是不允许分发非官方的构建时使用firefox的名称和图标的。<br />
之后：</p>
<pre class="brush: bash; title: ; notranslate">
make -f client.mk build
</pre>
<p>开始编译，编译完成后：</p>
<pre class="brush: bash; title: ; notranslate">
cd ff-opt
make package
</pre>
<p>这里的ff-opt目录就是上面在.mozconfig文件中第二行配置的，执行make package后会在ff-opt/dist/下生成一个类似名如：firefox-3.5.5.en-US.linux-i686.tar.bz2的包，解压运行其中的firefox就可以了。<br />
当然也可以在源码顶层目录中执行</p>
<pre class="brush: bash; title: ; notranslate">
make -f client.mk install
</pre>
<p>会安装在/usr/local下面。<br />
现在字体可以正常的接受~/.fonts.conf的控制了（但依旧不接受 System->Pereference->Appearance->Fonts 的控制，囧）。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xmxsuperstar.com/archives/489/ubuntu-8-04-hardy-%e4%bb%8e%e6%ba%90%e7%a0%81%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85firefox%e8%a7%a3%e5%86%b3%e5%ad%97%e4%bd%93%e6%b8%b2%e6%9f%93%e9%97%ae%e9%a2%98.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

