summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-01-24 08:46:08 +0100
committerThomas Haller <thaller@redhat.com>2023-01-24 08:46:14 +0100
commit0566e9dc63fbd7cffd9d1c738b67a7a3d0b9e870 (patch)
tree699ac76b4049e1597212322200eaaef8a8379255
parent74f66ee27678ae6cd97e414b65e35d63a831058c (diff)
downloadNetworkManager-0566e9dc63fbd7cffd9d1c738b67a7a3d0b9e870.tar.gz
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.
-rwxr-xr-xcontrib/scripts/nm-copr-build.sh15
1 files 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}/* .