rpmbuild在centos 5与centos 6用法的异同(转)

http://blog.163.com/hui_san/blog/static/5710286720125271170625/


rpmbuild在centos 5与centos 6用法的异同(转)  

之前是在centos5上对软件进行rpm打包,今天需要在centos 6上打包,发现File not found: /root/rpmbuild/BUILDROOT/…的错误,看是centos 6中的rpmbuild topdir已经改变,为了能兼容centos 5的spec文件,需要对topdir进行修改:


打开/usr/lib/rpm/macros文件:

%_topdir                %{getenv:HOME}/rpmbuild


更改为:

%_topdir                %{_usrsrc}/redhat


另外还需要定义buildroot


在spec文件中的make install后面加上DESTDIR=%{buildroot},即:


make install DESTDIR=%{buildroot}


DESTDIR是Makefile文件中定义的一个安装路径的变量,根据实际情况修改,比如mysql和nginx的是DESTDIR,而php的是INSTALL_ROOT。


转载请注明《文章来源:http://www.centos.bz/2012/06/file-not-found-root-rpmbuild-buildroot/》



你可能感兴趣的:(rpmbuild在centos 5与centos 6用法的异同(转))