软件包制作完成后可用rpm命令查询,看看效果。如果不满意的话可以再次修改软件包描述文件,重新运行以上命令产生新的RPM软件包。
二.典型spec文件分析通过第一部分的介绍,我们对软件包的管理以及spec文件的一些细节应该掌握的差不多了,接下来通过分析kaffeine.spec(kaffeine是linux平台下的媒体播放器)文件来让读者朋友实践一回spec文件的规范和书写。
Kaffeine.spec文件内容如下:
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
%define debug_package %{nil} Name: kaffeine Version: 0.4.3 Release: 25 Summary: A xine-based Media Player for KDE Group: Applications/Multimedia License: GPL URL: Source0: kaffeine-0.4.3.tar.bz2 Source1: logo.png Source2: icon.tgz Source3: kaffeine.desktop Source4: codecs.tgz Patch: kaffeine-0.4.3-fix-hide-crash.patch Patch1:kaffeine-0.4.3-without-wizard.patch BuildRoot: /var/tmp/kaffeine-root %description Kaffeine is a xine based media player for KDE3. It plays back CDs, DVDs, and VCDs. It also decodes multimedia files like AVI, MOV, WMV, and MP3 from local disk drives, and displays multimedia streamed over the Internet. It interprets many of the most common multimedia formats available - and some of the most uncommon formats, too. Additionally, Kaffeine is fully integrated in KDE3, it supports Drag and Drop and provides an editable playlist, a bookmark system, a Konqueror plugin, a Mozilla plugin, OSD an much more.
以上这部分就是我们第一部分所说的文件头。这一部分主要包括软件包的名称、版本、源代码和patch等信息,通过这些关键字我们可以一目了然。查看以上内容,我们会全面了解该软件包。
接下来的这一个段就是核心部分,涉及到解包、补丁、编译、安装的过程。
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
%prep %setup -q %patch -p1 %patch1 -p1 %Build make -f admin/Makefile.common cvs ./configure --prefix=/usr make #for mo files pushd po rm *.gmo make popd %install mkdir -p $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/usr/share/services cp $RPM_BUILD_ROOT/usr/share/apps/kaffeine/mms.protocol $RPM_BUILD_ROOT/usr/share/services cp $RPM_BUILD_ROOT/usr/share/apps/kaffeine/rtsp.protocol $RPM_BUILD_ROOT/usr/share/services #mkdir -p $RPM_BUILD_ROOT/usr/lib/firefox/plugins #cp $RPM_BUILD_ROOT/usr/lib/kaffeineplugin/kaffeineplugin.so $RPM_BUILD_ROOT/usr/lib/firefox/plugins cp %{SOURCE1} $RPM_BUILD_ROOT/usr/share/apps/kaffeine rm -rf $RPM_BUILD_ROOT/usr/share/icons/hicolor/*/apps/kaffeine.png rm -rf $RPM_BUILD_ROOT/usr/share/icons/hicolor/*/apps/kaffeine-pause.png rm -rf $RPM_BUILD_ROOT/usr/share/icons/hicolor/*/apps/kaffeine-play.png rm -rf $RPM_BUILD_ROOT/usr/share/icons/hicolor/*/apps/kaffeine-record.png mkdir -p $RPM_BUILD_ROOT/usr/share/icons/crystalsvg tar zxvf %{SOURCE2} -C $RPM_BUILD_ROOT/usr/share/icons/crystalsvg mkdir -p $RPM_BUILD_ROOT/usr/share/applnk/App/Multimedia cp -r %{SOURCE3} $RPM_BUILD_ROOT/usr/share/applnk/App/Multimedia mkdir -p $RPM_BUILD_ROOT/usr/lib/win32 tar zxvf %{SOURCE4} -C $RPM_BUILD_ROOT/usr/lib/win32 %clean rm -rf $RPM_BUILD_ROOT %post ln -s /dev/cdrom /dev/dvd ln -s /dev/cdrom /dev/rdvd %files %defattr(-,root,root) /usr
这部分内容与所要打的包有关系,我们要根据具体情况来写出编译过程。这部分内容是最复杂的内容,当然,我们也可以看出,这样的写法其实就是在写一种规范化的脚本,说到脚本,读者朋友门就应该领会到这部分内容的灵活性了。
1 2 3 4 5 6 7 8 9 10
%changelog * Fri Jul 1 2005 AiLin Yang <alyang@redflag-linux.com> -0.4.3-25 - modified the fullscreen bottom control panel * Fri Jun 17 2005 xxx <xxx@redflag-linux.com> -0.4.3-24 - Modified to use xshm as video driver. * Thu Jun 16 2005 AiLin Yang <alyang@redflag-linux.com> - delete the option of Embed in system tray in configwidget * Tue Jun 14 2005 AiLin Yang <alyang@redflag-linux.com> - add fullscreen bottom control panel - update kaffine to support my fullscreen bottom control panel