Merge pull request #43 from TheBlueMatt/main
[ldk-c-bindings] / genbindings.sh
index c1bfc8dde3cc6b993c7ba1de73f0cd0af7bf8074..e6ffd8bb5a9f17d42707b96747d92f49f22e69e6 100755 (executable)
@@ -183,7 +183,7 @@ echo -e '}' >> lightning-c-bindings/src/version.rs
 # Now cd to lightning-c-bindings, build the generated bindings, and call cbindgen to build a C header file
 cd lightning-c-bindings
 
-cargo build
+RUSTFLAGS="$RUSTFLAGS --cfg=test_mod_pointers" cargo build
 if [ "$CFLAGS_aarch64_apple_darwin" != "" ]; then
        RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14" cargo build --target aarch64-apple-darwin
 fi
@@ -273,7 +273,7 @@ mv include/lightningpp_new.hpp include/lightningpp.hpp
 
 # Finally, sanity-check the generated C and C++ bindings with demo apps:
 # Naively run the C demo app:
-gcc $LOCAL_CFLAGS -Wall -g -pthread demo.c target/debug/libldk.a -ldl
+gcc $LOCAL_CFLAGS -Wall -g -pthread demo.c target/debug/libldk.a -ldl -lm
 ./a.out
 
 # And run the C++ demo app
@@ -283,7 +283,7 @@ LD_LIBRARY_PATH=target/debug/ ./a.out > /dev/null
 # Finally, run the C++ demo app with our native networking library
 # in valgrind to test memory model correctness and lack of leaks.
 gcc $LOCAL_CFLAGS -fPIC -std=c99 -Wall -g -pthread -I../ldk-net ../ldk-net/ldk_net.c -c -o ldk_net.o
-g++ $LOCAL_CFLAGS -std=c++11 -Wall -g -pthread -DREAL_NET -I../ldk-net ldk_net.o demo.cpp target/debug/libldk.a -ldl
+g++ $LOCAL_CFLAGS -std=c++11 -Wall -g -pthread -DREAL_NET -I../ldk-net ldk_net.o demo.cpp target/debug/libldk.a -ldl -lm
 if [ -x "`which valgrind`" ]; then
        valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
        echo
@@ -403,7 +403,7 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" -o "$HOST_PLATFORM" = "
                if [ "$CFLAGS_aarch64_apple_darwin" != "" ]; then
                        RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14" RUSTC_BOOTSTRAP=1 cargo rustc --target aarch64-apple-darwin -v -- -Zsanitizer=address -Cforce-frame-pointers=yes || ( mv Cargo.toml.bk Cargo.toml; exit 1)
                fi
-               RUSTC_BOOTSTRAP=1 cargo rustc -v -- -Zsanitizer=address -Cforce-frame-pointers=yes || ( mv Cargo.toml.bk Cargo.toml; exit 1)
+               RUSTFLAGS="$RUSTFLAGS --cfg=test_mod_pointers" RUSTC_BOOTSTRAP=1 cargo rustc -v -- -Zsanitizer=address -Cforce-frame-pointers=yes || ( mv Cargo.toml.bk Cargo.toml; exit 1)
                mv Cargo.toml.bk Cargo.toml
 
                # First the C demo app...