228
228
AC_MSG_RESULT ( $debug_release )
229
229
230
230
dnl These bits based on gnome:librsvg/configure.ac
231
- dnl By default, we build in public release mode.
231
+ dnl By default, we build in release mode (but without LTO!)
232
232
AC_ARG_ENABLE ( rust-debug ,
233
233
AC_HELP_STRING ( [ --enable-rust-debug] ,
234
234
[ Build Rust code with debugging information [ default=no] ] ) ,
@@ -244,6 +244,19 @@ AM_CONDITIONAL(RUST_DEBUG, [test "x$rust_debug_release" = "xdebug"])
244
244
dnl Unconditional now.
245
245
RPM_OSTREE_FEATURES="$RPM_OSTREE_FEATURES rust"
246
246
247
+ dnl Only use this for package builds, as it will hackily edit Cargo.toml right now
248
+ AC_ARG_ENABLE ( lto ,
249
+ AC_HELP_STRING ( [ --enable-lto] ,
250
+ [ Build code with Link Time Optimization [ default=no] ] ))
251
+ dnl https://github.com/rust-lang/cargo/issues/4349
252
+ dnl https://bugzilla.mozilla.org/show_bug.cgi?id=1386371
253
+ if test "${enable_lto}" = yes; then
254
+ if ! grep -q '^lto.*=true' rust/Cargo.toml 2>/dev/null; then
255
+ echo '# Inserted by configure --enable-lto' >> rust/Cargo.toml
256
+ echo "lto = true" >> rust/Cargo.toml
257
+ fi
258
+ fi
259
+
247
260
dnl And propagate the release/debug type to cmake
248
261
cmake_args=-DCMAKE_BUILD_TYPE=RelWithDebugInfo
249
262
if test ${debug_release} = debug; then
@@ -286,6 +299,6 @@ echo "
286
299
introspection: $found_introspection
287
300
bubblewrap: $with_bubblewrap
288
301
gtk-doc: $enable_gtk_doc
289
- rust: $rust_debug_release
302
+ rust: $rust_debug_release (lto: ${enable_lto:-no})
290
303
cbindgen: ${cbindgen:-internal}
291
304
"
0 commit comments