Bug 1319301

Summary: rstp: Building does not honor RPM_OPT_FLAGS
Product: [Fedora] Fedora Reporter: Ralf Corsepius <rc040203>
Component: rstpAssignee: Neil Horman <nhorman>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 22CC: nhorman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-04 15:49:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ralf Corsepius 2016-03-18 18:27:55 UTC
Description of problem:

Building rstp doesn't honor $RPM_OPT_FLAGS/%optflags.

see https://bugzilla.redhat.com/attachment.cgi?id=1126054
and check all calls to gcc:
...
gcc -Wall -Werror -O2 -g -D_REENTRANT -D__LINUX__ -DVERSION=0.16 -DBUILD=1 -I. -I./include -I./rstplib   -c -o brstate.o brstate.c
...
gcc -g -O -Wall -D_REENTRANT -D__LINUX__   -c -o port.o port.c
...

Version-Release number of selected component (if applicable):
- rstp-04012009git-16.fc25
- Probably all versions of the rstp package in Fedora

How reproducible:
Always

Steps to Reproduce:
1. Build the package, check build.log


Additional info:
A brute-force patch would be this one:
# diff --git a/rstp.spec b/rstp.spec
index 9bcbc14..4d52a5c 100644
--- a/rstp.spec
+++ b/rstp.spec
@@ -35,6 +35,8 @@ replaces the in-kernel STP implementation
 %patch2 -p1
 %patch3 -p1
 
+sed -i -e 's|^\(CFLAGS = .*\)$|\1 %{optflags} |' Makefile */Makefile
+
 %build
 make %{?_smp_mflags}