[librsvg/rustification] configure.ac: Add a --enable-debug option for debug vs. release



commit c742926a421d12a17fe0c6201b90db37011bf095
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Dec 16 16:40:21 2016 -0600

    configure.ac: Add a --enable-debug option for debug vs. release
    
    --disable-debug (the default) will call "cargo build" with "--release".
    This is so that distro packages don't have to change options.
    
    --enable-debug will call "cargo build" normally.  Use this for
    development.

 Makefile.am  |   12 +++++++++---
 configure.ac |   26 +++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index c72f6a7..3343a19 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -91,7 +91,13 @@ RUST_SOURCES =                                       \
 RUST_EXTRA =                                   \
        rust/Cargo.lock
 
-RUST_LIB = @abs_top_builddir@/target/debug/librsvg_internals.a
+if DEBUG_RELEASE
+CARGO_RELEASE_ARGS=
+else
+CARGO_RELEASE_ARGS=--release
+endif
+
+RUST_LIB=@abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/librsvg_internals.a
 
 check-local:
        cd $(srcdir)/rust && \
@@ -101,9 +107,9 @@ clean-local:
        cd $(top_srcdir)/rust && \
        CARGO_TARGET_DIR=@abs_top_builddir@/target cargo clean
 
-$(RUST_LIB): $(RUST_SOURCES)
+@abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/librsvg_internals.a: $(RUST_SOURCES)
        cd $(top_srcdir)/rust && \
-       CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build --verbose
+       CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build --verbose $(CARGO_RELEASE_ARGS)
 
 librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
        -I$(top_srcdir)                         \
diff --git a/configure.ac b/configure.ac
index 94050a7..5da8420 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,6 +242,28 @@ fi
 AM_CONDITIONAL([BUILD_MISC_TOOLS], [test "x$build_misc_tools" = "xyes"])
 
 dnl ===========================================================================
+dnl Specify --enable-debug to make a development release.  By default,
+dnl we build in public release mode.
+
+AC_ARG_ENABLE(debug,
+              AC_HELP_STRING([--enable-debug],
+                             [Build Rust code with debugging information [default=no]]),
+              [debug_release=$enableval],
+             [debug_release=no])
+
+AC_MSG_CHECKING(whether to build Rust code with debugging information)
+if test "x$debug_release" = "xyes" ; then
+       AC_MSG_RESULT(yes)
+       RUST_TARGET_SUBDIR=debug
+else
+       AC_MSG_RESULT(no)
+       RUST_TARGET_SUBDIR=release
+fi
+AM_CONDITIONAL([DEBUG_RELEASE], [test "x$debug_release" = "xyes"])
+
+AC_SUBST([RUST_TARGET_SUBDIR])
+
+dnl ===========================================================================
 dnl Build introspectable bindings
 
 # No automagic please!
@@ -304,7 +326,9 @@ librsvg-$VERSION
 
        prefix:                         ${prefix}
        compiler:                       ${CC}
-       
+
+        Debugging information for Rust: ${debug_release}
+
        Build introspectable bindings:  ${found_introspection}
        Build Vala bindings:            ${enable_vala}
        Build GdkPixbuf loader:         ${enable_pixbuf_loader}


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