我.spec
从 EPEL 存储库中的源 RPM 修改了该文件。
# yumdownloader pjproject
# yumdownloader --source pjproject
# diff -u pjproject.spec{.orig,}
--- pjproject.spec.orig 2018-03-27 15:42:37.780641678 +0100
+++ pjproject.spec 2018-03-27 12:54:54.298556634 +0100
@@ -24,13 +24,13 @@
BuildRequires: alsa-lib-devel
-BuildRequires: gsm-devel
-BuildRequires: libsrtp-devel
+#BuildRequires: gsm-devel
+#BuildRequires: libsrtp-devel
BuildRequires: libuuid-devel
BuildRequires: openssl-devel
BuildRequires: pkgconfig
BuildRequires: portaudio-devel
-BuildRequires: speex-devel
+#BuildRequires: speex-devel
%description
@@ -76,23 +76,23 @@
rm -rf third_party/bdsound
rm -rf third_party/bin
rm -rf third_party/g7221
-rm -rf third_party/gsm
+#rm -rf third_party/gsm
rm -rf third_party/milenage
rm -rf third_party/mp3
rm -rf third_party/portaudio
rm -rf third_party/resample
-rm -rf third_party/speex
-rm -rf third_party/srtp
+#rm -rf third_party/speex
+#rm -rf third_party/srtp
rm -rf third_party/ilbc
rm -rf third_party/build/baseclasses
rm -rf third_party/build/g7221
-rm -rf third_party/build/gsm
+#rm -rf third_party/build/gsm
rm -rf third_party/build/milenage
rm -rf third_party/build/portaudio/src
rm -rf third_party/build/resample
rm -rf third_party/build/samplerate
-rm -rf third_party/build/speex
-rm -rf third_party/build/srtp
+#rm -rf third_party/build/speex
+#rm -rf third_party/build/srtp
rm -rf third_party/build/ilbc
%build
@@ -101,12 +101,8 @@
# that functionality, and it made it easier to ensure that we don't
# bundle any unnecessary libraries. Please contact me if your project
# needs this support, and I'll re-enable it
-export CFLAGS="-DPJ_HAS_IPV6=1 ${ARCHFLAGS} %{optflags}"
+export CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1 ${ARCHFLAGS} %{optflags}"
%configure --enable-shared \
- --with-external-gsm \
- --with-external-pa \
- --with-external-speex \
- --with-external-srtp \
--disable-opencore-amr \
--disable-resample \
--disable-sound \
@@ -116,7 +112,7 @@
--without-libyuv \
--disable-g7221-codec
-export CFLAGS="-DPJ_HAS_IPV6=1 %{optflags}"
+export CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1 %{optflags}"
make %{?_smp_mflags} dep
make %{?_smp_mflags}
现在,我看不到任何需要spec 文件中的选项,但原始 RPM 仍会尝试安装一些其他软件包。这些依赖项在哪里指定?这是在脚本中完成的吗configure
?
原始 RPM:
# yum install pjproject-2.3-6.el7.x86_64.rpm
Loaded plugins: fastestmirror
Examining pjproject-2.3-6.el7.x86_64.rpm: pjproject-2.3-6.el7.x86_64
Marking pjproject-2.3-6.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pjproject.x86_64 0:2.3-6.el7 will be installed
--> Processing Dependency: libgsm.so.1()(64bit) for package: pjproject-2.3-6.el7.x86_64
Loading mirror speeds from cached hostfile
* base: mirror.econdc.com
* epel: mirror.netweaver.uk
* extras: mozart.ee.ic.ac.uk
* ius: mirrors.ircam.fr
* updates: mirror.econdc.com
--> Processing Dependency: libspeex.so.1()(64bit) for package: pjproject-2.3-6.el7.x86_64
--> Processing Dependency: libspeexdsp.so.1()(64bit) for package: pjproject-2.3-6.el7.x86_64
--> Processing Dependency: libsrtp.so.0()(64bit) for package: pjproject-2.3-6.el7.x86_64
--> Running transaction check
---> Package gsm.x86_64 0:1.0.13-11.el7 will be installed
---> Package libsrtp.x86_64 0:1.4.4-10.20101004cvs.el7 will be installed
---> Package speex.x86_64 0:1.2-0.19.rc1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================================================
Installing:
pjproject x86_64 2.3-6.el7 /pjproject-2.3-6.el7.x86_64 2.1 M
Installing for dependencies:
gsm x86_64 1.0.13-11.el7 base 30 k
libsrtp x86_64 1.4.4-10.20101004cvs.el7 base 275 k
speex x86_64 1.2-0.19.rc1.el7 base 98 k
Transaction Summary
===================================================================================================================================================================================================================
Install 1 Package (+3 Dependent packages)
自定义 RPM:
# yum install pjproject-2.3-7.el7.centos.x86_64.rpm
Loaded plugins: fastestmirror
Examining /var/lib/mock/epel-7-x86_64/result/pjproject-2.3-7.el7.centos.x86_64.rpm: pjproject-2.3-7.el7.centos.x86_64
Marking /var/lib/mock/epel-7-x86_64/result/pjproject-2.3-7.el7.centos.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pjproject.x86_64 0:2.3-7.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================================================
Installing:
pjproject x86_64 2.3-7.el7.centos /pjproject-2.3-7.el7.centos.x86_64 2.3 M
Transaction Summary
===================================================================================================================================================================================================================
Install 1 Package
Total size: 2.3 M
Installed size: 2.3 M
编辑时间:2018 年 3 月 27 日星期二 20:55:48 UTC
我安装了自定义版本,repoquery
仍然显示speex
和其他版本,尽管安装过程中并不需要它们yum
。这些信息是从哪里获取的?
# repoquery --requires --resolve pjproject
speex-0:1.2-0.19.rc1.el7.x86_64
libstdc++-0:4.8.5-16.el7_4.2.x86_64
libgcc-0:4.8.5-16.el7_4.2.x86_64
glibc-0:2.17-196.el7_4.2.i686
libuuid-0:2.23.2-43.el7_4.2.x86_64
gsm-0:1.0.13-11.el7.x86_64
glibc-0:2.17-196.el7.x86_64
libsrtp-0:1.4.4-10.20101004cvs.el7.x86_64
openssl-libs-1:1.0.2k-8.el7.x86_64
答案1
RPM 为你做的一件方便/烦人的事情是自动发现提供和需要。有一种记录在案的方法过滤其有用性例如,spec 文件中的这些行将有效地删除您要删除的三个库的直接依赖关系:
# https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering
%global _privatelibs lib(gsmcodec|srtp|speex)[.]so.*
%global __provides_exclude ^(%{_privatelibs})$
%global __requires_exclude ^(%{_privatelibs})$
您可以通过检查生成的 rpm 文件来验证它们是否消失:
$ rpm -q --provides -p ../RPMS/x86_64/pjproject-2.3-6.el7.centos.x86_64.rpm libpj.so.2()(64bit) libpjlib-util.so.2()(64bit) libpjmedia-audiodev.so.2()(64bit) libpjmedia-codec.so.2()(64bit) libpjmedia-videodev.so.2()(64bit) libpjmedia.so.2()(64bit) libpjnath.so.2()(64bit) libpjsip-simple.so.2()(64bit) libpjsip-ua.so.2()(64bit) libpjsip.so.2()(64bit) libpjsua.so.2()(64bit) libpjsua2.so.2()(64bit) pjproject = 2.3-6.el7.centos pjproject(x86-64) = 2.3-6.el7.centos
但是,如果您使用repoquery
,您将获得询问上游软件包存储库的结果,而不是您自己的自定义构建的结果。
答案2
因为我相信 pjsip 的源代码捆绑了这些库,所以请检查规范中的 Install 部分,看看这些依赖的本地构建库是否被排除在二进制 RPM 之外。很可能是自动请求被确定,由于它们被排除在 RPM 之外,因此外部 RPM 被包括在内。您也可以尝试禁用--enable-shared
以构建单片二进制文件
答案3
# repoquery --requires --resolve pjproject
speex-0:1.2-0.19.rc1.el7.x86_64
libstdc++-0:4.8.5-16.el7_4.2.x86_64
libgcc-0:4.8.5-16.el7_4.2.x86_64
glibc-0:2.17-196.el7_4.2.i686
libuuid-0:2.23.2-43.el7_4.2.x86_64
gsm-0:1.0.13-11.el7.x86_64
glibc-0:2.17-196.el7.x86_64
libsrtp-0:1.4.4-10.20101004cvs.el7.x86_64
openssl-libs-1:1.0.2k-8.el7.x86_64