[OS-BUILD PATCH] redhat: change tools_make macro to avoid full override of variables in Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Herton R. Krzesinski <herton@xxxxxxxxxx>

redhat: change tools_make macro to avoid full override of variables in Makefile

As was previously discussed in kernel-ark MR 1721, there is a difference
of calling "CFLAGS=(...) make" and "make CFLAGS=(...)", the latter can
end up overriding Makefile defined values even if the makefile have eg.
"override CFLAGS +=". One example of such Makefile is
tools/power/x86/intel-speed-select/Makefile, where I tested both
invocations and indeed doing the second form overrides the cflags
including the needed included (-I) directives, which will make the build
fail.

So when building the tools, we don't want to ovewrite entirely the value the
Makefile provides. Instead, we want the default distro flags to be added to the
current defined values. This changes tools_make macro to do that. With
this we can also remove the workaround of having to specify same CFLAGS
again with intel-speed-select build.

Unfortunately, intel_sdsi tool Makefile overrides CFLAGS from the environment
entirely with a 'CFLAGS =' setting at its beginning. So until it's fixed, we
have to still do an workaround setting CFLAGS after make, otherwise build
fails with a relocation error when using the now provided LDFLAGS from
the distro.

Verified the changes here by doing a verbose eln build and checking
CFLAGS/LDFLAGS are being passed:
https://koji.fedoraproject.org/koji/taskinfo?taskID=88001746

Signed-off-by: Herton R. Krzesinski <herton@xxxxxxxxxx>

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100755
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -2228,7 +2228,7 @@ chmod +x tools/perf/check-headers.sh
 %endif
 
 %global tools_make \
-  %{make} CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?make_opts}
+  CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{make} %{?make_opts}
 
 %if %{with_tools}
 %ifarch %{cpupowerarchs}
@@ -2249,10 +2249,10 @@ chmod +x tools/power/cpupower/utils/version-gen.sh
    %{tools_make}
    popd
    pushd tools/power/x86/intel-speed-select
-   %{make} CFLAGS+="-D_GNU_SOURCE -Iinclude -I/usr/include/libnl3"
+   %{tools_make}
    popd
    pushd tools/arch/x86/intel_sdsi
-   %{tools_make}
+   %{tools_make} CFLAGS="${RPM_OPT_FLAGS}"
    popd
 %endif
 %endif
@@ -2517,10 +2517,10 @@ install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
    %{tools_make} DESTDIR=%{buildroot} install
    popd
    pushd tools/power/x86/intel-speed-select
-   %{tools_make} CFLAGS+="-D_GNU_SOURCE -Iinclude -I/usr/include/libnl3" DESTDIR=%{buildroot} install
+   %{tools_make} DESTDIR=%{buildroot} install
    popd
    pushd tools/arch/x86/intel_sdsi
-   %{tools_make} DESTDIR=%{buildroot} install
+   %{tools_make} CFLAGS="${RPM_OPT_FLAGS}" DESTDIR=%{buildroot} install
    popd
 %endif
 pushd tools/thermal/tmon

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1857
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux