天天看點

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:

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 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 (*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 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

#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...