From: Matt Corallo Date: Mon, 22 Nov 2021 02:06:37 +0000 (+0000) Subject: Support new c_bindings cfg flag to enable bindings-specific logic X-Git-Tag: v0.0.103.1^2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=commitdiff_plain;h=8ec4367ec2c03706137eecfb725bace76b0aab76 Support new c_bindings cfg flag to enable bindings-specific logic --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1fde26..e7657d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: run: | # Note that the version tags aren't checked into git touch src/version.rs - cargo check + RUSTFLAGS="--cfg=c_bindings" cargo check - name: Install cbindgen run: cargo install --force cbindgen - name: Checkout Rust-Lightning git diff --git a/genbindings.sh b/genbindings.sh index f90aaf0..f572ccc 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -31,10 +31,9 @@ PATH="$PATH:~/.cargo/bin" # Set up CFLAGS and RUSTFLAGS vars appropriately for building libsecp256k1 and demo apps... BASE_CFLAGS="" # CFLAGS for libsecp256k1 LOCAL_CFLAGS="" # CFLAGS for demo apps -BASE_RUSTFLAGS="" # RUSTFLAGS # Remap paths so that our builds are deterministic -BASE_RUSTFLAGS="--remap-path-prefix $LIGHTNING_PATH=rust-lightning --remap-path-prefix $(pwd)=ldk-c-bindings --remap-path-prefix $HOME/.cargo=" +BASE_RUSTFLAGS="--cfg=c_bindings --remap-path-prefix $LIGHTNING_PATH=rust-lightning --remap-path-prefix $(pwd)=ldk-c-bindings --remap-path-prefix $HOME/.cargo=" # If the C compiler supports it, also set -ffile-prefix-map echo "int main() {}" > genbindings_path_map_test_file.c @@ -128,7 +127,7 @@ BIN="$(pwd)/c-bindings-gen/target/release/c-bindings-gen" function add_crate() { pushd "$LIGHTNING_PATH/$1" - RUSTC_BOOTSTRAP=1 cargo rustc --profile=check $3 -- -Zunpretty=expanded > /tmp/$1-crate-source.txt + RUSTC_BOOTSTRAP=1 cargo rustc --profile=check $3 -- --cfg=c_bindings -Zunpretty=expanded > /tmp/$1-crate-source.txt popd if [ "$HOST_PLATFORM" = "host: x86_64-apple-darwin" ]; then sed -i".original" "1i\\