mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 00:55:56 +00:00
contrib/fedora: make "lto" in the spec file configurable
When we build a copr image, we run the "nm-copr-build.sh" script.
That script, should honor "LTO=0|1|" to explicitly enable/disable
LTO. Since the copr script only builds a SRPM, which then gets build
we need that the default LTO flag in the SRPM is templated.
Fixes: 0566e9dc63
('contrib: support disabling "LTO" in "nm-copr-build.sh"')
This commit is contained in:
parent
0566e9dc63
commit
096b9955d6
|
@ -19,6 +19,7 @@
|
|||
%global snapshot __SNAPSHOT__
|
||||
%global git_sha __COMMIT__
|
||||
%global bcond_default_debug __BCOND_DEFAULT_DEBUG__
|
||||
%global bcond_default_lto __BCOND_DEFAULT_LTO__
|
||||
%global bcond_default_test __BCOND_DEFAULT_TEST__
|
||||
|
||||
%global obsoletes_device_plugins 1:0.9.9.95-1
|
||||
|
@ -69,11 +70,19 @@
|
|||
%else
|
||||
%bcond_with test
|
||||
%endif
|
||||
%if %{bcond_default_lto} == ''
|
||||
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
|
||||
%bcond_without lto
|
||||
%else
|
||||
%bcond_with lto
|
||||
%endif
|
||||
%else
|
||||
%if %{bcond_default_lto}
|
||||
%bcond_without lto
|
||||
%else
|
||||
%bcond_with lto
|
||||
%endif
|
||||
%endif
|
||||
%bcond_with sanitizer
|
||||
%if 0%{?fedora}
|
||||
%bcond_without connectivity_fedora
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
# SIGN_SOURCE=
|
||||
# DO_RELEASE=
|
||||
# BCOND_DEFAULT_DEBUG=
|
||||
# BCOND_DEFAULT_LTO=
|
||||
# BCOND_DEFAULT_TEST=
|
||||
|
||||
die() {
|
||||
|
@ -119,6 +120,7 @@ COMMIT_FULL="${COMMIT_FULL:-$(git rev-parse --verify HEAD || die "Error reading
|
|||
COMMIT="${COMMIT:-$(printf '%s' "$COMMIT_FULL" | sed 's/^\(.\{10\}\).*/\1/' || die "Error reading HEAD revision")}"
|
||||
BCOND_DEFAULT_DEBUG="${BCOND_DEFAULT_DEBUG:-0}"
|
||||
BCOND_DEFAULT_TEST="${BCOND_DEFAULT_TEST:-0}"
|
||||
BCOND_DEFAULT_LTO="${BCOND_DEFAULT_LTO}"
|
||||
USERNAME="${USERNAME:-"$(git config user.name) <$(git config user.email)>"}"
|
||||
SPECFILE="$(abs_path "$SPECFILE" "$SCRIPTDIR/NetworkManager.spec")" || die "invalid \$SPECFILE argument"
|
||||
SOURCE_FROM_GIT="$(coerce_bool "$SOURCE_FROM_GIT" "")"
|
||||
|
@ -174,12 +176,14 @@ LOG "SOURCE_README_IFCFG_FILES=$SOURCE_README_IFCFG_FILES"
|
|||
LOG "BUILDTYPE=$BUILDTYPE"
|
||||
LOG "NM_RPMBUILD_ARGS=$NM_RPMBUILD_ARGS"
|
||||
LOG "BCOND_DEFAULT_DEBUG=$BCOND_DEFAULT_DEBUG"
|
||||
LOG "BCOND_DEFAULT_LTO=$BCOND_DEFAULT_LTO"
|
||||
LOG "BCOND_DEFAULT_TEST=$BCOND_DEFAULT_TEST"
|
||||
LOG ""
|
||||
LOG "UUID=$UUID"
|
||||
LOG "BASEDIR=$TEMP"
|
||||
|
||||
in_set "$BCOND_DEFAULT_DEBUG" 0 1 || die "Invalid value for \$BCOND_DEFAULT_DEBUG: \"$BCOND_DEFAULT_DEBUG\""
|
||||
in_set "$BCOND_DEFAULT_LTO" '' 0 1 || die "Invalid value for \$BCOND_DEFAULT_LTO: \"$BCOND_DEFAULT_LTO\""
|
||||
in_set "$BCOND_DEFAULT_TEST" 0 1 || die "Invalid value for \$BCOND_DEFAULT_TEST: \"$BCOND_DEFAULT_TEST\""
|
||||
|
||||
ln -snf "$TEMPBASE" ./latest0
|
||||
|
@ -209,6 +213,7 @@ sed -e "s/__VERSION__/$VERSION/g" \
|
|||
-e "s/__SNAPSHOT__/$SNAPSHOT/g" \
|
||||
-e "s/__SOURCE1__/$(basename "$SOURCE")/g" \
|
||||
-e "s/__BCOND_DEFAULT_DEBUG__/$BCOND_DEFAULT_DEBUG/g" \
|
||||
-e "s/__BCOND_DEFAULT_LTO__/$BCOND_DEFAULT_LTO/g" \
|
||||
-e "s/__BCOND_DEFAULT_TEST__/$BCOND_DEFAULT_TEST/g" \
|
||||
"$SPECFILE" |
|
||||
sed -e "/^__CHANGELOG__$/ \
|
||||
|
|
|
@ -26,6 +26,7 @@ usage() {
|
|||
echo " -s|--snapshot TEXT: use TEXT as the snapshot version for the new package (overwrites \$NM_BUILD_SNAPSHOT environment)"
|
||||
echo " -r|--release: built a release tarball (this option must be alone)"
|
||||
echo " --default-for-debug \$OPTION: set the default for "debug" option in the generated spec file"
|
||||
echo " --default-for-lto \$OPTION: set the default for "lto" option in the generated spec file"
|
||||
echo " --default-for-test \$OPTION: set the default for "test" option in the generated spec file"
|
||||
}
|
||||
|
||||
|
@ -56,6 +57,7 @@ SOURCE_FROM_GIT=0
|
|||
SNAPSHOT="$NM_BUILD_SNAPSHOT"
|
||||
DO_RELEASE=0
|
||||
unset BCOND_DEFAULT_DEBUG
|
||||
unset BCOND_DEFAULT_LTO
|
||||
unset BCOND_DEFAULT_TEST
|
||||
|
||||
ADD_WITH_TEST=1
|
||||
|
@ -110,6 +112,9 @@ while [[ $# -gt 0 ]]; do
|
|||
debug)
|
||||
[[ -z ${BCOND_DEFAULT_DEBUG+.} ]] && BCOND_DEFAULT_DEBUG=1
|
||||
;;
|
||||
lto)
|
||||
[[ -z ${BCOND_DEFAULT_LTO+.} ]] && BCOND_DEFAULT_LTO=1
|
||||
;;
|
||||
test)
|
||||
ADD_WITH_TEST=0
|
||||
[[ -z ${BCOND_DEFAULT_TEST+.} ]] && BCOND_DEFAULT_TEST=1
|
||||
|
@ -124,6 +129,9 @@ while [[ $# -gt 0 ]]; do
|
|||
debug)
|
||||
[[ -z ${BCOND_DEFAULT_DEBUG+.} ]] && BCOND_DEFAULT_DEBUG=0
|
||||
;;
|
||||
lto)
|
||||
[[ -z ${BCOND_DEFAULT_LTO+.} ]] && BCOND_DEFAULT_LTO=0
|
||||
;;
|
||||
test)
|
||||
ADD_WITH_TEST=0
|
||||
[[ -z ${BCOND_DEFAULT_TEST+.} ]] && BCOND_DEFAULT_TEST=0
|
||||
|
@ -145,6 +153,12 @@ while [[ $# -gt 0 ]]; do
|
|||
BCOND_DEFAULT_DEBUG="$1"
|
||||
shift
|
||||
;;
|
||||
--default-for-lto)
|
||||
[[ $# -gt 0 ]] || die "Missing argument to $A"
|
||||
in_set "$1" "" 0 1 || die "invalid argument $A \"$1\""
|
||||
BCOND_DEFAULT_LTO="$1"
|
||||
shift
|
||||
;;
|
||||
--default-for-test)
|
||||
[[ $# -gt 0 ]] || die "Missing argument to $A"
|
||||
in_set "$1" "" 0 1 || die "invalid argument $A \"$1\""
|
||||
|
@ -226,6 +240,7 @@ export NM_RPMBUILD_ARGS="${WITH_LIST[@]}"
|
|||
export SNAPSHOT
|
||||
export DO_RELEASE
|
||||
export BCOND_DEFAULT_DEBUG="$BCOND_DEFAULT_DEBUG"
|
||||
export BCOND_DEFAULT_LTO="$BCOND_DEFAULT_LTO"
|
||||
export BCOND_DEFAULT_TEST="$BCOND_DEFAULT_TEST"
|
||||
|
||||
"$SCRIPTDIR"/build.sh
|
||||
|
|
|
@ -18,9 +18,9 @@ else
|
|||
fi
|
||||
|
||||
if [ "$LTO" = 0 ]; then
|
||||
LTO='--without -lto'
|
||||
LTO='--without lto'
|
||||
elif [ "$LTO" = 1 ]; then
|
||||
LTO='--with -lto'
|
||||
LTO='--with lto'
|
||||
else
|
||||
LTO=
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue