【发布时间】:2019-09-22 06:15:15
【问题描述】:
如何正确覆盖规范文件中的%optflags?
$ rpm --eval %optflags # Fedora 29
-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
我需要在我的 spec 文件 中直接将 %optflags 宏中的 -O2 替换为 -O 吗?我只找到了一个解决方案:
%global optflags %(echo %{optflags} | sed 's/-O[0-3]/-O/')
对吗?
注意rpmbuild -ba --define "optflags -O bla bla" my.spec 这不是我的情况的解决方案。
【问题讨论】: