Update lightning-c-bindings Cargo.toml and CI to 0.0.109
[ldk-c-bindings] / deterministic-build-wrappers / rustc
1 #!/bin/bash
2 # rustc calculates a unique metadata tag to mangle symbols which includes the
3 # actual path to the crate. This breaks our deterministic builds as we depend
4 # on a copy of rust-lightning via a path. We insert this shim between cargo and
5 # rustc and edit the metadata tag for rust-lightning.
6 # While we could just set RUSTFLAGS="-C metadata=42", this would break if we
7 # ever (indirectly) depend on multiple versions of the same crate.
8 args=("$@")
9 IS_LIGHTNING=false
10 for ((i=0; i<"${#args[@]}"; ++i)); do
11     case ${args[i]} in
12         --crate-name)
13                         if [ "${args[i+1]}" = "lightning" -o "${args[i+1]}" = "lightning_background_processor" -o "${args[i+1]}" = "lightning_invoice" -o "${args[i+1]}" = "lightning_persister" -o "${args[i+1]}" = "ldk" ]; then
14                                 IS_LIGHTNING=true
15                         fi
16                         ;;
17     esac
18 done
19 for ((i=0; i<"${#args[@]}"; ++i)); do
20     case ${args[i]} in
21         metadata*)
22                         if [ "$IS_LIGHTNING" = "true" ]; then
23                                 # Pick any random value for metadata, it doesn't matter
24                                 args[i]="metadata=42"
25                         fi
26                         ;;
27     esac
28 done
29
30 $LDK_RUSTC_PATH "${args[@]}"