gpt4 book ai didi

rpmbuild - rpm 子包 %install 部分

转载 作者:行者123 更新时间:2023-12-02 19:19:26 24 4
gpt4 key购买 nike

规范文件中的子包是否可以有单独的 %install 部分?

例如,可以为主包指定文件

%files

对于像这样的子包:

%files mysubpackage

但是我只见过一个

%install

部分,如果这样做我会收到错误

%install mysubpackage

最佳答案

不,您不能拥有,也不需要单独的 %install 部分。

假设一个典型的例子:你编译一个程序,想要创建两个包; library.rpm 和library-devel.rpm(带有 header )。然后你将得到一个如下所示的规范文件:

Name: library
# probably some other fields...

%description
describre library

%package devel
Summary: headers for library

%description devel
describe library-devel package

%prep
# some common prep code for both packages; eg
%setup -q

%build
make (or whatever to build your program)

%install
# install files for both rpm packages; library AND headers
mkdir -p ${RPM_BUILD_ROOT}/%_libdir/
mkdir -p ${RPM_BUILD_ROOT}/usr/include/

cp library.so* ${RPM_BUILD_ROOT}/%_libdir/
cp include/*.h* ${RPM_BUILD_ROOT}/usr/include/

%files
%defattr(-,root,root)
%_libdir/*.so.*

%files devel
%defattr(-,root,root)
%_libdir/*.so # yes; if you use version numbers; the versioned .so go in the normal package; the one without version number in the devel package
/usr/include/*

进一步阅读:RPM packaging guide

关于rpmbuild - rpm 子包 %install 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46342543/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com