下面将以Mplayer 为例子,讲一下Ubuntu制作Debian软件包具体过程。
注:这种方法说白了有点像RAR做的自解压文件,一般用于简单的打包。
一、制作前准备:
1
2
3
4
5
6
7
8
9
10
| mkdir ~/mplayer //建立工作目录
cd mplayer //切换到工作目录
mkdir ~/mplayer/DEBIAN //建立control文件存放目录
mkdir -p ~/mplayer/usr/local/mplayer //创建mplayer程序目录
(注意:"-p"绝对不能漏掉,因为,DEB包安装的时候默认是将文件释放到根目录)
mkdir ~/mplayer/usr/lib/ //创建用于存放解码包的目录
mkdir ~/mplayer/usr/bin/ //创建用于存放可执行文件的目录
mkdir ~/mplayer/usr/share/
mkdir ~/mplayer/usr/share/applications/
mkdir ~/mplayer/usr/share/pixmaps/ |
二、复制安装文件:
1
| cp -br /usr/local/mplayer/* ~/mplayer/usr/local/mplayer |
特别注意:CP命令中的"-b"这个参数绝对不能少,为此我走了很多弯路。因为mplayer中的有很多“软链接”,具体内容以后再说。
三、复制解码包
1
2
| cp -br /usr/lib/codecs ~/mplayer/usr/lib/
cp -br /usr/lib/win32 ~/mplayer/usr/lib/ |
四、创建符号链接
1
2
3
4
5
6
| cd ~/mplayer/usr
ln -s ../local/mplayer/bin/gmplayer ./bin/
ln -s ../local/mplayer/bin/mencoder ./bin/
ln -s ../local/mplayer/bin/mplayer ./bin/
ln -s ../../local/mplayer/share/applications/mplayer.desktop ./share/applications/
ln -s ../../local/mplayer/share/pixmaps/mplayer.xpm ./share/pixmaps/ |
五、创建一个control文件
1
| gedit ~/mplayer/DEBIAN/control |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| Package: mplayer
Version: 1.0rc2
Section: utils
Priority: optional
Architecture: i386
Essential: no
Depends:
Recommends:
Suggests:
Installed-Size: 22528
Maintainer: WangYan <WebMaster@WangYan.Name>
Conflicts:
Replaces:
Bugs: mailto:WebMaster@WangYan.Me
Description: The Ultimate Movie Player For Linux.
It plays most mpeg, avi and asf files, supported by many native and win32
DLL codecs. You can watch VCD, DVD and even DivX movies too. The other
big feature of mplayer is the wide range of supported output drivers. It
works with X11, Xv, DGA, OpenGL, SVGAlib, fbdev, but you can use SDL (and
this way all drivers of SDL) and some lowlevel card-specific drivers (for
Matrox/3dfx/SiS) too! Most of them supports software or hardware scaling,
so you can enjoy movies in fullscreen.
.
This version includes the Gtk GUI. |
control里面的东西都是什么意思,慢慢去看吧。如果我在"Conflicts:"后面填了"w32codecs",意思是说如果安 装"w32codecs",那么你将无法安装这个mplayer了,因为会产生冲突。另外,从"Description:"下面一行起要空一格。
六、最后用 dpkg-deb -b 命令打包。
1
2
| cd ~/mplayer/
dpkg -b . ~/mplayer_1.0rc2-1_i386.deb |
方法二:用checkinstall打包
1
2
| 安装“checkinstall”
sudo apt-get install checkinstall |
将上文的编译安装命令"sudo make install"改为"sudo checkinstall -D make install"
其中的checkinstall所在行的命令就是打包命令,执行后会进入checkinstall的设置。
照着提示走,很快,一个DEB包就奇迹般出现了。
No comments:
Post a Comment