LUPA让我认识了开源,而开源精神更加冲击着我的内心世界,它伴随着我的成长,我愿与它同在,深信它会使我们更加的强壮,使我们未来的路走的会更好、更远。开源这伟大的想法并非我们80后的人所提出的,但是,它需要我们去更好的发扬光大,让我们携手并进吧。

实例说明:利用工具方便、快捷的生成RPM与DEB包

2008-05-11 17:13:09

操作1:工具包的下载
下载地址:
http://asic-linux.com.mx/~izto/checkinstall/files/rpm/checkinstall-1.6.1-1.i386.rpm
操作2:安装工具包
[root@localhost home]#rpm –ivh checkinstall-1.6.1-1.i386.rpm
操作3:源码文件内容
[root@localhost hello]# ls
aclocal.m4      configure       descrīption-pak  Makefile.am    pics
autom4te.cache  configure.in    hello.c          Makefile.in
autoscan.log    configure.scan  hello.h          missing
config.h.in     depcomp         install-sh       mkinstalldirs

操作4:配置源码文件
[root@localhost hello]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands

操作5:编译源码
[root@localhost hello]# make
make  all-am
make[1]: Entering directory `/home/hello'
source='hello.c' ōbject='hello.o' libtool=no \
depfile='.deps/hello.Po' tmpdepfile='.deps/hello.TPo' \
depmode=gcc3 /bin/sh ./depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c `test -f 'hello.c' || echo './'`hello.c
gcc  -g -O2   -o hello  hello.o
make[1]: Leaving directory `/home/hello'

操作6:生成RPM包或DEB包
[root@localhost hello]# checkinstall        #此处也可以输入命令checkinstall -R直接生成RPM

checkinstall 1.6.1, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.

The checkinstallrc file was not found at:
/usr/local/lib/checkinstall/checkinstallrc

Assuming default values.

The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs?  [y]: y     

准备软件包的文档……OK

*** No known documentation files were found. The new package
*** won't include a documentation directory.

Please choose the packaging method you want to use.
Slackware [S], RPM [R] 还是 Debian [D]?R        #R表示生成RPM包,D表示生成DEB包


**************************************
**** RPM package creation selected ***
**************************************

This package will be built according to these values:

1 -  Summary: [ hello-1.0-3.tar.gz ]
2 -  Name:    [ hello ]
3 -  Version: [ 1.0 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ hello ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ hello ]

输入一个数字来改变它们,或按回车键继续:1        

#此为输入要修改的行号,如1表示设置summary内容
Enter new summary:
>> hello for linux提    #输入设置或修改的内容

This package will be built according to these values:

1 -  Summary: [ hello for linux ]
2 -  Name:    [ hello ]
3 -  Version: [ 1.0 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ hello ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ hello ]

输入一个数字来改变它们,或按回车键继续:4
Enter new release number:
>> 3

This package will be built according to these values:

1 -  Summary: [ hello for linux ]
2 -  Name:    [ hello ]
3 -  Version: [ 1.0 ]
4 -  Release: [ 3 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ hello ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ hello ]

输入一个数字来改变它们,或按回车键继续:

Installing with make install...

========================= Installation results ===========================
make[1]: Entering directory `/home/hello'
/bin/sh ./mkinstalldirs /usr/local/bin
  /usr/bin/install -c hello /usr/local/bin/hello
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/home/hello'

======================== Installation successful ==========================
cp:是否覆盖‘//var/tmp/LolgSDErNJnkWFcigqHAF/newfiles’? y

把文件拷贝到临时目录……OK

Striping ELF 二进制文件……OK

压缩 man 手册页……OK

创建文件列表……rm:是否删除一般文件‘/var/tmp/LolgSDErNJnkWFcigqHAF/newfiles’? y
OK
mv:是否覆盖‘/var/tmp/LolgSDErNJnkWFcigqHAF/newfiles.tmp’? y

创建 RPM 包……OK

NOTE: The package will not be installed

删除临时文件……OK

删除 doc-pak 目录……OK

生成备份包……OK

删除临时目录……OK


**********************************************************************

Done. The new package has been saved to

/usr/src/redhat/RPMS/i386/hello-1.0-3.i386.rpm
You can install it in your system anytime using:

      rpm -i hello-1.0-3.i386.rpm
#此时就生成了rpm包了
**********************************************************************


TAG:

我来说两句

(可选)

Open Toolbar