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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章