[librsvg] Add a LIBRSVG_DEBUG=yes env var for configure; works like --enable-debug



commit b1a4bfe98251c2975ea3da6610b878f080d70827
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Feb 27 13:48:42 2018 -0600

    Add a LIBRSVG_DEBUG=yes env var for configure; works like --enable-debug

 COMPILING.md | 17 ++++++++++++-----
 configure.ac | 10 +++++++++-
 2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/COMPILING.md b/COMPILING.md
index d8fd1226..f063341f 100644
--- a/COMPILING.md
+++ b/COMPILING.md
@@ -168,8 +168,11 @@ that you want to pass to the C compiler.
 
 ## Controlling debug or release mode for Rust
 
-For the Rust part of librsvg, we have an `--enable-debug` flag that
-you can pass to the `configure` script.  When enabled, the Rust
+* With a `configure` option: `--enable-debug` or `--disable-debug`
+* With an environment variable: `LIBRSVG_DEBUG=yes` or `LIBRSVG_DEBUG=no`
+
+For the Rust part of librsvg, we have a flag that
+you can pass at `configure` time.  When enabled, the Rust
 sub-library will have debugging information and no compiler
 optimizations.  *This flag is off by default:* if the flag is not
 specified, the Rust sub-library will be built in release mode (no
@@ -187,9 +190,13 @@ life easier to binary distributions.  Librsvg's build scripts will add
 `--release` to the Cargo command line by default.
 
 Developers can request a debug build of the Rust sub-library by
-passing `--enable-debug` to the `configure` script.  This will omit
-the `--release` option from Cargo, so that it will build the Rust
-sub-library in debug mode.
+passing `--enable-debug` to the `configure` script, or by setting the
+`LIBRSVG_DEBUG=yes` environment variable before calling `configure`.
+This will omit the `--release` option from Cargo, so that it will
+build the Rust sub-library in debug mode.
+
+In case both the environment variable and the command-line option are
+specified, the command-line option overrides the env var.
 
 # Cross-compilation
 
diff --git a/configure.ac b/configure.ac
index 9f8dce29..2fae2362 100644
--- a/configure.ac
+++ b/configure.ac
@@ -268,7 +268,15 @@ AC_ARG_ENABLE(debug,
               AC_HELP_STRING([--enable-debug],
                              [Build Rust code with debugging information [default=no]]),
               [debug_release=$enableval],
-             [debug_release=no])
+             [
+               if test "x$LIBRSVG_DEBUG" == "x"; then
+                 debug_release="no"
+               elif test "x$LIBRSVG_DEBUG" = "xyes"; then
+                 debug_release="yes"
+               elif test "x$LIBRSVG_DEBUG" = "xno"; then
+                 debug_release="no"
+               fi
+             ])
 
 AC_MSG_CHECKING(whether to build Rust code with debugging information)
 if test "x$debug_release" = "xyes" ; then


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]