]> git.proxmox.com Git - rustc.git/commitdiff
cargo wrapper: fix LTO handling
authorFabian Grünbichler <git@fabian.gruenbichler.email>
Fri, 4 Oct 2024 16:10:49 +0000 (18:10 +0200)
committerFabian Grünbichler <git@fabian.gruenbichler.email>
Fri, 4 Oct 2024 16:10:49 +0000 (18:10 +0200)
the args need to be quoted correctly..

Closes: #1079071
Signed-off-by: Fabian Grünbichler <git@fabian.gruenbichler.email>
debian/bin/cargo

index 4b66dafd36bcc43838512a5e22b1f9fbbec888ac..e96f2992754cde12e7df5667b925ec564eb2ddc5 100755 (executable)
@@ -168,7 +168,7 @@ def main(*args):
     build_profiles = os.getenv("DEB_BUILD_PROFILES", "").split()
 
     parallel = []
-    lto = 0
+    lto = ""
     for o in build_options:
         if o.startswith("parallel="):
             parallel = ["-j" + o[9:]]
@@ -176,9 +176,9 @@ def main(*args):
             opt_arg = o[9:]
             for arg in opt_arg.split(","):
                 if opt_arg == "-lto":
-                    lto = -1
+                    lto = "false"
                 elif opt_arg == "+lto":
-                    lto = 1
+                    lto = "\"thin\""
                 else:
                     log(f"WARNING: unhandled optimization flag: {opt_arg}")
 
@@ -231,10 +231,9 @@ def main(*args):
     if nocheck and subcmd in ("test", "bench"):
         return 0
 
-    if lto == 1:
-        newargs.append("--config profile.release.lto = \"thin\"")
-    elif lto == -1:
-        newargs.append("--config profile.release.lto = false")
+    if lto:
+        newargs.append("--config")
+        newargs.append(f"profile.release.lto={lto}")
 
     if subcmd == "clean":
         logrun(["env", "RUST_BACKTRACE=1", "/usr/bin/cargo"] + list(newargs), check=True)