Add NetBird WASM build configuration

- Comment out problematic diplomat patch for WASM builds
- Add Makefile for easy WASM module building
This commit is contained in:
Viktor Liu
2025-08-28 23:15:01 +02:00
parent 303bee0456
commit 9901208bed
4 changed files with 68 additions and 23 deletions
Generated
+4 -18
View File
@@ -1225,7 +1225,8 @@ dependencies = [
[[package]]
name = "diplomat"
version = "0.7.0"
source = "git+https://github.com/CBenoit/diplomat?rev=6dc806e80162b6b39509a04a2835744236cd2396#6dc806e80162b6b39509a04a2835744236cd2396"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31672b3ebc3c7866c3c98726f7a9a5ac8f13962e77d3c8225f6be49a7b8c5f2"
dependencies = [
"diplomat_core",
"proc-macro2",
@@ -1242,7 +1243,8 @@ checksum = "f7b0f23d549a46540e26e5490cd44c64ced0d762959f1ffdec6ab0399634cf3c"
[[package]]
name = "diplomat_core"
version = "0.7.0"
source = "git+https://github.com/CBenoit/diplomat?rev=6dc806e80162b6b39509a04a2835744236cd2396#6dc806e80162b6b39509a04a2835744236cd2396"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfaa5e13e8b8735d2338f2836c06cd8643902ab87dda1dd07dbb351998ddc127"
dependencies = [
"lazy_static",
"proc-macro2",
@@ -2448,7 +2450,6 @@ dependencies = [
"tokio-util",
"tracing",
"tracing-subscriber",
"transport",
"url",
"uuid",
"whoami",
@@ -5706,21 +5707,6 @@ dependencies = [
"web-sys",
]
[[package]]
name = "transport"
version = "0.0.0"
source = "git+https://github.com/Devolutions/devolutions-gateway?rev=06e91dfe82751a6502eaf74b6a99663f06f0236d#06e91dfe82751a6502eaf74b6a99663f06f0236d"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"futures-util",
"parking_lot",
"pin-project-lite",
"tokio",
"tracing",
]
[[package]]
name = "try-lock"
version = "0.2.5"
+4 -4
View File
@@ -185,7 +185,7 @@ opt-level = 3
[profile.test.package.rand_chacha]
opt-level = 3
[patch.crates-io]
# FIXME: We need to catch up with Diplomat upstream again, but this is a significant amount of work.
# In the meantime, we use this forked version which fixes an undefined behavior in the code expanded by the bridge macro.
diplomat = { git = "https://github.com/CBenoit/diplomat", rev = "6dc806e80162b6b39509a04a2835744236cd2396" }
# [patch.crates-io]
# # FIXME: We need to catch up with Diplomat upstream again, but this is a significant amount of work.
# # In the meantime, we use this forked version which fixes an undefined behavior in the code expanded by the bridge macro.
# diplomat = { git = "https://github.com/CBenoit/diplomat", rev = "6dc806e80162b6b39509a04a2835744236cd2396" }
+59
View File
@@ -0,0 +1,59 @@
# IronRDP WASM Build for NetBird
BUILD_DIR := build
OUTPUT := $(BUILD_DIR)/ironrdp-pkg
WASM_OUTPUT := $(OUTPUT)/ironrdp_web_bg.wasm
IRONRDP_SOURCES := crates/ironrdp-web/src crates/ironrdp-web/Cargo.toml
.PHONY: all
all: build
.PHONY: build
build: check-rebuild
# Check if rebuild is needed based on source changes
.PHONY: check-rebuild
check-rebuild:
@if [ ! -f "$(WASM_OUTPUT)" ]; then \
echo "IronRDP output not found, building..."; \
$(MAKE) force-build; \
else \
REBUILD_NEEDED=0; \
for src in $(IRONRDP_SOURCES); do \
if [ -e "$$src" ] && find "$$src" -newer "$(WASM_OUTPUT)" -print -quit | grep -q .; then \
echo "IronRDP sources changed, rebuilding..."; \
REBUILD_NEEDED=1; \
break; \
fi; \
done; \
if [ "$$REBUILD_NEEDED" = "1" ]; then \
$(MAKE) force-build; \
else \
echo "IronRDP unchanged, skipping build..."; \
fi \
fi
# Force build without checking
.PHONY: force-build
force-build:
@echo "Building IronRDP WASM module..."
@mkdir -p $(BUILD_DIR)
@cd crates/ironrdp-web && \
wasm-pack build --release --target web --out-dir ../../$(OUTPUT) 2>&1 | tail -5
.PHONY: clean
clean:
@echo "Cleaning build artifacts..."
rm -rf $(BUILD_DIR)
cargo clean
.PHONY: help
help:
@echo "IronRDP WASM Build for NetBird"
@echo ""
@echo "Available targets:"
@echo " make - Build WASM module if sources changed (default)"
@echo " make build - Build WASM module if sources changed"
@echo " make force-build - Force rebuild regardless of changes"
@echo " make clean - Remove build artifacts"
@echo " make help - Show this help message"
+1 -1
View File
@@ -73,7 +73,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7" }
tokio-tungstenite = "0.27"
transport = { git = "https://github.com/Devolutions/devolutions-gateway", rev = "06e91dfe82751a6502eaf74b6a99663f06f0236d" }
# transport = { git = "https://github.com/Devolutions/devolutions-gateway", rev = "06e91dfe82751a6502eaf74b6a99663f06f0236d" }
futures-util = { version = "0.3", features = ["sink"] }
# Utils