install-rust-fil-sector-builder 1.24 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
    cp "${tmp_dir}/bin/paramcache" .
21
else
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    if [ $CI = "true" ]; then
        (>&2 echo "failed to find or obtain precompiled assets for ${subm_dir} - falling back to local build")
        build_from_source "${subm_dir}"

        mkdir -p include
        mkdir -p lib/pkgconfig

        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 -- "{}" . \;

        (>&2 echo "WARNING: paramcache was not installed - you may wish to 'cargo install' it")
    else
        (>&2 echo "build failed: could not obtain precompiled assets for ${subm_dir} - contact @laser or @dignifiedquire")
        exit 1
    fi
38
fi