Bug 59243
Summary: | Need a way to override %optflags without duplicating the whole macros file | ||
---|---|---|---|
Product: | [Retired] Red Hat Raw Hide | Reporter: | Bill Crawford <billc> |
Component: | rpm-build | Assignee: | Jeff Johnson <jbj> |
Status: | CLOSED WORKSFORME | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 1.0 | Keywords: | FutureFeature |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2002-02-03 19:57:08 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Bill Crawford
2002-02-03 19:57:04 UTC
How about defining the macro on the command line: --define 'optflags %{expand:%%global optflags %{optflags} -W -Wall}' This will append "-W -Wall" to the current value on 1st expansion of %optflags. And, to eliminate unnecssary typing, you can add your own rpmbuild extension to rpm by adding to /etc/popt rpmb alias --Wall <glop above> rpmbuild alias --Wall <glop above> (Note: two entries to guarantee match on argv[0]) to be used as rpmbuild -ba --Wall <specfile> HTH (untested, reopen this bug if the above doesn't work) Thanks, I'll try that when I get home. One question though: you said "first expansion" ... optflags is expanded multiple times and then redefined (once in rpmrc, once in macros, once in %{arch}-redhat-linux/macros). The 1st expansion will redefine the "%optflags" object being expanded on the fly. The other piece that may be missing is that CLI macros are always added after everything else, 1st expansion appends -W -Wall, and away we go. Won't that mean it's added after e.g. %configure etc. get expanded (with the value of optargs from the macros file)? I'll go try it anyway. On my way home now. OK, that works -- thanks. Apologies for questioning you; I spent a while experimenting last night and it looked as though expansion was being done fairly early on in the process. A couple of things that didn't work were: defining %optflags in .rpmmacros defining %optflags in .rpmmacros-%{target} and modifying .rpmrc to look at that The only thing that worked was to define %optflags and then paste the rest of /usr/lib/rpm/%{target}/macros in after it, hence my assumption that expansion was always immediate. Interestingly so did putting "optflags: i386 -W -Wall -O2 -march=i386 -mcpu=686" in .rpmrc, as long as I put it *after* the "include: /usr/lib/rpm/rpmrc" (I'd tried something similar earlier and it failed because I'd put it at the start of .rpmrc, before the include). However the header and region stuff sounds even more hairy than the macro and command line stuff, so I'll leave you to it. Thanks for your help. Yeah %optflags is broke ATM, only the side effect of the optflags: yadda yadda in the ageless and decrepit rpmrc line works. One of these years I'll succeed in eliminating rpmrc configuration, sigh. What might work (but would probably break any kind of backward compatability) would be to process the command line first, then the target-specific macro file, then the general one, *then* rpmrc; and make the *first* definition stick, not the last one. Kinda like ssh config file works. (I know it's not going to happen, just speculating). |