X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=genbindings.sh;h=f90aaf0525a8420d28afbe56f8197c121c4b8d57;hp=e6ffd8bb5a9f17d42707b96747d92f49f22e69e6;hb=18337a0191c3abdca8d51861c328dd3d2d9ca6b7;hpb=3b4ffd04a7610a70a7973b423344c0c3c8f4abff diff --git a/genbindings.sh b/genbindings.sh index e6ffd8b..f90aaf0 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -128,7 +128,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 -- -Zunstable-options --pretty=expanded > /tmp/$1-crate-source.txt + RUSTC_BOOTSTRAP=1 cargo rustc --profile=check $3 -- -Zunpretty=expanded > /tmp/$1-crate-source.txt popd if [ "$HOST_PLATFORM" = "host: x86_64-apple-darwin" ]; then sed -i".original" "1i\\ @@ -230,9 +230,12 @@ while read LINE; do # We'll print this at the end ;; "XXX"*) - STRUCT_NAME="$(echo "$LINE" | awk '{ print $2 }')" + NEW_STRUCT_NAME="$(echo "$LINE" | awk '{ print $2 }')" + if [ "$NEW_STRUCT_NAME" != "$STRUCT_NAME" ]; then + STRUCT_CONTENTS="$(cat include/lightning.h | sed -n -e "/struct LDK$NEW_STRUCT_NAME/{:s" -e "/\} LDK$NEW_STRUCT_NAME;/!{N" -e "b s" -e "}" -e p -e "}")" + fi + STRUCT_NAME="$NEW_STRUCT_NAME" METHOD_NAME="$(echo "$LINE" | awk '{ print $3 }')" - STRUCT_CONTENTS="$(cat include/lightning.h | sed -n -e "/struct LDK$STRUCT_NAME/{:s" -e "/\} LDK$STRUCT_NAME;/!{N" -e "b s" -e "}" -e p -e "}")" METHOD="$(echo "$STRUCT_CONTENTS" | grep "(\*$METHOD_NAME)")" if [ "$METHOD" = "" ]; then echo "Unable to find method declaration for $LINE"