[niepce: 12/29] build+rust: properly build the Rust library



commit 85ca0e560caa5de40c971673d4881dc7ce491b35
Author: Hubert Figuière <hub figuiere net>
Date:   Sat Jun 17 22:35:38 2017 -0400

    build+rust: properly build the Rust library

 Makefile.am            |    9 ---------
 build.rs               |    1 -
 configure.ac           |    4 ++++
 src/niepce/Makefile.am |   39 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6e1b596..bcbc63c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,6 @@
 ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST = COPYING AUTHORS README \
-       Cargo.toml \
        Cargo.lock \
        $(NULL)
 
@@ -12,11 +11,3 @@ endif
 SUBDIRS =  data src $(CW_DIR) po
 DIST_SUBDIRS = po art data doc src camerawire
 
-all-local:
-       (cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build --release)
-
-clean-local:
-       -(cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo clean)
-
-check:
-       (cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo test --release)
diff --git a/build.rs b/build.rs
index ac28afb..1e1d139 100644
--- a/build.rs
+++ b/build.rs
@@ -1,5 +1,4 @@
 extern crate bindgen;
-extern crate pkg_config;
 
 use std::env;
 use std::path::PathBuf;
diff --git a/configure.ac b/configure.ac
index ebab521..368f4aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,7 +157,11 @@ AS_IF(test x$RUSTC = xno,
 )
 
 dnl Release build we do.
+if test x$debug = xtrue; then
+CARGO_TARGET_SUBDIR=debug
+else
 CARGO_TARGET_SUBDIR=release
+fi
 AC_SUBST(CARGO_TARGET_SUBDIR)
 
 
diff --git a/src/niepce/Makefile.am b/src/niepce/Makefile.am
index 21db85b..6efa909 100644
--- a/src/niepce/Makefile.am
+++ b/src/niepce/Makefile.am
@@ -34,3 +34,42 @@ niepce_SOURCES = \
        notificationcenter.hpp notificationcenter.cpp \
         notifications.hpp \
        main.cpp
+
+RUST_SOURCES = \
+       @top_srcdir@/src/lib.rs \
+       @top_srcdir@/src/engine/db/keyword.rs \
+       @top_srcdir@/src/engine/db/fsfile.rs \
+       @top_srcdir@/src/engine/db/libfile.rs \
+       @top_srcdir@/src/engine/db/filebundle.rs \
+       @top_srcdir@/src/engine/db/mod.rs \
+       @top_srcdir@/src/engine/db/libfolder.rs \
+       @top_srcdir@/src/engine/mod.rs \
+       @top_srcdir@/src/fwk/utils/exempi.rs \
+       @top_srcdir@/src/fwk/utils/mod.rs \
+       @top_srcdir@/src/fwk/base/fractions.rs \
+       @top_srcdir@/src/fwk/base/mod.rs \
+       @top_srcdir@/src/fwk/mod.rs \
+       @top_srcdir@/src/fwk/toolkit/mimetype.rs \
+       @top_srcdir@/src/fwk/toolkit/mod.rs \
+       @top_srcdir@/build.rs \
+       @top_srcdir@/Cargo.toml \
+       $(NULL)
+
+EXTRA_DIST = \
+       $(RUST_SOURCES) \
+       $(NULL)
+
+@top_builddir@/target/@CARGO_TARGET_SUBDIR@/libniepce_rust.a: $(RUST_SOURCES)
+       (cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build $(CARGO_RELEASE_ARGS))
+
+if DEBUG
+CARGO_RELEASE_ARGS=
+else
+CARGO_RELEASE_ARGS=--release
+endif
+
+clean-local:
+       -(cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo clean $(CARGO_RELEASE_ARGS))
+
+check-local:
+       (cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo test $(CARGO_RELEASE_ARGS))


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