Set the C target to wasm32-wasi rather than wasm32
[ldk-c-bindings] / genbindings.sh
index 94800ff6416c6921f1021619c32b9c8ba4c78044..f26ea5d38057ca2c81813a9ef3f2cf8da954d50f 100755 (executable)
@@ -272,7 +272,7 @@ while read LINE; do
                                echo "Unable to find method declaration for $LINE"
                                exit 1
                        fi
-                       RETVAL="$(echo "$METHOD" | sed 's/[ ]*\([A-Za-z0-9 _]*\)(\*\(.*\)).*/\1/' | sed 's/^struct LDK/LDK::/g' | tr -d ' ')"
+                       RETVAL="$(echo "$METHOD" | sed 's/[ ]*\([A-Za-z0-9 _]*\)(\*\(.*\)).*/\1/' | sed -E 's/^(struct|enum) LDK/LDK::/g' | tr -d ' ')"
                        [ "$RETVAL" = "LDK::SecretKey" ] && RETVAL="LDKSecretKey"
                        [ "$RETVAL" = "LDK::PublicKey" ] && RETVAL="LDKPublicKey"
                        [ "$RETVAL" = "LDK::ThirtyTwoBytes" ] && RETVAL="LDKThirtyTwoBytes"
@@ -509,9 +509,9 @@ if [ "$2" = "false" -a "$(rustc --print target-list | grep wasm32-wasi)" != "" ]
        echo "int main() {}" > genbindings_wasm_test_file.c
        if clang -nostdlib -o /dev/null --target=wasm32-wasi -Wl,--no-entry genbindings_wasm_test_file.c > /dev/null 2>&1; then
                # And if it does, build a WASM binary without capturing errors
-               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -target wasm32 -O1"
+               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -target wasm32-wasi -O1"
                RUSTFLAGS="$BASE_RUSTFLAGS -C opt-level=1 --cfg=test_mod_pointers" cargo build $CARGO_BUILD_ARGS -v --target=wasm32-wasi
-               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -fembed-bitcode -target wasm32 -Oz"
+               export CFLAGS_wasm32_wasi="$BASE_CFLAGS -fembed-bitcode -target wasm32-wasi -Oz"
                RUSTFLAGS="$BASE_RUSTFLAGS -C embed-bitcode=yes -C opt-level=z -C linker-plugin-lto -C lto" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target=wasm32-wasi
        else
                echo "Cannot build WASM lib as clang does not seem to support the wasm32-wasi target"