Skip to content

Commit 255eea0

Browse files
authored
[wasm] Add pinvokes for System.IO.Compression.dll. (#38925)
1 parent d3f62bd commit 255eea0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/mono/wasm/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ BINDIR?=$(TOP)/artifacts/bin
1313
OBJDIR?=$(TOP)/artifacts/obj
1414
PINVOKE_TABLE?=$(TOP)/artifacts/obj/wasm/pinvoke-table.h
1515
MONO_BIN_DIR?=$(BINDIR)/mono/Browser.wasm.$(CONFIG)
16-
SYS_NATIVE_DIR?=$(OBJDIR)/native/net5.0-Browser-$(CONFIG)-wasm/System.Native
16+
NATIVE_DIR?=$(OBJDIR)/native/net5.0-Browser-$(CONFIG)-wasm
1717
BUILDS_BIN_DIR?=$(BINDIR)/native/net5.0-Browser-$(CONFIG)-wasm
1818

1919
all: build-native timezone-data
@@ -54,7 +54,8 @@ MONO_LIBS = \
5454
$(MONO_BIN_DIR)/libmonosgen-2.0.a \
5555
$(MONO_BIN_DIR)/libmono-ilgen.a \
5656
$(MONO_BIN_DIR)/libmono-icall-table.a \
57-
${SYS_NATIVE_DIR}/libSystem.Native.a
57+
${NATIVE_DIR}/System.Native/libSystem.Native.a \
58+
${NATIVE_DIR}/System.IO.Compression.Native/libSystem.IO.Compression.Native.a
5859

5960
EMCC_FLAGS=--profiling-funcs -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN=1 -s ALIASING_FUNCTION_POINTERS=0 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'FS_createPath', 'FS_createDataFile', 'cwrap', 'setValue', 'getValue', 'UTF8ToString', 'UTF8ArrayToString', 'addFunction']" -s "EXPORTED_FUNCTIONS=['_putchar']" --source-map-base http://example.com -emit-llvm -s FORCE_FILESYSTEM=1 -s USE_ZLIB=1
6061
EMCC_DEBUG_FLAGS =-g -Os -s ASSERTIONS=1 -DENABLE_NETCORE=1 -DDEBUG=1
@@ -118,6 +119,9 @@ timezone-data:
118119
runtime:
119120
EMSDK_PATH=$(TOP)/src/mono/wasm/emsdk $(TOP)/build.sh --subset mono --arch wasm --os Browser -c $(CONFIG)
120121

122+
build-all:
123+
EMSDK_PATH=$(TOP)/src/mono/wasm/emsdk $(TOP)/build.sh --subset mono+libs --arch wasm --os Browser -c $(CONFIG)
124+
121125
test-runner:
122126
$(DOTNET) build $(TOP)/src/libraries/Common/tests/WasmTestRunner /p:Configuration=$(CONFIG)
123127

src/mono/wasm/wasm.targets

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
<ItemGroup>
1111
<WasmPInvokeModules Include="libSystem.Native"/>
12+
<WasmPInvokeModules Include="libSystem.IO.Compression.Native"/>
1213
<WasmPInvokeAssemblies Include="$(MonoArtifactsPath)\System.Private.CoreLib.dll"/>
1314
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.Runtime\$(NetCoreAppCurrent)-$(Configuration)\System.Runtime.dll"/>
1415
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.Console\$(NetCoreAppCurrent)-Browser-$(Configuration)\System.Console.dll"/>
@@ -19,6 +20,8 @@
1920
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.Net.Primitives\$(NetCoreAppCurrent)-Browser-$(Configuration)\System.Net.Primitives.dll"/>
2021
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.Net.NameResolution\$(NetCoreAppCurrent)-Browser-$(Configuration)\System.Net.NameResolution.dll"/>
2122
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.Security.Cryptography.Algorithms\$(NetCoreAppCurrent)-Browser-$(Configuration)\System.Security.Cryptography.Algorithms.dll"/>
23+
<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.IO.Compression\$(NetCoreAppCurrent)-Browser-$(Configuration)\System.IO.Compression.dll"/>
24+
<!--<WasmPInvokeAssemblies Include="$(ArtifactsBinDir)\System.IO.Compression.Brotli\$(NetCoreAppCurrent)-Unix-$(Configuration)\System.IO.Compression.Brotli.dll"/>-->
2225
</ItemGroup>
2326

2427
<Target Name="CheckEnv">
@@ -38,7 +41,7 @@
3841

3942
<Target Name="BuildWasmRuntimes"
4043
DependsOnTargets="BuildPInvokeTable">
41-
<Exec Command="make -C $(MonoProjectRoot)wasm all SHELL=/bin/bash BINDIR=$(ArtifactsBinDir) MONO_BIN_DIR=$(MonoArtifactsPath) OBJDIR=$(ArtifactsObjDir) BUILDS_BIN_DIR=$(NativeBinDir) SYS_NATIVE_DIR=$(ArtifactsObjDir)/native/$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)/System.Native CONFIG=$(Configuration) PINVOKE_TABLE=$(WasmPInvokeTablePath)" IgnoreStandardErrorWarningFormat="true"/>
44+
<Exec Command="make -C $(MonoProjectRoot)wasm all SHELL=/bin/bash BINDIR=$(ArtifactsBinDir) MONO_BIN_DIR=$(MonoArtifactsPath) OBJDIR=$(ArtifactsObjDir) BUILDS_BIN_DIR=$(NativeBinDir) NATIVE_DIR=$(ArtifactsObjDir)/native/$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture) CONFIG=$(Configuration) PINVOKE_TABLE=$(WasmPInvokeTablePath)" IgnoreStandardErrorWarningFormat="true"/>
4245
</Target>
4346

4447
</Project>

0 commit comments

Comments
 (0)