new package: wasmedge
This commit is contained in:
parent
7b8fd24dd8
commit
532e999b74
46
packages/wasmedge/build.sh
Normal file
46
packages/wasmedge/build.sh
Normal file
@ -0,0 +1,46 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://wasmedge.org/
|
||||
TERMUX_PKG_DESCRIPTION="A lightweight, high-performance, and extensible WebAssembly runtime"
|
||||
TERMUX_PKG_LICENSE="Apache-2.0"
|
||||
TERMUX_PKG_LICENSE_FILE="LICENSE, LICENSE.spdx"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=0.9.1
|
||||
TERMUX_PKG_SRCURL=https://github.com/WasmEdge/WasmEdge/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_SHA256=b4a48bf5a009d6c4bf99479f87bf3bf8ebd6386d636fdeb721540456330dce59
|
||||
TERMUX_PKG_DEPENDS="libc++, libllvm"
|
||||
TERMUX_PKG_BUILD_DEPENDS="boost-static, libllvm-static, libpolly, lld, llvm"
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||
-DWASMEDGE_FORCE_DISABLE_LTO=ON
|
||||
"
|
||||
|
||||
# Build failure for i686:
|
||||
# ```
|
||||
# [...]/wasmedge/src/thirdparty/wasi/api.hpp:55:1: error: static_assert failed
|
||||
# due to requirement 'alignof(long long) == 8' "non-wasi data layout"
|
||||
# static_assert(alignof(int64_t) == 8, "non-wasi data layout");
|
||||
# ^ ~~~~~~~~~~~~~~~~~~~~~
|
||||
# ```
|
||||
TERMUX_PKG_BLACKLISTED_ARCHES="i686"
|
||||
|
||||
termux_step_pre_configure() {
|
||||
_NEED_DUMMY_LIBPTHREAD_A=
|
||||
_LIBPTHREAD_A=$TERMUX_PREFIX/lib/libpthread.a
|
||||
if [ ! -e $_LIBPTHREAD_A ]; then
|
||||
_NEED_DUMMY_LIBPTHREAD_A=true
|
||||
echo '!<arch>' > $_LIBPTHREAD_A
|
||||
fi
|
||||
_NEED_DUMMY_LIBRT_A=
|
||||
_LIBRT_A=$TERMUX_PREFIX/lib/librt.a
|
||||
if [ ! -e $_LIBRT_A ]; then
|
||||
_NEED_DUMMY_LIBRT_A=true
|
||||
echo '!<arch>' > $_LIBRT_A
|
||||
fi
|
||||
}
|
||||
|
||||
termux_step_post_make_install() {
|
||||
if [ $_NEED_DUMMY_LIBPTHREAD_A ]; then
|
||||
rm -f $_LIBPTHREAD_A
|
||||
fi
|
||||
if [ $_NEED_DUMMY_LIBRT_A ]; then
|
||||
rm -f $_LIBRT_A
|
||||
fi
|
||||
}
|
10
packages/wasmedge/cmake-Helper.cmake.patch
Normal file
10
packages/wasmedge/cmake-Helper.cmake.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- a/cmake/Helper.cmake
|
||||
+++ b/cmake/Helper.cmake
|
||||
@@ -19,7 +19,6 @@
|
||||
list(APPEND WASMEDGE_CFLAGS
|
||||
-Wall
|
||||
-Wextra
|
||||
- -Werror
|
||||
-Wno-error=pedantic
|
||||
)
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
75
packages/wasmedge/getsockopt-socklen_t.patch
Normal file
75
packages/wasmedge/getsockopt-socklen_t.patch
Normal file
@ -0,0 +1,75 @@
|
||||
For 32-bit Android `socklen_t` is defined as `int32_t`.
|
||||
|
||||
--- a/include/host/wasi/environ.h
|
||||
+++ b/include/host/wasi/environ.h
|
||||
@@ -964,7 +964,7 @@
|
||||
|
||||
WasiExpect<void> sockGetOpt(__wasi_fd_t Fd, int32_t Level, int32_t Name,
|
||||
void *FlagPtr,
|
||||
- uint32_t *FlagSizePtr) const noexcept {
|
||||
+ socklen_t *FlagSizePtr) const noexcept {
|
||||
auto Node = getNodeOrNull(Fd);
|
||||
if (unlikely(!Node)) {
|
||||
return WasiUnexpect(__WASI_ERRNO_BADF);
|
||||
--- a/include/host/wasi/inode.h
|
||||
+++ b/include/host/wasi/inode.h
|
||||
@@ -540,7 +540,7 @@
|
||||
WasiExpect<void> sockShutdown(__wasi_sdflags_t SdFlags) const noexcept;
|
||||
|
||||
WasiExpect<void> sockGetOpt(int32_t Level, int32_t Name, void *FlagPtr,
|
||||
- uint32_t *FlagSizePtr) const noexcept;
|
||||
+ socklen_t *FlagSizePtr) const noexcept;
|
||||
WasiExpect<void> sockSetOpt(int32_t Level, int32_t Name, void *FlagPtr,
|
||||
uint32_t FlagSizePtr) const noexcept;
|
||||
|
||||
--- a/include/host/wasi/vinode.h
|
||||
+++ b/include/host/wasi/vinode.h
|
||||
@@ -603,7 +603,7 @@
|
||||
}
|
||||
|
||||
WasiExpect<void> sockGetOpt(int32_t Level, int32_t OptName, void *FlagPtr,
|
||||
- uint32_t *FlagSizePtr) const noexcept {
|
||||
+ socklen_t *FlagSizePtr) const noexcept {
|
||||
return Node.sockGetOpt(Level, OptName, FlagPtr, FlagSizePtr);
|
||||
}
|
||||
WasiExpect<void> sockSetOpt(int32_t Level, int32_t OptName, void *FlagPtr,
|
||||
--- a/include/host/wasi/wasifunc.h
|
||||
+++ b/include/host/wasi/wasifunc.h
|
||||
@@ -455,7 +455,7 @@
|
||||
|
||||
Expect<uint32_t> body(Runtime::Instance::MemoryInstance *MemInst, int32_t Fd,
|
||||
int32_t Level, int32_t Name, uint32_t FlagPtr,
|
||||
- uint32_t FlagSizePtr);
|
||||
+ socklen_t FlagSizePtr);
|
||||
};
|
||||
|
||||
class WasiSockSetOpt : public Wasi<WasiSockSetOpt> {
|
||||
--- a/lib/host/wasi/inode-linux.cpp
|
||||
+++ b/lib/host/wasi/inode-linux.cpp
|
||||
@@ -1060,7 +1060,7 @@
|
||||
|
||||
WasiExpect<void> INode::sockGetOpt(int32_t Level, int32_t OptName,
|
||||
void *FlagPtr,
|
||||
- uint32_t *FlagSizePtr) const noexcept {
|
||||
+ socklen_t *FlagSizePtr) const noexcept {
|
||||
auto SysLevel = toSockOptLevel(static_cast<__wasi_sock_opt_level_t>(Level));
|
||||
auto SysOptName = toSockOptSoName(static_cast<__wasi_sock_opt_so_t>(OptName));
|
||||
if (OptName == __WASI_SOCK_OPT_SO_ERROR) {
|
||||
--- a/lib/host/wasi/wasifunc.cpp
|
||||
+++ b/lib/host/wasi/wasifunc.cpp
|
||||
@@ -1854,13 +1854,13 @@
|
||||
Expect<uint32_t>
|
||||
WasiSockGetOpt::body(Runtime::Instance::MemoryInstance *MemInst, int32_t Fd,
|
||||
int32_t Level, int32_t Name, uint32_t FlagPtr,
|
||||
- uint32_t FlagSizePtr) {
|
||||
+ socklen_t FlagSizePtr) {
|
||||
|
||||
if (MemInst == nullptr) {
|
||||
return __WASI_ERRNO_FAULT;
|
||||
}
|
||||
|
||||
- uint32_t *InnerFlagSizePtr = MemInst->getPointer<uint32_t *>(FlagSizePtr);
|
||||
+ socklen_t *InnerFlagSizePtr = MemInst->getPointer<socklen_t *>(FlagSizePtr);
|
||||
if (InnerFlagSizePtr == nullptr) {
|
||||
return __WASI_ERRNO_FAULT;
|
||||
}
|
14
packages/wasmedge/lib-host-wasi-linux.h.patch
Normal file
14
packages/wasmedge/lib-host-wasi-linux.h.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- a/lib/host/wasi/linux.h
|
||||
+++ b/lib/host/wasi/linux.h
|
||||
@@ -312,7 +312,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#if !defined __ANDROID__ || defined __aarch64__ || defined __x86_64__
|
||||
inline constexpr __wasi_filetype_t fromFileType(mode_t Mode) noexcept {
|
||||
+#else
|
||||
+inline constexpr __wasi_filetype_t fromFileType(unsigned int Mode) noexcept {
|
||||
+#endif
|
||||
switch (Mode & S_IFMT) {
|
||||
case S_IFBLK:
|
||||
return __WASI_FILETYPE_BLOCK_DEVICE;
|
Loading…
Reference in New Issue
Block a user