linux 下制作rpm 软件包工具



一 checkinstall 简介,及所需环境

1 Checkinstall 是一个能从 tar.gz类的源代码自动生成RPM/Debian或Slackware安装包的程序。这样使你能用几乎所有的 tar.gz 类的源代码生成“干净”的安装或者卸载包。

2 OS: rhel 6.4 x86_64

3 chechinstall: http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz


二 安装

1 下载checkinstall 软件

#wget http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz

#tar xf checkinstall-1.6.2.tar.gz

#cd checkinstall-1.6.2

#make

报错如下:

installwatch.c:2942: error: conflicting types for ‘readlink’

/usr/include/unistd.h:828: note: previous declaration of ‘readlink’ was here

installwatch.c:3080: error: conflicting types for ‘scandir’

/usr/include/dirent.h:252: note: previous declaration of ‘scandir’ was here

installwatch.c:3692: error: conflicting types for ‘scandir64’

/usr/include/dirent.h:275: note: previous declaration of ‘scandir64’ was here

make[1]: *** [installwatch.o] Error 1

make[1]: Leaving directory `/root/checkinstall-1.6.2/installwatch'

make: *** [all] Error 2

2 修改installwatch.c 文件

at line 101, change:

static int (*true_scandir)( const char *,struct dirent ***,

int (*)(const struct dirent *),

int (*)(const void *,const void *));


to:

static int (*true_scandir)( const char *,struct dirent ***,

int (*)(const struct dirent *),

int (*)(const struct dirent **,const struct dirent **));



at line 121, change:

static int (*true_scandir64)( const char *,struct dirent64 ***,

int (*)(const struct dirent64 *),

int (*)(const void *,const void *));


to:

static int (*true_scandir64)( const char *,struct dirent64 ***,

int (*)(const struct dirent64 *),

int (*)(const struct dirent64 **,const struct dirent64 **));



at line 2941, change:

#if (GLIBC_MINOR <= 4)

to:

#if (0)

at line 3080, change:

int scandir( const char *dir,struct dirent ***namelist,

int (*select)(const struct dirent *),

int (*compar)(const void *,const void *) ) {


to:

int scandir( const char *dir,struct dirent ***namelist,

int (*select)(const struct dirent *),

int (*compar)(const struct dirent **,const struct dirent **) ) {


at line 3692, change:

int scandir64( const char *dir,struct dirent64 ***namelist,

int (*select)(const struct dirent64 *),

int (*compar)(const void *,const void *) ) {


to:

int scandir64( const char *dir,struct dirent64 ***namelist,

int (*select)(const struct dirent64 *),

int (*compar)(const struct dirent64 **,const struct dirent64 **) ) {

3 在重现编译安装

#make && make install


4 创建目录

#mkdir -pv /root/rpmbuild/SOURCES



三 使用方法,例如制作pcre-8.33.tar.gz RPM 软件包

1 下载pcre 所需软件包,并编译

#tar xf pcre-8.33.tar.gz

#cd pcre-8.33

#./configure --prefix=/usr/local/pcre

#make

#checkinstall

#注:如果没有需要修改的内容,按照提示一路回车。

checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran

This software is released under the GNU GPL.

Please choose the packaging method you want to use.

Slackware [S], RPM [R] or Debian [D]? R



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

**** RPM package creation selected ***

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


This package will be built according to these values:


1 - Summary: [ Package created with checkinstall 1.6.2 ]

2 - Name: [ pcre ]

3 - Version: [ 8.33 ]

4 - Release: [ 1 ]

5 - License: [ GPL ]

6 - Group: [ Applications/System ]

7 - Architecture: [ x86_64 ]

8 - Source location: [ pcre-8.33 ]

9 - Alternate source location: [ ]

10 - Requires: [ ]

11 - Provides: [ pcre ]


Enter a number to change any of them or press ENTER to continue:


Installing with make install...





参照:blog

http://thinkman.blog.51cto.com/4217028/1135049


你可能感兴趣的:(checkinstall,定制RPM包)