[niepce] Issue #6 - Part 3: make Rust work
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Issue #6 - Part 3: make Rust work
- Date: Sun, 11 Feb 2018 21:10:56 +0000 (UTC)
commit 9e99c9c63052789c370078fa0b7f179d72b45124
Author: Hubert Figuière <hub figuiere net>
Date: Sun Feb 11 15:51:32 2018 -0500
Issue #6 - Part 3: make Rust work
- Can build outside of srcdir: properly generate the C bindings header
in the right place.
- also reorder modules
https://gitlab.gnome.org/GNOME/niepce/issues/6
build.rs | 5 ++-
flatpak/org.gnome.Niepce.json | 100 +++++++++++++++++++++---------------------
src/Makefile.am | 23 ++++++----
3 files changed, 69 insertions(+), 59 deletions(-)
---
diff --git a/build.rs b/build.rs
index 173cd94..b8a4887 100644
--- a/build.rs
+++ b/build.rs
@@ -49,7 +49,10 @@ fn main() {
// Use cbindgen to generate C bindings.
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
+ let target_dir = env::var("CARGO_TARGET_DIR").unwrap();
+ let mut target_file = PathBuf::from(target_dir);
+ target_file.push("bindings.h");
cbindgen::generate(&crate_dir)
.unwrap()
- .write_to_file("target/bindings.h");
+ .write_to_file(&*target_file.to_string_lossy());
}
diff --git a/flatpak/org.gnome.Niepce.json b/flatpak/org.gnome.Niepce.json
index 6c0a268..bb34c3a 100644
--- a/flatpak/org.gnome.Niepce.json
+++ b/flatpak/org.gnome.Niepce.json
@@ -25,8 +25,10 @@
"cflags" : "-O2 -g",
"cxxflags" : "-O2 -g",
"env" : {
+ "CARGO_HOME" : "/run/build/niepce/cargo",
"V" : "1"
- }
+ },
+ "append-path" : "/usr/lib/sdk/rust-stable/bin"
},
"cleanup" : [
"*.la",
@@ -34,54 +36,12 @@
],
"modules" : [
{
- "name" : "boost",
- "config-opts" : [
- "--with-toolset=gcc",
- "--with-icu"
- ],
- "cleanup" : [
- "/lib/libboost_*.a"
- ],
- "sources" : [
- {
- "type" : "archive",
- "url" :
"https://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.bz2",
- "sha256" : "686affff989ac2488f79a97b9479efb9f2abae035b5ed4d8226de6857933fd3b"
- },
- {
- "type" : "file",
- "path" : "boost-configure",
- "dest-filename" : "configure"
- }
- ]
- },
- {
- "name" : "exempi",
- "sources" : [
- {
- "type" : "archive",
- "url" : "https://libopenraw.freedesktop.org/download/exempi-2.4.3.tar.bz2",
- "sha256" : "bfd1d8ebffe07918a5bfc7a5130ff82486d35575827cae8d131b9fa1c0c29c6e"
- }
- ]
- },
- {
- "name" : "libopenraw",
+ "name" : "libgphoto2",
"sources" : [
{
"type" : "archive",
- "url" : "https://libopenraw.freedesktop.org/download/libopenraw-0.1.2.tar.bz2",
- "sha256" : "d15e86141add6a652f316ab8884895d8399d37c17510b34f61e266f906a99683"
- },
- {
- "type" : "patch",
- "path" : "libopenraw-pixbuf-disable.diff"
- },
- {
- "type" : "shell",
- "commands" : [
- "autoreconf -si"
- ]
+ "url" :
"https://cytranet.dl.sourceforge.net/project/gphoto/libgphoto/2.5.16/libgphoto2-2.5.16.tar.bz2",
+ "sha256" : "e757416d1623e01a9d0d294b2e790162e434c0964f50d3b7ff1a3424b62a2906"
}
]
},
@@ -253,12 +213,54 @@
]
},
{
- "name" : "libgphoto2",
+ "name" : "boost",
+ "config-opts" : [
+ "--with-toolset=gcc",
+ "--with-icu"
+ ],
+ "cleanup" : [
+ "/lib/libboost_*.a"
+ ],
"sources" : [
{
"type" : "archive",
- "url" :
"https://cytranet.dl.sourceforge.net/project/gphoto/libgphoto/2.5.16/libgphoto2-2.5.16.tar.bz2",
- "sha256" : "e757416d1623e01a9d0d294b2e790162e434c0964f50d3b7ff1a3424b62a2906"
+ "url" :
"https://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.bz2",
+ "sha256" : "686affff989ac2488f79a97b9479efb9f2abae035b5ed4d8226de6857933fd3b"
+ },
+ {
+ "type" : "file",
+ "path" : "boost-configure",
+ "dest-filename" : "configure"
+ }
+ ]
+ },
+ {
+ "name" : "exempi",
+ "sources" : [
+ {
+ "type" : "archive",
+ "url" : "https://libopenraw.freedesktop.org/download/exempi-2.4.3.tar.bz2",
+ "sha256" : "bfd1d8ebffe07918a5bfc7a5130ff82486d35575827cae8d131b9fa1c0c29c6e"
+ }
+ ]
+ },
+ {
+ "name" : "libopenraw",
+ "sources" : [
+ {
+ "type" : "archive",
+ "url" : "https://libopenraw.freedesktop.org/download/libopenraw-0.1.2.tar.bz2",
+ "sha256" : "d15e86141add6a652f316ab8884895d8399d37c17510b34f61e266f906a99683"
+ },
+ {
+ "type" : "patch",
+ "path" : "libopenraw-pixbuf-disable.diff"
+ },
+ {
+ "type" : "shell",
+ "commands" : [
+ "autoreconf -si"
+ ]
}
]
},
diff --git a/src/Makefile.am b/src/Makefile.am
index bf29b29..7bbfc90 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,12 +50,6 @@ EXTRA_DIST = \
$(RUST_SOURCES) \
$(NULL)
-@top_builddir@/target/@CARGO_TARGET_SUBDIR@/libniepce_rust.a: @top_builddir@/target/bindings.h
-
-@top_builddir@/target/bindings.h: $(RUST_SOURCES)
- cd $(top_srcdir) &&\
- CARGO_TARGET_DIR=@abs_top_builddir@/target cargo build $(CARGO_VERBOSE) $(CARGO_RELEASE_ARGS)
-
CARGO_VERBOSE = $(cargo_verbose_$(V))
cargo_verbose_ = $(cargo_verbose_$(AM_DEFAULT_VERBOSITY))
cargo_verbose_0 =
@@ -67,10 +61,21 @@ else
CARGO_RELEASE_ARGS=--release
endif
-all-local: @top_builddir@/target/@CARGO_TARGET_SUBDIR@/libniepce_rust.a
+CARGO_TARGET_DIR=@abs_top_builddir@/target
+
+all-local: $(CARGO_TARGET_DIR)/@CARGO_TARGET_SUBDIR@/libniepce_rust.a
+
+@abs_top_builddir@/target/@CARGO_TARGET_SUBDIR@/libniepce_rust.a: $(CARGO_TARGET_DIR)/bindings.h
+
+@abs_top_builddir@/target/bindings.h: $(RUST_SOURCES)
+ cd $(top_srcdir) && \
+ CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) cargo build $(CARGO_VERBOSE) $(CARGO_RELEASE_ARGS)
+
clean-local:
- -(cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo clean $(CARGO_RELEASE_ARGS))
+ cd $(top_srcdir) && \
+ CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) cargo clean $(CARGO_VERBOSE) $(CARGO_RELEASE_ARGS)
check-local:
- (cd $(top_srcdir) ; CARGO_TARGET_DIR=@abs_top_builddir@/target cargo test $(CARGO_RELEASE_ARGS))
+ cd $(top_srcdir) &&
+ CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) cargo test $(CARGO_VERBOSE) $(CARGO_RELEASE_ARGS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]