構建rpm包
阿新 • • 發佈:2020-08-08
使用rpmbuild 構建rpm包
相關資料:
https://fedoraproject.org/wiki/How_to_create_an_RPM_package/zh-cn How to create an RPM package/zh-cn
https://blog.csdn.net/get_set/article/details/53453320RPM打包原理、示例、詳解及備查
https://my.oschina.net/u/913265/blog/892889 rpm包的製作
示例
目前:構建一個rpm包,安裝包後安裝二進位制hello檔案,輸出hello資訊
helle.c
#include <stdio.h> void main() { printf("helloworldrpmtest \n"); }
Makefile
install: mkdir -p $(DIR)/usr/bin/ gcc helle.c -o $(DIR)/usr/bin/hello
放入目錄hello-1.0 中 ,打包成原始檔包hello-1.0.tar.gz 放入rpmbuild的 原始碼目錄SOURCES中
SPECS 目錄中編寫 hello.spec 檔案
Name: hello Version: 1.0 Release: 1%{?dist} Summary: hello rpm test License: GPLv3+ URL: http://ftp.gnu.org/gnu/hello Source0: http://ftp.gnu.org/gnu/hello/%{name}-%{version}.tar.gz #BuildRequires: #Requires: %description a hello test %prep %setup -q #%build #make %install make install DIR=%{buildroot} %files %{_bindir}/hello %changelog
構建rpm包
rpmbuild -ba hello.spec
構建成功的rpm包 在RPMS 目錄中存放