run: cargo install --force cbindgen
- name: Checkout Rust-Lightning git
run: git clone https://github.com/rust-bitcoin/rust-lightning
+ - name: Rebuild bindings without std, and check the sample app builds + links
+ run: ./genbindings.sh ./rust-lightning false
- name: Rebuild bindings, and check the sample app builds + links
- run: ./genbindings.sh ./rust-lightning
+ run: ./genbindings.sh ./rust-lightning true
- name: Check that the latest bindings are in git
run: |
git checkout lightning-c-bindings/Cargo.toml # genbindings edits this to update the path
if i == "any" {
// #[cfg(any(test, feature = ""))]
if let TokenTree::Group(g) = iter.next().unwrap() {
- if let TokenTree::Ident(i) = g.stream().into_iter().next().unwrap() {
- if i == "test" || i == "feature" {
- // If its cfg(feature(...)) we assume its test-only
- return ExportStatus::TestOnly;
+ let mut all_test = true;
+ for token in g.stream().into_iter() {
+ if let TokenTree::Ident(i) = token {
+ match format!("{}", i).as_str() {
+ "test" => {},
+ "feature" => {},
+ _ => all_test = false,
+ }
+ } else if let TokenTree::Literal(lit) = token {
+ if format!("{}", lit) != "fuzztarget" {
+ all_test = false;
+ }
}
}
+ if all_test { return ExportStatus::TestOnly; }
}
} else if i == "test" || i == "feature" {
// If its cfg(feature(...)) we assume its test-only
set -e
set -x
-if [ ! -d "$1/lightning" ]; then
- echo "USAGE: $0 path-to-rust-lightning"
+if [ ! -d "$1/lightning" -o "$2" != "true" -a "$2" != "false" ]; then
+ echo "USAGE: $0 path-to-rust-lightning allow-std"
+ echo "allow-std must be either 'true' or 'false' to indicate if we should be built relying on time and pthread support"
exit 1
fi
+if [ "$2" = "true" ]; then
+ FEATURES_ARGS='--features=allow_wallclock_use'
+ FEATURES='"allow_wallclock_use"'
+fi
+
# On reasonable systems, we can use realpath here, but OSX is a diva with 20-year-old software.
ORIG_PWD="$(pwd)"
cd "$1/lightning"
BIN="$(pwd)/c-bindings-gen/target/release/c-bindings-gen"
pushd "$LIGHTNING_PATH"
-RUSTC_BOOTSTRAP=1 cargo rustc --profile=check -- -Zunstable-options --pretty=expanded |
+RUSTC_BOOTSTRAP=1 cargo rustc $FEATURES_ARGS --profile=check -- -Zunstable-options --pretty=expanded |
RUST_BACKTRACE=1 "$BIN" "$OUT/" lightning "$OUT_TEMPL" "$OUT_F" "$OUT_CPP"
popd
HOST_PLATFORM="$(rustc --version --verbose | grep "host:")"
if [ "$HOST_PLATFORM" = "host: x86_64-apple-darwin" ]; then
# OSX sed is for some reason not compatible with GNU sed
- sed -i '' 's|lightning = { .*|lightning = { path = "'"$LIGHTNING_PATH"'" }|' lightning-c-bindings/Cargo.toml
+ sed -i '' 's|lightning = { .*|lightning = { path = "'"$LIGHTNING_PATH"'", features = ['"$FEATURES"'] }|' lightning-c-bindings/Cargo.toml
else
- sed -i 's|lightning = { .*|lightning = { path = "'"$LIGHTNING_PATH"'" }|' lightning-c-bindings/Cargo.toml
+ sed -i 's|lightning = { .*|lightning = { path = "'"$LIGHTNING_PATH"'", features = ['"$FEATURES"'] }|' lightning-c-bindings/Cargo.toml
fi
# Set path to include our rustc wrapper as well as cbindgen
bitcoin = "0.26"
secp256k1 = { version = "0.20.1", features = ["global-context-less-secure"] }
# Note that the following line is matched by genbindings to update the path
-lightning = { git = "https://git.bitcoin.ninja/rust-lightning", rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" }
+lightning = { git = "https://git.bitcoin.ninja/rust-lightning", rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3", features = ["allow_wallclock_use"] }
[patch.crates-io]
# Rust-Secp256k1 PR 279. Should be dropped once merged.