summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorHubert Figuière <hub@figuiere.net>2023-02-14 22:31:01 -0500
committerHubert Figuière <hub@figuiere.net>2023-02-14 22:31:01 -0500
commit1ec208ba623e6e2ccbdd0fee63ebfd183259cd43 (patch)
treef5053a38e605e43a1aedf2722b9c350ff98f759b /build-aux
parent46196647acfd2094d4c75b75a554ae9f5e3afa61 (diff)
rust: vendor crates in the tarball
- except for the winapi crate
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/cargo-vendor.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/build-aux/cargo-vendor.sh b/build-aux/cargo-vendor.sh
new file mode 100755
index 0000000..24800f0
--- /dev/null
+++ b/build-aux/cargo-vendor.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#
+# Run cargo vendor in the current directory ( $builddir ).
+# using the manifest in $1
+if [ -z "$1" ] ; then
+ echo "Argument needed"
+ exit 127
+fi
+if [ ! -f "$1" ] ; then
+ echo "No Cargo.toml found at $1"
+ exit 127
+fi
+
+cargo vendor --manifest-path "$1"
+
+# remove big binaries for Windows
+# Caveat this tarball won't build on Windows.
+# See https://github.com/rust-lang/cargo/issues/7058#issuecomment-751856262
+rm vendor/winapi*gnu*/lib/*.a
+
+mkdir .cargo
+cat > .cargo/config.toml <<EOF
+[net]
+offline = true
+
+[source.crates-io]
+replace-with = "vendored-sources"
+
+[source.vendored-sources]
+directory = "vendor"
+EOF