[librsvg] Makefile.am: Add "cargo vendor" to dist-hook



commit 0216b4d9cf5c36f8e67dbcc0c9ec9b19d45b7f91
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Sep 1 13:14:53 2017 -0500

    Makefile.am: Add "cargo vendor" to dist-hook
    
    Thanks to
    https://github.com/endlessm/ostree/blob/47a54bf876023b0cb457bc8a4f4264f9b2ed5438/Makefile.am
    for the incantations.
    
    This makes it possible to release tarballs with all the Rust
    dependencies embedded in them.
    
    Hopefully this paves the way for distros to use Cargo's source
    replacement to build librsvg with their own versions of dependencies.

 Makefile.am              |    9 ++++++++-
 rust/cargo-vendor-config |   11 +++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 544be5d..c212de8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -100,7 +100,8 @@ RUST_SOURCES =                                      \
        rust/src/viewbox.rs
 
 RUST_EXTRA =                                   \
-       rust/Cargo.lock
+       rust/Cargo.lock                         \
+       rust/cargo-vendor-config
 
 if DEBUG_RELEASE
 CARGO_RELEASE_ARGS=
@@ -118,6 +119,12 @@ clean-local:
        cd $(top_srcdir)/rust && \
        CARGO_TARGET_DIR=@abs_top_builddir@/rust/target cargo clean
 
+dist-hook:
+       (cd $(distdir)/rust && \
+       cargo vendor -q && \
+       mkdir .cargo && \
+       cp cargo-vendor-config .cargo/config)
+
 @abs_top_builddir@/rust/target/@RUST_TARGET_SUBDIR@/librsvg_internals.a: $(RUST_SOURCES)
        cd $(top_srcdir)/rust && \
        CARGO_TARGET_DIR=@abs_top_builddir@/rust/target cargo build --verbose $(CARGO_RELEASE_ARGS)
diff --git a/rust/cargo-vendor-config b/rust/cargo-vendor-config
new file mode 100644
index 0000000..a94e912
--- /dev/null
+++ b/rust/cargo-vendor-config
@@ -0,0 +1,11 @@
+# This is used after `cargo vendor` is run from `make dist`.
+#
+# In the distributed tarball, this file should end up in
+# rust/.cargo/config
+
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = './vendor'


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