3.
加patch
做法有两种,参考前面提到的介绍
a. 在临时目录里面修改
从1.知道,临时文件在/var/tmp/portage/下面
以fontconfig 2.2.1+firefly的patch为例
代码:
fancyworld superkaramba # emerge -p fontconfig
These are the packages that I would merge, in order:
Calculating dependencies ...done! [ebuild N ] media-libs/fontconfig-2.2.0-r2
fancyworld superkaramba # cd /usr/portage/media-libs/fontconfig/ fancyworld fontconfig # ebuild fontconfig-2.2.1.ebuild unpack fancyworld fontconfig # ebuild fontconfig-2.2.1.ebuild unpack >>> md5 src_uri ;-) fontconfig-2.2.1.tar.gz >>> Unpacking source... >>> Unpacking fontconfig-2.2.1.tar.gz to /var/tmp/portage/fontconfig-2.2.1/work * Applying fontconfig-2.1-slighthint.patch... [ ok ] * Applying fontconfig-2.2-local_fontdir-r1.patch... [ ok ] * Applying fontconfig-2.2-blacklist.patch... [ ok ] * Applying fontconfig-2.2-remove_subpixel_test.patch... [ ok ] >>> Source unpacked. fancyworld fontconfig # cd /var/tmp/portage/fontconfig-2.2.1/work/fontconfig-2.2.1/ fancyworld fontconfig-2.2.1 # wget http://firefly.idv.tw/setfont-xft/p...-20030618.patch http://firefly.idv.tw/setfont-xft/p...030626.patch.gz http://firefly.idv.tw/setfont-xft/p...-20030617.patch
fancyworld fontconfig-2.2.1 # patch -p1 < fontconfig-2.2.1-fclang-miss_1_percent-20030617.patch patching file src/fclang.c
.............
|
然后
fancyworld fontconfig-2.2.1 # ebuild /usr/portage/media-libs/fontconfig/fontconfig-2.2.1.ebuild merge
这个merge操作会保留临时目录,在这个基础上进行./configure, make, make install的动作
b. 修改ebuild
gentoo的portage系统恐怕是最适合patch 的包管理系统了
还是以上为例
fancyworld fontconfig-2.2.1 # cd /usr/portage/media-libs/fontconfig/files/
下载patch
fancyworld files # wget
http://firefly.idv.tw/setfont-xft/p...-20030618.patch http://firefly.idv.tw/setfont-xft/p...030626.patch.gz http://firefly.idv.tw/setfont-xft/p...-20030617.patch
解压.gz(特例,因为这个patch太大了,所以firefly把它打包了一下)
gunzip fontconfig-2.2.1-include_CJK_charmaps-20030626.patch.gz
得到fontconfig-2.2.1-include_CJK_charmaps-20030626.patch
回到上一级,修改ebuild
fancyworld files # cd ..
fancyworld fontconfig # vi fontconfig-2.2.1.ebuild
可以看到
代码:
src_unpack() { unpack $ cd $
local PPREFIX="$/patch/$"
# Some patches from Redhat epatch $-2.1-slighthint.patch # Add our local fontpaths (duh dont forget!) epatch $-2.2-local_fontdir-r1.patch # Blacklist some fonts that break fontconfig epatch $-2.2-blacklist.patch # Remove the subpixel test from local.conf (#12757) epatch $-2.2-remove_subpixel_test.patch
# The date can be troublesome sed -i "s:\`date\`::" configure }
|
这里的$就等于 /usr/portage/media-libs/fontconfig/files/目录
$表示的是完整软件名+版本号,这里是fontconfig-2.2.1
$就只是单纯的软件名,这里是fontconfig
注意 epatch $-2.2-local_fontdir-r1.patch
和 firefly的patch部分冲突,把它去掉。
为了避免不必要的困扰,你的ebuild没有必要写的那么漂亮,所以,修改如下
src_unpack() {
unpack $
cd $
local PPREFIX="$/patch/$"
# Some patches from Redhat
epatch $-2.1-slighthint.patch
# Add our local fontpaths (duh dont forget!)
# epatch $-2.2-local_fontdir-r1.patch
# Blacklist some fonts that break fontconfig
epatch $-2.2-blacklist.patch
# Remove the subpixel test from local.conf (#12757)
epatch $-2.2-remove_subpixel_test.patch
# CJK font patch by firefly
epatch $/fontconfig-2.2.1-fclang-miss_1_percent-20030617.patch
epatch $/fontconfig-2.2.1-include_CJK_charmaps-20030626.patch
epatch $/fontconfig-2.2.1-multifamily-20030618.patch
# The date can be troublesome
sed -i "s:\`date\`::" configure
}
epatch是个eclass,它的特点就是屏蔽了patch的细节,让你无需考虑patch的参数问题。
最后直接emerge这个修改过的ebuild文件就行了。
这一部分说起来有点长,自己做一次就知道其实非常简单了。