From 965f2fcea139d46913a63f2eed2e37a53a0eb3a2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 24 Jan 2023 08:46:08 +0100 Subject: [PATCH] contrib: support disabling "LTO" in "nm-copr-build.sh" The "nm-copr-build.sh" script is run by our copr to generate the SRPM of NetworkManager (via `curl ... | bash`). Building with LTO takes a long time, for testing it can be nice to disable that. Add an environment variable for that. It can be used when manually building an RPM in copr. (cherry picked from commit 0566e9dc63fbd7cffd9d1c738b67a7a3d0b9e870) --- contrib/scripts/nm-copr-build.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/contrib/scripts/nm-copr-build.sh b/contrib/scripts/nm-copr-build.sh index 89269fae83..ed3fad8ef4 100755 --- a/contrib/scripts/nm-copr-build.sh +++ b/contrib/scripts/nm-copr-build.sh @@ -2,7 +2,10 @@ # environment variables: # - GIT_REF: the ref that should be build. Can be "main" or a git sha. -# - DEBUG: set to 1 to build "--with debug". +# - DEBUG: set to 1 to build "--with debug". Otherwise the default is a release +# build. +# - LTO: set to 1/0 to build "--with/--without lto", otherwise the default depends +# on the distribution. # - NM_GIT_BUNDLE: set to a HTTP url where to fetch the nm-git-bundle-*.noarch.rpm # from. Set to empty to skip it. By default, it fetches the bundle from copr. @@ -14,6 +17,14 @@ else DEBUG="--without debug" fi +if [ "$LTO" = 0 ]; then + LTO='--without -lto' +elif [ "$LTO" = 1 ]; then + LTO='--with -lto' +else + LTO= +fi + if [[ -z "$GIT_REF" ]]; then echo "\$GIT_REF is not set!" exit 1 @@ -59,7 +70,7 @@ GIT_SHA="$(git show-ref --verify --hash "$GIT_REF" 2>/dev/null || git checkout -b tmp "$GIT_SHA" -./contrib/fedora/rpm/build_clean.sh -g -S -w test $DEBUG -s copr +./contrib/fedora/rpm/build_clean.sh -g -S -w test $DEBUG $LTO -s copr popd mv ./NetworkManager/contrib/fedora/rpm/latest/{SOURCES,SPECS}/* .