core: use "auto" as the default clock-master source
[vlc.git] / contrib / cargo-vendor-archive.sh
blob45442e67364a540d797f2187606f11eb82d8bc1a
1 #!/bin/sh
3 set -e
5 usage()
7 cat << EOF
8 usage: $0 <archive>
10 Fetch and archive all dependencies from a Rust archive using 'cargo vendor'.
11 EOF
14 if [ "x$1" = "x" ]; then
15 usage
16 exit 1
19 # Setup cargo path
20 CARGO=
21 if [ -d "$(dirname $0)/bin/.cargo" ];then
22 CARGO_HOME=$(cd $(dirname $0)/bin/.cargo && pwd)
23 CARGO="CARGO_HOME=\"${CARGO_HOME}\" \"${CARGO_HOME}/bin/cargo\""
24 else
25 CARGO=cargo
28 # Extract archive into a tmp dir
29 TMP_DIR=.tmp-$(basename $1)
30 rm -rf ${TMP_DIR}
31 mkdir ${TMP_DIR}
33 tar xf "$1" -C ${TMP_DIR}
34 cd ${TMP_DIR}/*
36 # Fetch all dependencies
37 eval ${CARGO} vendor --locked
39 # Archive all dependencies
40 name=$(basename `pwd`)-vendor
41 tar -jcf "../../${name}.tar.bz2" vendor --transform "s,vendor,${name},"
42 cd ../..
43 rm -rf ${TMP_DIR}
45 echo ""
46 echo "Please upload this package '${name}.tar.bz2' to our VideoLAN FTP,"
47 echo ""
48 echo "and write the following checksum into the contrib/src/<project>/cargo-vendor-SHA512SUMS:"
49 echo ""
50 sha512sum ${name}.tar.bz2