Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Plugin] zlib [LFX 2023 Term 2] #2562

Merged
merged 122 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
fcc2423
Include wasmedge_zlib in plugins/CMakeLists.txt .
NeelDigonto Jun 5, 2023
2d866db
Add Zlib Plugin as an option in root CMakeLists.txt .
NeelDigonto Jun 5, 2023
b4d0cc4
Add zlib-ng dependency through FetchContent.
NeelDigonto Jun 5, 2023
da6a302
Added zlib build target for job 'build_ubuntu' in build-extensions.yml .
NeelDigonto Jun 5, 2023
cc0dd7c
Added zlib build target for job 'build_manylinux' in build-extensions…
NeelDigonto Jun 5, 2023
618c2e8
Init env & base headers, struct Wasm_z_stream & ZStreamMap
NeelDigonto Jun 5, 2023
c167c29
Added basic zlib function declarations.
NeelDigonto Jun 5, 2023
9b9e14d
Added zlib env implementation & PluginDescriptor.
NeelDigonto Jun 5, 2023
fcaa199
Added zlib module implementation, and added Host Functions.
NeelDigonto Jun 5, 2023
bf6adcd
Added zlib plugin WasmEdgeZlibDeflateInit_ implementation.
NeelDigonto Jun 6, 2023
9615d7b
Added zlib plugin WasmEdgeZlibInflateInit_ implementation.
NeelDigonto Jun 6, 2023
73e1dcb
Added zlib plugin WasmEdgeZlibDeflate implementation.
NeelDigonto Jun 6, 2023
0e61ff4
Added zlib plugin WasmEdgeZlibInflate implementation.
NeelDigonto Jun 6, 2023
9f692f0
Added zlib plugin WasmEdgeZlibDeflateEnd implementation.
NeelDigonto Jun 6, 2023
face6ab
Added zlib plugin WasmEdgeZlibInflateEnd implementation.
NeelDigonto Jun 6, 2023
a0cc2d2
Populated plugins/wasmedge_zlib/CMakeLists.txt to build & link the zl…
NeelDigonto Jun 6, 2023
a98bca1
Fix: Added ZLIB as link dep to wasmedge_zlib plugin.
NeelDigonto Jun 6, 2023
2b86685
Added basic test for zlib plugin; WIP/TODO.
NeelDigonto Jun 6, 2023
bc857cc
Added test/plugins/wasmedge_zlib/CMakeLists.txt to build and create z…
NeelDigonto Jun 6, 2023
7b0ed64
Include zlib plugin test sub directory in test/plugins/CMakeLists.txt.
NeelDigonto Jun 6, 2023
d6d969f
Fixed naming convention by omitting namespace prefix from function name.
NeelDigonto Jun 6, 2023
2027eac
Fix case sensitivity in CMake of zlib library.
NeelDigonto Jun 7, 2023
28cc2cf
Refactor build-extensions.yml to be in-line with upstream master.
NeelDigonto Jun 7, 2023
0d8c9b1
Fix typo in build-extensions.yml on zlib cmake option
NeelDigonto Jun 7, 2023
11ec48c
Merge branch 'master' into plugin/zlib
NeelDigonto Jun 7, 2023
014ae08
Merge branch 'master' into plugin/zlib
NeelDigonto Jun 13, 2023
cfb9147
Merge branch 'master' into plugin/zlib
NeelDigonto Jun 16, 2023
d5d4f36
Minor type changes to better reflect the Zlib API.
NeelDigonto Jun 24, 2023
a9e1bc2
Added Deflate Inflate Integration Test
NeelDigonto Jun 24, 2023
e80129c
Merge branch 'master' into plugin/zlib
NeelDigonto Jun 24, 2023
4431743
Merge branch 'master' into plugin/zlib
NeelDigonto Jun 26, 2023
ba8bff1
Removed unnecessary nulling of wasm module's z_stream allocators | Th…
NeelDigonto Jun 26, 2023
c081bf7
Added static_assert on Wasm_z_stream struct size.
NeelDigonto Jun 27, 2023
8a0ab93
Start writing to the wasm heap from address 1 onwards, to nto collide…
NeelDigonto Jun 27, 2023
20cf963
Fix: Correct Version Check and Stream Size Check Error code, and API …
NeelDigonto Jun 28, 2023
43def59
Added in-code documentation/pointer/reason on why we just compare onl…
NeelDigonto Jun 28, 2023
cce004a
Remove unsafe usage of wasm MemStart(pointer from base{0}). Converted…
NeelDigonto Jun 29, 2023
c74505d
Added in-code documentation to every field in Wasm_z_stream.
NeelDigonto Jun 29, 2023
89004fe
Honor LLVM Naming Convention: Change 'Wasm_z_stream' struct name to '…
NeelDigonto Jun 29, 2023
705dea5
Honor LLVM Naming Convention: Change 'Wasm_z_stream' struct name to '…
NeelDigonto Jun 29, 2023
d1f100b
Merge branch 'master' into plugin/zlib
NeelDigonto Jul 3, 2023
c6ed3da
Merge branch 'master' into plugin/zlib
NeelDigonto Jul 12, 2023
c7b4de2
Changed c style cast to static_cast.
NeelDigonto Aug 1, 2023
7465495
Updated a few variable name to reflect LLVM standards.
NeelDigonto Aug 1, 2023
4805d6d
Updated a few more variable name to reflect LLVM standards.
NeelDigonto Aug 1, 2023
7043935
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 1, 2023
fbfda7e
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 4, 2023
731d55a
Added a more comprehensive Host and Wasm ZStream Syncronization Func,…
NeelDigonto Aug 7, 2023
3151772
Change few comments.
NeelDigonto Aug 7, 2023
dbb9f7a
Add Condition to only add ZStream to internal registry, if init succe…
NeelDigonto Aug 7, 2023
a23011d
Remove unnecessary zlib version check in wasmedge, delegated it to th…
NeelDigonto Aug 7, 2023
0bafab8
Added WasmEdgeZlibDeflateSetDictionary and WasmEdgeZlibDeflateGetDict…
NeelDigonto Aug 7, 2023
e5c147e
Added WasmEdgeZlibDeflateCopy with a comment on impl. ref.
NeelDigonto Aug 7, 2023
364755f
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 10, 2023
dd125ab
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 11, 2023
076cd31
Added deflateReset
NeelDigonto Aug 11, 2023
6242f27
Added deflateParams
NeelDigonto Aug 11, 2023
57df5c7
Added deflateTune & deflateBound.
NeelDigonto Aug 11, 2023
84a3e9c
Added deflatePending & deflatePrime.
NeelDigonto Aug 11, 2023
b7b4572
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 16, 2023
b26c793
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 18, 2023
0a9329c
Defined the Wasm gz_header struct.
NeelDigonto Aug 18, 2023
ff5154d
Added few function impl of zlib.
NeelDigonto Aug 19, 2023
10125fd
Added most of non gz functions.
NeelDigonto Aug 19, 2023
9102cbb
Added adler32, adler32_z, crc32, crc32_z.
NeelDigonto Aug 19, 2023
ae5ed57
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 23, 2023
28bf85d
Remove _v2 postfix
NeelDigonto Aug 24, 2023
1e31c2d
Remove duplicate impl. of WasmEdgeZlibInflateSetDictionary.
NeelDigonto Aug 24, 2023
c607f08
Remove unused parameter 'Frame' from WasmEdgeZlibZlibCompilerFlags & …
NeelDigonto Aug 24, 2023
bea8b35
Correct few pointer value usage.
NeelDigonto Aug 24, 2023
7ee7a32
Added GZFile support Env & implemented WasmEdgeZlibGZDOpen.
NeelDigonto Aug 24, 2023
b54d126
Implemented gzbuffer, gzsetparams & gzread.
NeelDigonto Aug 24, 2023
5025c3d
Added gzfread, gzwrite & gzfwrite.
NeelDigonto Aug 24, 2023
08725d4
Added gzputs, gzgets, gzputc, gzgetc.
NeelDigonto Aug 24, 2023
9da46e0
Added gzflush & gzrewind
NeelDigonto Aug 24, 2023
44689d8
Remove unused parameter 'Frame'.
NeelDigonto Aug 24, 2023
ae9f871
Added gzeof, gzdirect, gzclose, gzclose_r, gzclose_w.
NeelDigonto Aug 24, 2023
429bda7
Added gzclearerr.
NeelDigonto Aug 24, 2023
5e3f686
Change void* to unsigned char*
NeelDigonto Aug 24, 2023
29c6f79
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 25, 2023
c18a104
Added gzgetc & gzungetc.
NeelDigonto Aug 25, 2023
ab3d3e0
Fix name Spell mistake.
NeelDigonto Aug 25, 2023
2b108fc
Merge remote-tracking branch 'refs/remotes/origin/plugin/zlib' into p…
NeelDigonto Aug 25, 2023
643e32d
Fixed no-return on a Expect<void>.
NeelDigonto Aug 30, 2023
21a6c6a
Fix move semantics related to unique_ptr.
NeelDigonto Aug 30, 2023
b4b41c5
Merge branch 'master' into plugin/zlib
NeelDigonto Aug 30, 2023
c83cb6e
Added deflateInit2 & inflateInit2 & inflateBackInit2 & Refactor Part 1.
NeelDigonto Aug 30, 2023
87b26fa
Added gzopen | gzseek | gztell | gzoffset | adler32_combine | crc32_c…
NeelDigonto Aug 30, 2023
13cff39
Added deflateInit2_ | inflateInit2_ | inflateBackInit_.
NeelDigonto Aug 30, 2023
e72b1a2
Added gzgetc_
NeelDigonto Aug 31, 2023
f295530
Added inflateSyncPoint | inflateUndermine | inflateValidate | inflate…
NeelDigonto Aug 31, 2023
d9e30b9
Added draft WasmEdgeZlibGZVPrintf.
NeelDigonto Aug 31, 2023
50a1032
Removed unused Frame parameter.
NeelDigonto Aug 31, 2023
1e6e5fd
Merge branch 'master' into plugin/zlib
NeelDigonto Sep 5, 2023
1d44df2
Change all remaining naming convention to LLVM style.
NeelDigonto Sep 5, 2023
36a7404
Merge branch 'master' into plugin/zlib
NeelDigonto Sep 5, 2023
aa68b9f
Merge branch 'master' into plugin/zlib
NeelDigonto Sep 6, 2023
b7c6368
Added Host Func registration & Refactor Part 3.
NeelDigonto Sep 7, 2023
692e6ad
Update function presence check to validate al 74 functions.
NeelDigonto Sep 7, 2023
ce5fcc2
Merge branch 'master' into plugin/zlib
NeelDigonto Sep 8, 2023
71c8192
Update release.yml to include zlib.
NeelDigonto Sep 8, 2023
df4314f
Added deflatesetheader & inflategetheader.
NeelDigonto Sep 9, 2023
03a15ea
Change return type of SyncRun.
NeelDigonto Sep 9, 2023
a49a4ab
SyncRun Func Design & Params Overhaul.
NeelDigonto Sep 9, 2023
20011d0
Remove access to moved unique_ptr.
NeelDigonto Sep 9, 2023
1d0d852
Added GZHeader Sync steps in SyncRun.
NeelDigonto Sep 9, 2023
f37a065
Registered deflateSetHeader | inflateGetHeader.
NeelDigonto Sep 9, 2023
867cb64
Updated Test to check for deflateSetHeader & inflateGetHeader.
NeelDigonto Sep 9, 2023
4e431c8
Updated function count test to check for 76 functions.
NeelDigonto Sep 9, 2023
e03337d
Check if SyncRun fails even with no call to zlib API.
NeelDigonto Sep 9, 2023
bda8761
Removed old unused comments, revert usage of named fields & naming co…
NeelDigonto Sep 9, 2023
2079bfe
Added extensive error logging to Zlib Plugin.
NeelDigonto Sep 9, 2023
4e546be
Added Function Instance Name, to SyncRun Error messages for better de…
NeelDigonto Sep 9, 2023
1ef077e
Added a space between error msg tag & message.
NeelDigonto Sep 9, 2023
84a54ee
Added info to error msg if the error is caught inside SyncRun.
NeelDigonto Sep 9, 2023
4884578
Removed usage of a temporary ZRes variable wherever not absolutely ne…
NeelDigonto Sep 11, 2023
1d0ac23
Fix Bug: Properly return a placeholder number to Module to act as a p…
NeelDigonto Sep 11, 2023
49018cb
[Style Change] Remove trailing _s from GZFile_s.
NeelDigonto Sep 11, 2023
82e9f23
Merge branch 'master' into plugin/zlib
NeelDigonto Sep 11, 2023
8846a16
Removed usage of decltype, due to gcc [error: type qualifiers ignored…
NeelDigonto Sep 12, 2023
f5af1df
Merge branch 'master' into plugin/zlib
NeelDigonto Sep 12, 2023
01ea793
Merge branch 'master' into plugin/zlib
NeelDigonto Sep 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 18 additions & 8 deletions .github/workflows/build-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ jobs:
env:
output_prefix: build/plugins
test_prefix: build/test/plugins
build_options: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_WASM_BPF=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON
tar_names: wasi_crypto wasi_logging wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasm_bpf wasmedge_rustls wasmedge_opencvmini
test_bins: wasiCryptoTests wasiLoggingTests wasmedgeProcessTests wasmedgeTensorflowTests wasmedgeTensorflowLiteTests wasmedgeImageTests wasmBpfTests wasmEdgeRUSTLSTests wasmedgeOpencvminiTests
output_bins: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmBpf.so libwasmedge_rustls.so libwasmedgePluginWasmEdgeOpenCVMini.so
build_options: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_WASM_BPF=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON -DWASMEDGE_PLUGIN_ZLIB=ON
tar_names: wasi_crypto wasi_logging wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasm_bpf wasmedge_rustls wasmedge_opencvmini wasmedge_zlib
test_bins: wasiCryptoTests wasiLoggingTests wasmedgeProcessTests wasmedgeTensorflowTests wasmedgeTensorflowLiteTests wasmedgeImageTests wasmBpfTests wasmEdgeRUSTLSTests wasmedgeOpencvminiTests wasmedgeZlibTests
output_bins: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmBpf.so libwasmedge_rustls.so libwasmedgePluginWasmEdgeOpenCVMini.so libwasmedgePluginWasmEdgeZlib.so
needs: [get_version]
container:
image: wasmedge/wasmedge:${{ matrix.docker_tag }}
Expand Down Expand Up @@ -267,6 +267,11 @@ jobs:
with:
name: WasmEdge-plugin-wasmedge_opencvmini-${{ needs.get_version.outputs.version }}-ubuntu22.04-${{ matrix.compiler }}.tar.gz
path: plugin_wasmedge_opencvmini.tar.gz
- name: Upload artifact - wasmedge_zlib
uses: actions/upload-artifact@v3
with:
name: WasmEdge-plugin-wasmedge_zlib-${{ needs.get_version.outputs.version }}-ubuntu22.04-${{ matrix.compiler }}.tar.gz
path: plugin_wasmedge_zlib.tar.gz

# Due to the dependencies and exclusions of WASI-NN, build them saperately.
build_manylinux_wasi_nn:
Expand Down Expand Up @@ -366,16 +371,16 @@ jobs:
env:
output_prefix: build/plugins
test_prefix: build/test/plugins
build_options_all_platforms: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON
build_options_all_platforms: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON -DWASMEDGE_PLUGIN_ZLIB=ON
build_options_manylinux2014_x86_64: -DWASMEDGE_PLUGIN_WASM_BPF=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_WASM_BPF_BUILD_LIBBPF_WITH_PKG_CONF=OFF
build_options_manylinux2014_aarch64:
tar_names_all_platforms: wasi_crypto wasi_logging wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasmedge_opencvmini
tar_names_all_platforms: wasi_crypto wasi_logging wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasmedge_opencvmini wasmedge_zlib
tar_names_manylinux2014_x86_64: wasm_bpf wasmedge_rustls
tar_names_manylinux2014_aarch64:
test_bins_all_platforms: wasiCryptoTests wasiLoggingTests wasmedgeProcessTests wasmedgeTensorflowTests wasmedgeTensorflowLiteTests wasmedgeImageTests wasmedgeOpencvminiTests
test_bins_all_platforms: wasiCryptoTests wasiLoggingTests wasmedgeProcessTests wasmedgeTensorflowTests wasmedgeTensorflowLiteTests wasmedgeImageTests wasmedgeOpencvminiTests wasmedgeZlibTests
test_bins_manylinux2014_x86_64: wasmBpfTests wasmEdgeRUSTLSTests
test_bins_manylinux2014_aarch64:
output_bins_all_platforms: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmEdgeOpenCVMini.so
output_bins_all_platforms: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmEdgeOpenCVMini.so libwasmedgePluginWasmEdgeZlib.so
output_bins_manylinux2014_x86_64: libwasmedgePluginWasmBpf.so libwasmedge_rustls.so
output_bins_manylinux2014_aarch64:
needs: [get_version]
Expand Down Expand Up @@ -477,6 +482,11 @@ jobs:
with:
name: WasmEdge-plugin-wasmedge_opencvmini-${{ needs.get_version.outputs.version }}-${{ matrix.docker_tag }}.tar.gz
path: plugin_wasmedge_opencvmini.tar.gz
- name: Upload artifact - wasmedge_zlib
uses: actions/upload-artifact@v3
with:
name: WasmEdge-plugin-wasmedge_zlib-${{ needs.get_version.outputs.version }}-${{ matrix.docker_tag }}.tar.gz
path: plugin_wasmedge_zlib.tar.gz

build_macos:
strategy:
Expand Down
39 changes: 29 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
version: ${{ needs.create_release.outputs.version }}
release: true
secrets: inherit

build_on_alpine_static:
needs: create_release
uses: ./.github/workflows/reusable-build-on-alpine-static.yml
Expand Down Expand Up @@ -206,9 +206,9 @@ jobs:
runs-on: ubuntu-latest
env:
output_prefix: build/plugins
build_options: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_WASM_BPF=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON
tar_names: wasi_crypto wasi_logging wasmedge_rustls wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasm_bpf wasmedge_opencvmini
output_bins: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedge_rustls.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmBpf.so libwasmedgePluginWasmEdgeOpenCVMini.so
build_options: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_WASM_BPF=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON -DWASMEDGE_PLUGIN_ZLIB=ON
tar_names: wasi_crypto wasi_logging wasmedge_rustls wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasm_bpf wasmedge_opencvmini wasmedge_zlib
output_bins: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedge_rustls.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmBpf.so libwasmedgePluginWasmEdgeOpenCVMini.so libwasmedgePluginWasmEdgeZlib.so
needs: create_release
container:
image: wasmedge/wasmedge:ubuntu-20.04-build-clang
Expand Down Expand Up @@ -313,6 +313,12 @@ jobs:
run: |
mv plugin_wasmedge_opencvmini.tar.gz WasmEdge-plugin-wasmedge_opencvmini-${{ needs.create_release.outputs.version }}-ubuntu20.04_x86_64.tar.gz
gh release upload ${{ needs.create_release.outputs.version }} WasmEdge-plugin-wasmedge_opencvmini-${{ needs.create_release.outputs.version }}-ubuntu20.04_x86_64.tar.gz --clobber
- name: Upload wasmedge_zlib plugin tar.gz package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv plugin_wasmedge_zlib.tar.gz WasmEdge-plugin-wasmedge_zlib-${{ needs.create_release.outputs.version }}-ubuntu20.04_x86_64.tar.gz
gh release upload ${{ needs.create_release.outputs.version }} WasmEdge-plugin-wasmedge_zlib-${{ needs.create_release.outputs.version }}-ubuntu20.04_x86_64.tar.gz --clobber

build_and_upload_wasinn_manylinux:
strategy:
Expand Down Expand Up @@ -415,13 +421,13 @@ jobs:
runs-on: ${{ matrix.host_runner }}
env:
output_prefix: build/plugins
build_options_all_platforms: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON
build_options_all_platforms: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_PROCESS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON -DWASMEDGE_PLUGIN_ZLIB=ON
build_options_manylinux2014_x86_64: -DWASMEDGE_PLUGIN_WASM_BPF=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_WASM_BPF_BUILD_LIBBPF_WITH_PKG_CONF=OFF
build_options_manylinux2014_aarch64:
tar_names_all_platforms: wasi_crypto wasi_logging wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasmedge_opencvmini
tar_names_all_platforms: wasi_crypto wasi_logging wasmedge_process wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasmedge_opencvmini wasmedge_zlib
tar_names_manylinux2014_x86_64: wasm_bpf wasmedge_rustls
tar_names_manylinux2014_aarch64:
output_bins_all_platforms: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmEdgeOpenCVMini.so
output_bins_all_platforms: libwasmedgePluginWasiCrypto.so libwasmedgePluginWasiLogging.so libwasmedgePluginWasmEdgeProcess.so libwasmedgePluginWasmEdgeTensorflow.so libwasmedgePluginWasmEdgeTensorflowLite.so libwasmedgePluginWasmEdgeImage.so libwasmedgePluginWasmEdgeOpenCVMini.so libwasmedgePluginWasmEdgeZlib.so
output_bins_manylinux2014_x86_64: libwasmedgePluginWasmBpf.so libwasmedge_rustls.so
output_bins_manylinux2014_aarch64:
needs: create_release
Expand Down Expand Up @@ -529,6 +535,12 @@ jobs:
run: |
mv plugin_wasmedge_opencvmini.tar.gz WasmEdge-plugin-wasmedge_opencvmini-${{ needs.create_release.outputs.version }}-${{ matrix.docker_tag }}.tar.gz
gh release upload ${{ needs.create_release.outputs.version }} WasmEdge-plugin-wasmedge_opencvmini-${{ needs.create_release.outputs.version }}-${{ matrix.docker_tag }}.tar.gz --clobber
- name: Upload wasmedge_zlib plugin tar.gz package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mv plugin_wasmedge_zlib.tar.gz WasmEdge-plugin-wasmedge_zlib-${{ needs.create_release.outputs.version }}-${{ matrix.docker_tag }}.tar.gz
gh release upload ${{ needs.create_release.outputs.version }} WasmEdge-plugin-wasmedge_zlib-${{ needs.create_release.outputs.version }}-${{ matrix.docker_tag }}.tar.gz --clobber

build_and_upload_plugin_macos:
strategy:
Expand All @@ -548,9 +560,9 @@ jobs:
runs-on: ${{ matrix.host_runner }}
env:
output_prefix: build/plugins
build_options: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON
tar_names: wasi_crypto wasi_logging wasmedge_rustls wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasmedge_opencvmini
output_bins: libwasmedgePluginWasiCrypto.dylib libwasmedgePluginWasiLogging.dylib libwasmedge_rustls.dylib libwasmedgePluginWasmEdgeTensorflow.dylib libwasmedgePluginWasmEdgeTensorflowLite.dylib libwasmedgePluginWasmEdgeImage.dylib libwasmedgePluginWasmEdgeOpenCVMini.dylib
build_options: -DWASMEDGE_PLUGIN_WASI_CRYPTO=ON -DWASMEDGE_PLUGIN_WASI_LOGGING=ON -DWASMEDGE_PLUGIN_RUSTLS=ON -DWASMEDGE_PLUGIN_TENSORFLOW=ON -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_IMAGE=ON -DWASMEDGE_PLUGIN_OPENCVMINI=ON -DWASMEDGE_PLUGIN_ZLIB=ON
tar_names: wasi_crypto wasi_logging wasmedge_rustls wasmedge_tensorflow wasmedge_tensorflowlite wasmedge_image wasmedge_opencvmini wasmedge_zlib
output_bins: libwasmedgePluginWasiCrypto.dylib libwasmedgePluginWasiLogging.dylib libwasmedge_rustls.dylib libwasmedgePluginWasmEdgeTensorflow.dylib libwasmedgePluginWasmEdgeTensorflowLite.dylib libwasmedgePluginWasmEdgeImage.dylib libwasmedgePluginWasmEdgeOpenCVMini.dylib libwasmedgePluginWasmEdgeZlib.so
needs: create_release
steps:
- name: Checkout code
Expand Down Expand Up @@ -641,6 +653,13 @@ jobs:
eval $(/opt/homebrew/bin/brew shellenv)
mv plugin_wasmedge_opencvmini.tar.gz WasmEdge-plugin-wasmedge_opencvmini-${{ needs.create_release.outputs.version }}-darwin_${{ matrix.arch }}.tar.gz
gh release upload ${{ needs.create_release.outputs.version }} WasmEdge-plugin-wasmedge_opencvmini-${{ needs.create_release.outputs.version }}-darwin_${{ matrix.arch }}.tar.gz --clobber
- name: Upload wasmedge_zlib plugin tar.gz package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
eval $(/opt/homebrew/bin/brew shellenv)
mv plugin_wasmedge_zlib.tar.gz WasmEdge-plugin-wasmedge_zlib-${{ needs.create_release.outputs.version }}-darwin_${{ matrix.arch }}.tar.gz
gh release upload ${{ needs.create_release.outputs.version }} WasmEdge-plugin-wasmedge_zlib-${{ needs.create_release.outputs.version }}-darwin_${{ matrix.arch }}.tar.gz --clobber

build_manylinux2014_runtime_only:
name: Build runtime only on manylinux2014 platform
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ option(WASMEDGE_PLUGIN_IMAGE "Enable WasmEdge image plugin." OFF)
option(WASMEDGE_PLUGIN_TENSORFLOW "Enable WasmEdge TensorFlow plugin." OFF)
option(WASMEDGE_PLUGIN_TENSORFLOWLITE "Enable WasmEdge TensorFlow-Lite plugin." OFF)
option(WASMEDGE_PLUGIN_RUSTLS "Enable WasmEdge Rustls plugin." OFF)
option(WASMEDGE_PLUGIN_ZLIB "Enable WasmEdge zlib plugin." OFF)
option(WASMEDGE_DISABLE_LIBTINFO "Disable linking against libtinfo when linking LLVM" OFF)

if(WASMEDGE_BUILD_TOOLS AND WASMEDGE_BUILD_FUZZING)
Expand Down
4 changes: 4 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ endif()
if(WASMEDGE_PLUGIN_RUSTLS)
add_subdirectory(wasmedge_rustls)
endif()

if(WASMEDGE_PLUGIN_ZLIB)
add_subdirectory(wasmedge_zlib)
endif()
50 changes: 50 additions & 0 deletions plugins/wasmedge_zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2019-2022 Second State INC

# Don't reply on System zlib
# find_package(ZLIB REQUIRED)

set(ZLIB_COMPAT ON)
set(ZLIBNG_ENABLE_TESTS OFF)

FetchContent_Declare(
zlib
GIT_REPOSITORY "https://github.com/zlib-ng/zlib-ng.git"
GIT_TAG 2.0.7
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(zlib)

wasmedge_add_library(wasmedgePluginWasmEdgeZlib
SHARED
zlibenv.cpp
zlibfunc.cpp
zlibmodule.cpp
)

target_compile_options(wasmedgePluginWasmEdgeZlib
PUBLIC
-DWASMEDGE_PLUGIN
)

target_include_directories(wasmedgePluginWasmEdgeZlib
PUBLIC
$<TARGET_PROPERTY:wasmedgePlugin,INCLUDE_DIRECTORIES>
${CMAKE_CURRENT_SOURCE_DIR}
)

if(WASMEDGE_LINK_PLUGINS_STATIC)
target_link_libraries(wasmedgePluginWasmEdgeZlib
PRIVATE
wasmedgeCAPI
zlib
)
else()
target_link_libraries(wasmedgePluginWasmEdgeZlib
PRIVATE
wasmedge_shared
zlib
)
endif()

install(TARGETS wasmedgePluginWasmEdgeZlib DESTINATION ${CMAKE_INSTALL_LIBDIR}/wasmedge)
25 changes: 25 additions & 0 deletions plugins/wasmedge_zlib/zlibbase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2019-2022 Second State INC

#pragma once

#include "zlibenv.h"

#include "common/errcode.h"
#include "runtime/callingframe.h"
#include "runtime/hostfunc.h"

namespace WasmEdge {
namespace Host {

template <typename T> class WasmEdgeZlib : public Runtime::HostFunction<T> {
public:
WasmEdgeZlib(WasmEdgeZlibEnvironment &HostEnv)
: Runtime::HostFunction<T>(0), Env(HostEnv) {}

protected:
WasmEdgeZlibEnvironment &Env;
};

} // namespace Host
} // namespace WasmEdge
39 changes: 39 additions & 0 deletions plugins/wasmedge_zlib/zlibenv.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2019-2022 Second State INC

#include "zlibenv.h"
#include "zlibmodule.h"

namespace WasmEdge {
namespace Host {

namespace {

Runtime::Instance::ModuleInstance *
create(const Plugin::PluginModule::ModuleDescriptor *) noexcept {
return new WasmEdgeZlibModule;
}

Plugin::Plugin::PluginDescriptor Descriptor{
.Name = "wasmedge_zlib",
.Description = "",
.APIVersion = Plugin::Plugin::CurrentAPIVersion,
.Version = {0, 10, 1, 0},
.ModuleCount = 1,
.ModuleDescriptions =
(Plugin::PluginModule::ModuleDescriptor[]){
{
.Name = "wasmedge_zlib",
.Description = "",
.Create = create,
},
},
.AddOptions = nullptr,
};

} // namespace

Plugin::PluginRegister WasmEdgeZlibEnvironment::Register(&Descriptor);

} // namespace Host
} // namespace WasmEdge