Commit a7de0306 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

rpmbuild: Don't use default compiler flags set by rpmbuild



Latest rpmbuild has an enhanced set of macros which define different
compiler flags inside the build environment. Their defaults, however,
may impact the overall SPDK build (and its submodules) in a bit
unpredictable manner. With that in mind, make sure that defaults are
not use and only flags specified by the user are kept in use.

Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Change-Id: Ie3a3123011a43be78f20f805ea6f8cad6571beec
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14802


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
parent 23019242
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -133,6 +133,23 @@ build_macros() {
		macros+=(-D "build_requirements 1")
		macros+=(-D "build_requirements_list $build_requirements")
	fi

	build_macros_flags
}

build_macros_flags() {
	local flags flag

	flags=(CFLAGS CXXFLAGS LDFLAGS)

	for flag in "${flags[@]}"; do
		# If we are running in the environment where the flag is set, don't touch it -
		# rpmbuild will use it as is during the build. If it's not set, make sure the
		# rpmbuild won't set its defaults which may affect the build in an unpredictable
		# manner.
		[[ -n ${!flag} ]] && continue
		macros+=(-D "build_${flag,,} %{nil}")
	done
}

gen_spec() {