如何决定在 .spec 文件“要求:”中提及的内容

如何决定在 .spec 文件“要求:”中提及的内容

我是构建 rpm 包的新手。为了为我的二进制文件创建 RPM,我有以下依赖项:

[tejas@target]$ ldd exe
    linux-vdso.so.1 =>  (0x00007fff85bff000)
    libQtWebKit.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtWebKit.so.4 (0x00007f868c4e8000)
    libphonon.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libphonon.so.4 (0x00007f868c288000)
    libQtScript.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtScript.so.4 (0x00007f868bdd3000)
    libQt3Support.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQt3Support.so.4 (0x00007f868b8b5000)
    libQtSql.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtSql.so.4 (0x00007f868b66f000)
    libQtXml.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtXml.so.4 (0x00007f868b426000)
    libQtGui.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtGui.so.4 (0x00007f868a6c7000)
    libQtNetwork.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtNetwork.so.4 (0x00007f868a369000)
    libQtCore.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtCore.so.4 (0x00007f8689e72000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003cd2200000)
    libqwt.so.6 => /usr/lib64/libqwt.so.6 (0x00007f8689b4e000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003cd8200000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003cd1a00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003cd7e00000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003cd1600000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003cd1e00000)
    libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x000000373ba00000)
    libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00000030aa000000)
    libgstapp-0.10.so.0 => /usr/lib64/libgstapp-0.10.so.0 (0x00000034f2e00000)
    libgstinterfaces-0.10.so.0 => /usr/lib64/libgstinterfaces-0.10.so.0 (0x00000034f0e00000)
    libgstpbutils-0.10.so.0 => /usr/lib64/libgstpbutils-0.10.so.0 (0x00000034f1a00000)
    libgstvideo-0.10.so.0 => /usr/lib64/libgstvideo-0.10.so.0 (0x00000034f2200000)
    libgstbase-0.10.so.0 => /usr/lib64/libgstbase-0.10.so.0 (0x00000034f1e00000)
    libgstreamer-0.10.so.0 => /usr/lib64/libgstreamer-0.10.so.0 (0x00000034f1600000)
    libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00000030b1200000)
    libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00000030a9800000)
    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x0000003cdba00000)
    libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00000030b4400000)
    librt.so.1 => /lib64/librt.so.1 (0x0000003cd2a00000)
    libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00000030b0e00000)
    libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x0000003cd5e00000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x0000003cd5a00000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x000000373b600000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x0000003e83600000)
    libQtDBus.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtDBus.so.4 (0x00007f86898c1000)
    libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x0000003cd5600000)
    libz.so.1 => /lib64/libz.so.1 (0x0000003cd2600000)
    libSM.so.6 => /usr/lib64/libSM.so.6 (0x000000373d200000)
    libICE.so.6 => /usr/lib64/libICE.so.6 (0x0000003cdb200000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003cd1200000)
    libQtSvg.so.4 => /opt/QtSDK/Desktop/Qt/4.8.0/gcc/lib/libQtSvg.so.4 (0x00007f8689662000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003cd3600000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003cd2e00000)
    libexpat.so.1 => /lib64/libexpat.so.1 (0x0000003cd5200000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x0000003e82600000)
    libuuid.so.1 => /lib64/libuuid.so.1 (0x0000003e83200000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x0000003e81e00000)

所以我检查了可以通过命令从哪个 rpm 获取这些库rpm -qf <library path>
例如:

[tejas@target]$ rpm -qf /lib64/libpthread.so.0
glibc-2.12-1.80.el6_3.5.x86_64

我还检查了该库应该可用的最低版本。因此,我相应地制作了包含所有这些包的规范文件。

我的 .spec 文件是:

[tejas@target]$ cat /home/tejas/rpmbuild/SPECS/ModCMS-gdm.spec
Name:   ModCMS-gdm  
Version:1.0 
Release:1
Summary:gdm     

Group:  ModCMS  
License:WESEE   
URL:    http://wesee.org    
Source0:ModCMS-gdm-1.0.tar.gz   

Requires:dbus-libs >= 1.2.24
Requires:expat >= 2.0.1
Requires:fontconfig >= 2.8.0
Requires:freetype >= 2.3.11
Requires:glib2 >= 2.22.5
Requires:glibc >= 2.12
Requires:keyutils-libs >= 1.4
Requires:krb5-libs >= 1.8.2
Requires:libasyncns >= 0.8
Requires:libcom_err >= 1.41.12
Requires:libgcc >= 4.4.4
Requires:libICE >= 1.0.6
Requires:libpng >= 1.2.44
Requires:libqwt6 = 6.0.1
Requires:libselinux >= 2.0.94
Requires:libSM >= 1.1.0
Requires:libsndfile >= 1.0.20
Requires:libstdc++ >= 4.4.4
Requires:libuuid >= 2.17.2
Requires:libXau >= 1.0.5
Requires:libxcb >= 1.5
Requires:libXcursor >= 1.1.10
Requires:libXext >= 1.1
Requires:libXfixes >= 4.0.4
Requires:libXi >= 1.3
Requires:libXinerama >= 1.1
Requires:libXrandr >= 1.3.0
Requires:libXrender >= 0.9.5
Requires:libXtst >= 1.0.99.2
Requires:openssl >= 1.0.1e
Requires:pulseaudio-libs >= 0.9.21
Requires:qt48 >= 4.8.5
Requires:qt48-x11 >= 4.8.5
Requires:qtwebkit >= 2.0
Requires:sqlite >= 3.6.20
Requires:tcp_wrappers-libs >= 7.6
Requires:zlib >= 1.2.3


%description
This is Just to test various files allocation through rpm build

%prep
%setup -q

%install
mkdir -p "$RPM_BUILD_ROOT/root/ModCMS"
cp -r GDM.tar.gz "$RPM_BUILD_ROOT/root/ModCMS/"

%files
/root/ModCMS/GDM.tar.gz

%clean
rm -rf $RPM_BUILD_ROOT

%post
cd /root/ModCMS/
tar xzf GDM.tar.gz

现在我的问题是:

  • 如何直接管理依赖库而不是 rpm?
  • 是否有必要在必需字段中包含所有这些依赖项?
  • 我如何最小化它们?

我已经搜索过,但找不到具体的解决方案。

答案1

这取决于。

如果您正在构建特定的发行版,则依赖其他 rpm 是可以的。

如果为不同的发行版构建,请使用库/文件名,因为包含该库的 rpm 名称可能不同。

相关内容