install-rust-fil-sector-builder 1.55 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash

set -Eeo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"
source "install-shared.bash"

subm_dir="rust-fil-sector-builder"

git submodule update --init --recursive $subm_dir

if download_release_tarball tarball_path "${subm_dir}"; then
    tmp_dir=$(mktemp -d)
14
    tar -C "$tmp_dir" -xzf "$tarball_path"
15

16
17
18
    cp "${tmp_dir}/include/sector_builder_ffi.h" .
    cp "${tmp_dir}/lib/libsector_builder_ffi.a" .
    cp "${tmp_dir}/lib/pkgconfig/sector_builder_ffi.pc" .
Sidney Keese's avatar
Sidney Keese committed
19
20
21

    mkdir -p bin
    cp "${tmp_dir}/bin/paramfetch" bin
22
else
23
    (>&2 echo "failed to find or obtain precompiled assets for ${subm_dir} - falling back to local build")
24
25
26
27
28
    build_from_source "${subm_dir}"

    mkdir -p include
    mkdir -p lib/pkgconfig

29
30
31
    find "${subm_dir}" -type f -name sector_builder_ffi.h -exec cp -- "{}" . \;
    find "${subm_dir}" -type f -name libsector_builder_ffi.a -exec cp -- "{}" . \;
    find "${subm_dir}" -type f -name sector_builder_ffi.pc -exec cp -- "{}" . \;
Sidney Keese's avatar
Sidney Keese committed
32
33
34

    pushd $subm_dir

35
36
37
38
39
40
41
42
43
44
45
46
47
    s="WARNING: paramfetch cannot be built from rust-fil-sector-builder "
    s+="sources. Installing from HEAD of rust-fil-proofs master. The installed "
    s+="version of paramfetch may be incompatible with your version of "
    s+="rust-fil-sector-builder, which could result in you downloading "
    s+="incompatible Groth parameters and verifying keys."

    (>&2 echo s)
    cargo install filecoin-proofs \
      --bin paramfetch \
      --force \
      --git=https://github.com/filecoin-project/rust-fil-proofs.git \
      --branch=master \
      --root ".."
Sidney Keese's avatar
Sidney Keese committed
48
49

    popd
50
fi