📄 00000003.htm
字号:
让我们由一个 helloworld 的 RPM 包裹档案学起吧,保证简单到 <BR> 辣翻天。您可以照著整个范例,自行演练一番,由於它们既小又简单, <BR> 应该不致於对您的系统造成任何影响。 <BR> <BR> □ 咱们「清纯」的 source <BR> 假设状况: <BR> 这个 helloworld-1.0-1.tgz 档案里就只有两个档案, <BR> 一个是 README,内容如下 ( 其实内容一点也不重要 ): <BR> Simple Example for RPM Package Building DEMO. <BR> 一个是 helloworld.c ,内容如下 ( 因陋就简啦,反正这也不重要 ): <BR> main() <BR> { <BR> printf("Hello, World\n"); <BR> } <BR> 好的,你必须把这个 tgz 档案放在 /usr/src/redhat/SOURCES 底下。 <BR> <BR> □ 编写 spec 档案 <BR> 必须在 /usr/src/redhat/SPECS 底下编写 helloworld-1.0-1.spec, <BR> 内容范例: <BR> Summary: Simple Example for RPM Building DEMO. <BR> Name: helloworld <BR> Version: 1.0 <BR> Release: 1 <BR> Copyright: Open Source <BR> Group: Extensions/Chinese <BR> Source: helloworld-1.0-1.tgz <BR> Packager: Penelope Marr <<A HREF="mailto:marr@nccu.edu.tw>">marr@nccu.edu.tw></A> <BR> %description <BR> This package is used as a demo for RPM building only. <BR> %changelog <BR> * Thu Jul 16 1998 Penelope Marr <<A HREF="mailto:marr@nccu.edu.tw>">marr@nccu.edu.tw></A> <BR> - build for the first time. <BR> %prep <BR> %setup -c <BR> %build <BR> make helloworld <BR> %install <BR> install -m 755 helloworld /usr/local/bin/helloworld <BR> %files <BR> %doc README <BR> /usr/local/bin/helloworld <BR> <BR> □ 启动 rpm -ba ... <BR> example# cd /usr/src/redhat/SPECS <BR> example# rpm -ba helloworld-1.0-1.spec 1> /tmp/out 2> /tmp/err <BR> <BR> 这种方式,可以方便我们更容易掌握相关资讯。 <BR> <BR> 五、制作「可随处安装」的包裹档案 <BR> -=-=-=-=-=-=-=-=-=-=-=-=-=-=- <BR> 所谓「relocatable package」,在下将之称为「可随处安装的包裹档案」, <BR> 相关的详细说明,可以参考 Maximum RPM 第十五章。 <BR> 由於多了 Prefix 的设定功能,使得这类的包裹档案附加更大的弹性, <BR> 非常实用,但同时,也额外增加包裹档案制作的难度。 <BR> 内容范例: <BR> Summary: Simple Example for RPM Building DEMO. <BR> Name: helloworld <BR> Version: 1.0 <BR> Release: 2 <BR> Copyright: Open Source <BR> Group: Extensions/Chinese <BR> Source: helloworld-1.0-1.tgz <BR> Packager: Penelope Marr <<A HREF="mailto:marr@nccu.edu.tw>">marr@nccu.edu.tw></A> <BR> Prefix: /usr/local <BR> %description <BR> This package is used as a demo for RPM building only. <BR> %changelog <BR> * Fri Jul 17 1998 Penelope Marr <<A HREF="mailto:marr@nccu.edu.tw>">marr@nccu.edu.tw></A> <BR> - make the relocatable package. <BR> * Thu Jul 16 1998 Penelope Marr <<A HREF="mailto:marr@nccu.edu.tw>">marr@nccu.edu.tw></A> <BR> - build for the first time. <BR> %prep <BR> %setup -c <BR> %build <BR> make helloworld <BR> %install <BR> install -m 755 helloworld /usr/local/bin/helloworld <BR> %files <BR> %doc README <BR> /usr/local/bin/helloworld <BR> <BR> □ 启动 rpm -ba ... <BR> example# cd /usr/src/redhat/SPECS <BR> example# rpm -ba helloworld-1.0-1.spec 1> /tmp/out 2> /tmp/err <BR> example# rpm -ba helloworld-1.0-1.spec 1> /tmp/out 2> /tmp/err <BR> 这样完成的 rpm 档案,於安装时,可以加 --prefix 参数,使得它 <BR> 安装至我们希望的其他目录下。 <BR> example# rpm -Uvh -v --prefix /root helloworld-1.0-1.i386.rpm <BR> <BR> 六、进阶技巧 <BR> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- <BR>「模仿」很重要,特别是仿效别人的精典之作,往往可以获得不少经验, <BR> 触发许多灵感。SRPM 档案则是学习模仿的最佳工具,在下自个儿收集 <BR> 了超过一千八百个 SRPM 档案,从别人的 spec 档案中,确实可以□清 <BR> 许多盲点。 <BR> 前面咱们只介绍了两个简单的范例,目的仅在引介 RPM 的制作流程, <BR> 本身并没有什麽难度。其他进阶的技巧,诸如「其他有用的 spec 标签」 <BR> 「多重包裹档案的制作」「相依关系」「设定 Build Root」「增加 PGP <BR> 签证功能」「Subpackage 的制作」,每个项目都相当精采。充份了解後, <BR> 不但可以制作包裹档案,自娱娱人,还可以藉此了解 Red Hat Linux <BR> 的架构,一兼二顾,摸蛤兼洗裤。 <BR> <BR> 自制 RPM 让 Linux 「个人化」「中文化」的理想,变得更容易且有系统, <BR> 希望您能从中收益良多。 <BR> -- <BR> "The only way you can compete against a monopoly is <BR> to change the rules on which the game is played." <BR> --- Robert F. Young <BR>-- <BR>※Origin: 猫空行馆 bbs.cs.nccu.edu.tw ◆From: ccs.cc.nccu.edu.tw <BR>-- <BR>※ 转载:.笑书亭 bbs.zju.ml.org.[FROM: 210.32.151.168] <BR> <BR>-- <BR>※ 修改:·linuxrat 於 Dec 30 17:01:25 修改本文·[FROM: 202.112.168.252] <BR>※ 来源:·BBS 水木清华站 smth.org·[FROM: 162.105.138.50] <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -