projects
/
ldk-c-bindings
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f5b05cc
)
Fix build with old/OSX clang, fixes #15
author
Matt Corallo
<git@bluematt.me>
Mon, 26 Apr 2021 16:39:26 +0000
(16:39 +0000)
committer
Matt Corallo
<git@bluematt.me>
Mon, 26 Apr 2021 16:39:40 +0000
(16:39 +0000)
genbindings.sh
patch
|
blob
|
history
diff --git
a/genbindings.sh
b/genbindings.sh
index 8fd11889910401d21b01cbd6d81393a36ef34495..e85f14af5ac35e798fd34ab689bf4d55676e5b34 100755
(executable)
--- a/
genbindings.sh
+++ b/
genbindings.sh
@@
-87,9
+87,16
@@
fi
PATH="$(pwd)/deterministic-build-wrappers:$PATH:~/.cargo/bin"
# Now cd to lightning-c-bindings, build the generated bindings, and call cbindgen to build a C header file
cd lightning-c-bindings
PATH="$(pwd)/deterministic-build-wrappers:$PATH:~/.cargo/bin"
# Now cd to lightning-c-bindings, build the generated bindings, and call cbindgen to build a C header file
cd lightning-c-bindings
+
# Remap paths so that our builds are deterministic
export RUSTFLAGS="--remap-path-prefix $LIGHTNING_PATH=rust-lightning --remap-path-prefix $(pwd)=ldk-c-bindings --remap-path-prefix $HOME/.cargo= -C target-cpu=generic"
# Remap paths so that our builds are deterministic
export RUSTFLAGS="--remap-path-prefix $LIGHTNING_PATH=rust-lightning --remap-path-prefix $(pwd)=ldk-c-bindings --remap-path-prefix $HOME/.cargo= -C target-cpu=generic"
+
+# If the C compiler supports it, also set -ffile-prefix-map
+echo "int main() {}" > genbindings_path_map_test_file.c
+clang -o /dev/null -ffile-prefix-map=$HOME/.cargo= genbindings_path_map_test_file.c > /dev/null 2>&1 &&
+# Now that we've done our last non-LTO build, turn on LTO in CFLAGS as well
export CFLAGS="-ffile-prefix-map=$HOME/.cargo="
export CFLAGS="-ffile-prefix-map=$HOME/.cargo="
+rm genbindings_path_map_test_file.c
cargo build
cbindgen -v --config cbindgen.toml -o include/lightning.h >/dev/null 2>&1
cargo build
cbindgen -v --config cbindgen.toml -o include/lightning.h >/dev/null 2>&1