]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Support new c_bindings cfg flag to enable bindings-specific logic
authorMatt Corallo <git@bluematt.me>
Mon, 22 Nov 2021 02:06:37 +0000 (02:06 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 30 Nov 2021 16:05:44 +0000 (16:05 +0000)
.github/workflows/build.yml
genbindings.sh

index a1fde26b241f4b843cbf8efa70b6bff84c442614..e7657d102a5afc15aba6782190d93cfbac5a53a8 100644 (file)
@@ -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
index f90aaf0525a8420d28afbe56f8197c121c4b8d57..f572ccc58729fa341df495a3fc65410f8f508b21 100755 (executable)
@@ -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\\