<p>As the follow up of <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="480160177" data-permission-text="Issue title is private" data-url="https://github.com/rpm-software-management/rpm/issues/813" data-hovercard-type="pull_request" data-hovercard-url="/rpm-software-management/rpm/pull/813/hovercard" href="https://github.com/rpm-software-management/rpm/pull/813">#813</a><br>
I would like to have rpm macros that will do operations on <code>%optflags</code>:</p>
<p>Example:</p>
<ul>
<li><code>%filter-out-optflags '-flto=auto'</code></li>
<li><code>%append-if-to-optflags '-flto=auto' -ffat-lto-objects</code></li>
</ul>
<p>I found the example how currently we do it e.g. in MozillaFirefox:</p>
<pre><code>%{expand:%%global optflags %(echo "%optflags"|sed -e s/i586/i686/) -march=i686 -mtune=generic}
</code></pre>
<p>Which is quite ugly and I bet multiple packages suffer from the same issue. Gentoo has a reasonable API for that:<br>
<a href="https://devmanual.gentoo.org/eclass-reference/flag-o-matic.eclass/index.html" rel="nofollow">https://devmanual.gentoo.org/eclass-reference/flag-o-matic.eclass/index.html</a></p>
<p><a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=3882389" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pmatilai">@pmatilai</a> Is it realistic to come up with the functionality?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/rpm-software-management/rpm/issues/814?email_source=notifications&email_token=ADLPZU3MFUMVZXH5LCP5HVTQEK4YTA5CNFSM4ILLC5TKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HE63NVA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ADLPZUY7BNJLBUWGR4B6333QEK4YTANCNFSM4ILLC5TA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ADLPZU5XIYJFCVJJZX2M3JDQEK4YTA5CNFSM4ILLC5TKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HE63NVA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/rpm-software-management/rpm/issues/814?email_source=notifications\u0026email_token=ADLPZU3MFUMVZXH5LCP5HVTQEK4YTA5CNFSM4ILLC5TKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HE63NVA",
"url": "https://github.com/rpm-software-management/rpm/issues/814?email_source=notifications\u0026email_token=ADLPZU3MFUMVZXH5LCP5HVTQEK4YTA5CNFSM4ILLC5TKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HE63NVA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>