2007年2月14日星期三

源代码构建deb包

源代码构建deb包

这次以 leafpad 为例, leafpad 的当前版本为 0.8.9

  • 下载程序源代码

    #wget http://savannah.nongnu.org/download/leafpad/leafpad-0.8.9.tar.gz    

  • 创建工作目录

    # mkdir leafpad    #mv leafpad-0.8.9.tar.gz leafpad/  #cd leafpad  #tar zxvf leafpad-0.8.9.tar.gz  #cd leafpad-0.8.9 

  • 安装打包环境

    运行一下命令,安装编译 leafpad 所需的环境

    # apt-get install dh-make dpkg-dev g++ patch make libc6-dev fakeroot libgtk2.0-dev cdbs debhelper pkg-config gnome-pkg-tools 

  • Debian 初始化

    # dh_make -e etony@tom.com -f ../leafpad-0.8.9.tar.gz  Type of package: single binary, multiple binary, library, kernel module or cdbs?  [s/m/l/k/b] s  Maintainer name : tony Email-Address   : etony@tom.com  Date            : Sun, 28 May 2006 22:38:08 +0800 Package Name    : leafpad Version         : 0.8.9 License         : blank Type of Package : Single Hit <enter> to confirm:  Done. Please edit the files in the debian/ subdirectory now. leafpad uses a configure script, so you probably don't have to edit the Makefiles. 

  • 构建配置文件

    根据需求修改 debian/ 目录下的内容

    修改 changelog, control,

    以下为自动生成的 changelog, control 配置文件框架

    /leafpad/leafpad-0.8.9/debian$ cat control  Source: leafpad Section: unknown Priority: optional Maintainer: tony <etony@tom.com> Build-Depends: debhelper (>= 4.0.0), autotools-dev Standards-Version: 3.6.2  Package: leafpad Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: <insert up to 60 chars description>  <insert long description, indented with spaces>  /leafpad/leafpad-0.8.9/debian$ cat changelog  leafpad (0.8.9-1) unstable; urgency=low    * Initial release Closes: #nnnn  (nnnn is the bug number of your ITP)   -- tony <etony@tom.com>  Sun, 28 May 2006 22:38:08 +0800 

    如有需要自己,根据示例文件 *.ex 生成 postinst, postrm, prerm 等脚本文件

  • 构建 .deb 包

    # dpkg-buildpackage -rfakeroot -uc -b 

    如果您已经多次运行了上边的命令, 也可以使用下边的命令快速构建临时 .deb 包:

    #fakeroot debian/rules binary 

    将会在其上一级目录生成 leafpad_0.8.9-1_i386.deb


--
一步一步教你从互联网赚钱
http://www.zqzn.com/index.asp?rid=key480769

没有评论: