rpm打包
2013-12-04 14:38
405 查看
1、介绍
对一个源文件打包,可以打包成一个二进制文件rpm,也可以打包成一个源码包文件.src.rpm文件。只要看打包时的参数来决定。 如:
rpmbuild -bb xxx.spec 打包成一个二进制文件。
rpmbuild -bs xxx.spec 打包成一个源码文件.
rpmbuild -bp xxx.spec 源文件放入到BUILD目录中。
rpmbuild -ba xxx.spec 以上三种情况。
2、执行步骤:
以一个简单的源码文件helloworld.c 为了。
1、mkdir helloworld , cd helloworld
2、编写一个helloworld.c 和 一个Makefile
3、cp -rp helloworld /usr/src/redhat/SOURCE
4、tar -zcvf helloworld-1.0.0.tar.gz helloworld
5、cd /usr/src/redhat/SPECS
6、编写一个hello-1.0.0.spec脚本
7、进行打包rpmbuild -bb hello-1.0.0.spec
hello.c
#include <stdio.h>
int main(void)
{
printf("Hello, world !/n");
return 0;
}
Makefile
cc = gcc
hello:hello.o
$(cc) hello.o -o hello
hello.o:hello.c
$(cc) hello.c -c -g
fresh:
rm -rf Makefile
clean:
rm -rf hello hello.o
install:
cp hello /usr/bin
uninstall:
rm -rf /usr/bin/hello
helloworld-1.0.0.spec
summary: the First RPM of JL
Name:helloworld
Version:1.0
Release:0
Vendor:JL (jiangle07@gmail.com)
License:Share
Group:Applications/Text
Source0:helloworld-1.0.0.tar.gz
#Patch0:helloworld-0.1-1.patch
%description
My test helloworld
%prep
export RPM_SOURCES_DIR=/usr/src/redhat/SOURCES
export RPM_BUILD_DIR=/usr/src/redhat/BUILD
tar -xvf $RPM_SOURCES_DIR/helloworld-1.0.0.tar.gz
#%patch
%build
cd $RPM_BUILD_DIR/helloworld
make
%install
cd $RPM_BUILD_DIR/helloworld
make install
%clean
rm -rf $RPM_BUILD_DIR/helloworld
%files
#%defattr(-,root,root)
#/usr/bin/helloworld
%doc
/usr/src/redhat/BUILD/helloworld/readme
#%changelog
#* Wed June 20 2009 jiang le jiangle07@gmail.com
#- le test it
对一个源文件打包,可以打包成一个二进制文件rpm,也可以打包成一个源码包文件.src.rpm文件。只要看打包时的参数来决定。 如:
rpmbuild -bb xxx.spec 打包成一个二进制文件。
rpmbuild -bs xxx.spec 打包成一个源码文件.
rpmbuild -bp xxx.spec 源文件放入到BUILD目录中。
rpmbuild -ba xxx.spec 以上三种情况。
2、执行步骤:
以一个简单的源码文件helloworld.c 为了。
1、mkdir helloworld , cd helloworld
2、编写一个helloworld.c 和 一个Makefile
3、cp -rp helloworld /usr/src/redhat/SOURCE
4、tar -zcvf helloworld-1.0.0.tar.gz helloworld
5、cd /usr/src/redhat/SPECS
6、编写一个hello-1.0.0.spec脚本
7、进行打包rpmbuild -bb hello-1.0.0.spec
hello.c
#include <stdio.h>
int main(void)
{
printf("Hello, world !/n");
return 0;
}
Makefile
cc = gcc
hello:hello.o
$(cc) hello.o -o hello
hello.o:hello.c
$(cc) hello.c -c -g
fresh:
rm -rf Makefile
clean:
rm -rf hello hello.o
install:
cp hello /usr/bin
uninstall:
rm -rf /usr/bin/hello
helloworld-1.0.0.spec
summary: the First RPM of JL
Name:helloworld
Version:1.0
Release:0
Vendor:JL (jiangle07@gmail.com)
License:Share
Group:Applications/Text
Source0:helloworld-1.0.0.tar.gz
#Patch0:helloworld-0.1-1.patch
%description
My test helloworld
%prep
export RPM_SOURCES_DIR=/usr/src/redhat/SOURCES
export RPM_BUILD_DIR=/usr/src/redhat/BUILD
tar -xvf $RPM_SOURCES_DIR/helloworld-1.0.0.tar.gz
#%patch
%build
cd $RPM_BUILD_DIR/helloworld
make
%install
cd $RPM_BUILD_DIR/helloworld
make install
%clean
rm -rf $RPM_BUILD_DIR/helloworld
%files
#%defattr(-,root,root)
#/usr/bin/helloworld
%doc
/usr/src/redhat/BUILD/helloworld/readme
#%changelog
#* Wed June 20 2009 jiang le jiangle07@gmail.com
#- le test it
相关文章推荐
- centos 打包RPM包 ntopng
- rpm 打包原理及 .spec文件
- 使用RPM打包1
- Linux:RPM 打包记录
- RPM打包
- 困扰一天的rpm打包问题
- rpmbulid学习redis打包
- rpm打包前的一些准备
- RPM 打包一指禅
- rpmbuild打包错误:*** ERROR: No build ID note found in ******
- rpm 打包的中文教程
- rpm包打包过程详解(三)——源代码安装包使用
- haproxy,tengine,redis,rpm 打包
- rpm打包学习
- RPMBUILD源码打包资源汇总(转)
- Yum离线安装(一) --- RPM 打包技术与典型 SPEC 文件分析
- Linux --rpm 打包
- Centos6_64 rpm打包实践
- 【centos7常用技巧】RPM打包
- 利用rpm打包上线部署golang代码的方法教程