summaryrefslogtreecommitdiff
path: root/build-aux/cargo-vendor.sh
blob: 2ad5dd36ec052847e0ad9e8e48ddf183a54c0be5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/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
rm vendor/windows*gnu*/lib/*.a
rm vendor/windows*msvc*/lib/*.lib

mkdir .cargo
cat > .cargo/config.toml <<EOF
[net]
offline = true

[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
EOF