<?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; Mac</title>
	<atom:link href="http://blog.yzlin.org/category/%e9%9b%bb%e8%85%a6%e6%8a%80%e8%a1%93/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.yzlin.org</link>
	<description>人生就該悠閒地過，忠實地記錄下人生的軌跡</description>
	<lastBuildDate>Thu, 21 Jan 2010 15:46:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>portconf 處理 soft link 的問題</title>
		<link>http://blog.yzlin.org/2008/05/25/36/</link>
		<comments>http://blog.yzlin.org/2008/05/25/36/#comments</comments>
		<pubDate>Sun, 25 May 2008 07:52:06 +0000</pubDate>
		<dc:creator>yzlin</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[電腦技術]]></category>
		<category><![CDATA[FreeBSD]]></category>

		<guid isPermaLink="false">http://blog.yzlin.org/?p=36</guid>
		<description><![CDATA[ports-mgmt/portconf 是一個很好用的工具，可以設定一個 port.conf，內容大致上的形式是這樣：

editor/vim*: WITH_CSCOPE=yes &#124; WITH_EXUBERANT_CTAGS=yes

如此一來，portconf 便會在 /etc/make.conf 自動去 parse port.conf，然後將對應的參數加入，以上面的例子，如果我安裝 editor/vim or editor/vim-lite 都會自動加入 &#8220;WITH_CSCOPE=yes WITH_EXUBERANT_CTAGS=yes&#8221;，這樣我們便可以更方便地管理各種不同 ports 的安裝參數。
但是，原本的 portconf 只是單純地判斷是否在 /usr/ports 下執行 make 的，如果 /usr/ports 是使用 soft link 的方式，其 real path 卻是在其它地方，那麼 portconf 便不會運作，它判斷的程式碼是加在 /etc/make.conf：

.if !empty(.CURDIR:M/usr/ports*) &#38;&#38; exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf
.for i in ${_PORTCONF:S/&#124;/ /g}
${i:S/%/ /g}
.endfor
.endif

從上面可以看到，它是利用 make 的 modifier 去比對，但是 modifier 其後接的 pattern 是不接受變數展開的，也就是說我們不能這樣寫：

_PORTDIR!=/bin/realpath /usr/ports
.if !empty(.CURDIR:M${_PORTDIR}*) &#38;&#38; [...]]]></description>
			<content:encoded><![CDATA[<p>ports-mgmt/portconf 是一個很好用的工具，可以設定一個 port.conf，內容大致上的形式是這樣：</p>
<blockquote>
<pre>editor/vim*: WITH_CSCOPE=yes | WITH_EXUBERANT_CTAGS=yes</pre>
</blockquote>
<p>如此一來，portconf 便會在 /etc/make.conf 自動去 parse port.conf，然後將對應的參數加入，以上面的例子，如果我安裝 editor/vim or editor/vim-lite 都會自動加入 &#8220;WITH_CSCOPE=yes WITH_EXUBERANT_CTAGS=yes&#8221;，這樣我們便可以更方便地管理各種不同 ports 的安裝參數。</p>
<p>但是，原本的 portconf 只是單純地判斷是否在 /usr/ports 下執行 make 的，如果 /usr/ports 是使用 soft link 的方式，其 real path 卻是在其它地方，那麼 portconf 便不會運作，它判斷的程式碼是加在 /etc/make.conf：</p>
<blockquote>
<pre>.if !empty(.CURDIR:M/usr/ports*) &amp;&amp; exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf
.for i in ${_PORTCONF:S/|/ /g}
${i:S/%/ /g}
.endfor
.endif</pre>
</blockquote>
<p>從上面可以看到，它是利用 make 的 modifier 去比對，但是 modifier 其後接的 pattern 是不接受變數展開的，也就是說我們不能這樣寫：</p>
<blockquote>
<pre>_PORTDIR!=/bin/realpath /usr/ports
.if !empty(.CURDIR:M${_PORTDIR}*) &amp;&amp; exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf
.for i in ${_PORTCONF:S/|/ /g}
${i:S/%/ /g}
.endfor
.endif</pre>
</blockquote>
<p>這是 make 本身的限制，rafan 後來<a href="http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/104838" target="_blank">送了個 patch</a>，讓 portconf 可以在安裝的時候自動將 make.conf 裡 /usr/ports 換成它的 real path，但是只保證安裝時候判斷，如果 real path 換地方了，便得手動修改或是乾脆重裝 portconf，其實 /usr/ports 的 real path 多半很少換，只要記得換了要修改或重裝就好，所以也還可以，但是我在想有什麼方式可以達到真正的動態判斷 real path，後來我改出了兩個版本：</p>
<h3>Version 1</h3>
<p>第一個版本想法是既然直接在 make.conf 做判斷有困難，那不如都改到 portconf 那隻 shell script 去判斷吧！</p>
<h4>/etc/make.conf</h4>
<blockquote>
<pre>.if exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf
.for i in ${_PORTCONF:S/|/ /g}
${i:S/%/ /g}
.endfor
.endif</pre>
</blockquote>
<h4>/usr/local/libexec/portconf 前面加入</h4>
<blockquote>
<pre>_portdir=`/bin/realpath /usr/ports`
_curdir=`pwd`
if [ "${_curdir##${_portdir}*}" != "" ]; then
    exit
fi</pre>
</blockquote>
<h3>Version 2</h3>
<p>第二個版本是直接在 make.conf 利用外部工具做判斷，只需要修改 make.conf，不用動到 portconf 那隻 shell script。</p>
<h4>/etc/make.conf</h4>
<blockquote>
<pre>_PORTSDIR!=/bin/realpath /usr/ports
_MATCHDIR!=echo `echo ${.CURDIR} | /usr/bin/grep ^${_PORTSDIR}`
.if !empty(_MATCHDIR) &amp;&amp; exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf
.for i in ${_PORTCONF:S/|/ /g}
${i:S/%/ /g}
.endfor
.endif</pre>
</blockquote>
<p>上面兩個版本都可以達到動態判斷 real path，但是有一利必有一弊&#8230;原本 portconf 利用 make 本身的 modifier 便是為了減少每次呼叫 make 多花費在判斷的時間，這對於一般的 ports 安裝來說，不會有多大的影響，但是對於 make buildworld 來說，便有可能造成很大的影響，所以我做個了測試，看看上面兩種修改在 make buildworld 增加多少時間，我的測試環境是：</p>
<ul>
<li>CPU：Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz (2333.35-MHz K8-class CPU)</li>
<li>OS：FreeBSD 7.0R amd64</li>
</ul>
<p>測試出來的結果：</p>
<ul>
<li>Original：60m57.49s</li>
<li>Version 1：62m6.19s</li>
<li>Version 2：61m29.74s</li>
</ul>
<p>這樣的結果我還算可以接受，所以我選擇了 Version 2 的版本 (雖然它做法挺髒的 XD)。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yzlin.org/2008/05/25/36/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leopard 10.5.2 更新出來了</title>
		<link>http://blog.yzlin.org/2008/02/12/16/</link>
		<comments>http://blog.yzlin.org/2008/02/12/16/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 12:47:22 +0000</pubDate>
		<dc:creator>yzlin</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[電腦技術]]></category>
		<category><![CDATA[Leopard]]></category>

		<guid isPermaLink="false">http://blog.yzlin.org/?p=16</guid>
		<description><![CDATA[Mac OS 10.5 leopard 新的更新出來了，目前最新版本是 10.5.2；除了安全性更新之外，還有軟體功能上的修正和新功能，廢話不多說，趕快來更新！]]></description>
			<content:encoded><![CDATA[<p>Mac OS 10.5 leopard 新的更新出來了，目前最新版本是 10.5.2；除了安全性更新之外，還有軟體功能上的修正和新功能，廢話不多說，趕快來更新！</p>
<p>詳細的更新內容可以參考<a target="_blank" href="http://www.apple.com/support/downloads/macosx1052comboupdate.html">這裡</a>。<br />
<a href="http://www.flickr.com/photos/yzlin1985/2259726111/" title="leopard 10.5.2 update by Yi-Jheng, Lin (Alex), on Flickr"><img src="http://farm3.static.flickr.com/2093/2259726111_cf0219d110.jpg" alt="leopard 10.5.2 update" height="500" width="440" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yzlin.org/2008/02/12/16/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leopard 下 Firefox 輸入問題</title>
		<link>http://blog.yzlin.org/2007/11/04/10/</link>
		<comments>http://blog.yzlin.org/2007/11/04/10/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 07:01:38 +0000</pubDate>
		<dc:creator>yzlin</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[電腦技術]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Leopard]]></category>

		<guid isPermaLink="false">http://blog.yzlin.org/index.php/2007/11/04/10/</guid>
		<description><![CDATA[Leopard 上更新了 Firefox 2.0.0.9 之後，從昨天開始，就一直有一個怪問題出現，就是輸入某些中文字會有問題，就是輸出的字會不見，然後再接著輸入其他中文字，又會出現，只是游標位置會跑到前一個字，一開始以為是 OpenVanilla 的問題，可是換了內建的漢音輸入也是有同樣的問題，然後我又試了 safari，發現沒有這個問題，所以我猜應該是這一版的 firefox 有問題。
這個問題發生在開啟 firefox 一段時間後，出現過問題的字有&#8221;兩&#8221;、&#8221;軟&#8221;、&#8221;黃&#8221;，希望下一版的能夠解決這個問題！
Update: 試用了 Firefox 3 Beta 2 沒有再出現掉字的問題了，可是速度還是慢啊 &#62;&#60;
]]></description>
			<content:encoded><![CDATA[<p>Leopard 上更新了 Firefox 2.0.0.9 之後，從昨天開始，就一直有一個怪問題出現，就是輸入某些中文字會有問題，就是輸出的字會不見，然後再接著輸入其他中文字，又會出現，只是游標位置會跑到前一個字，一開始以為是 OpenVanilla 的問題，可是換了內建的漢音輸入也是有同樣的問題，然後我又試了 safari，發現沒有這個問題，所以我猜應該是這一版的 firefox 有問題。</p>
<p>這個問題發生在開啟 firefox 一段時間後，出現過問題的字有&#8221;兩&#8221;、&#8221;軟&#8221;、&#8221;黃&#8221;，希望下一版的能夠解決這個問題！</p>
<p>Update: 試用了 Firefox 3 Beta 2 沒有再出現掉字的問題了，可是速度還是慢啊 &gt;&lt;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yzlin.org/2007/11/04/10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leopard &#8211; 如何更換登入畫面的背景？</title>
		<link>http://blog.yzlin.org/2007/11/03/11/</link>
		<comments>http://blog.yzlin.org/2007/11/03/11/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 15:37:53 +0000</pubDate>
		<dc:creator>yzlin</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[電腦技術]]></category>

		<guid isPermaLink="false">http://blog.yzlin.org/?p=11</guid>
		<description><![CDATA[到 leopard 的使用者們！是不是看膩了登入畫面一成不變的背景！？大家都有個疑問，包括我也是，到底要怎麼把那個背景改掉？
嘿嘿！其實登入畫面的背景就隱藏在 /System/Library/CoreServices/DefaultDesktop.jpg 這個檔案，也就是說，只要把這個檔案換成你喜歡的圖片就行了。(當然，檔名不能改，好！我知道這是廢話&#8230;)
我換成 Time Machine 的背景！
Update: 上面的做法不是很好，嗯！後來想想也是，其實這些背景圖片的資訊早已經寫在系統資訊裡面了，只要下：
sudo defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture "/Library/Desktop Pictures/Aqua Blue.jpg"
就可以直接指定要置換的來源檔案，如此一來，連改檔名都不用了。
]]></description>
			<content:encoded><![CDATA[<p><img style="float: right; margin-left: 20px; margin-right: 20px;" src="http://farm3.static.flickr.com/2296/1843881430_fa3c6d6dc4_m.jpg" height="159" width="240" />到 leopard 的使用者們！是不是看膩了登入畫面一成不變的背景！？大家都有個疑問，包括我也是，到底要怎麼把那個背景改掉？</p>
<p>嘿嘿！其實登入畫面的背景就隱藏在 /System/Library/CoreServices/DefaultDesktop.jpg 這個檔案，也就是說，只要把這個檔案換成你喜歡的圖片就行了。(當然，檔名不能改，好！我知道這是廢話&#8230;)</p>
<p>我換成 Time Machine 的背景！</p>
<p>Update: 上面的做法不是很好，嗯！後來想想也是，其實這些背景圖片的資訊早已經寫在系統資訊裡面了，只要下：</p>
<pre>sudo defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture "/Library/Desktop Pictures/Aqua Blue.jpg"</pre>
<p>就可以直接指定要置換的來源檔案，如此一來，連改檔名都不用了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yzlin.org/2007/11/03/11/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
