From 79c1caff705fb03c07077fa4e3d946c52fbafe73 Mon Sep 17 00:00:00 2001 From: "termux-actions[bot]" Date: Mon, 23 May 2022 15:47:04 +0000 Subject: [PATCH] packages/wasmer --- packages/wasmer/build.sh | 50 +++++++++++-------- .../lib_vm_src_trap_traphandlers.rs.patch | 12 ++--- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/packages/wasmer/build.sh b/packages/wasmer/build.sh index e73e1df2ac..06d609f788 100644 --- a/packages/wasmer/build.sh +++ b/packages/wasmer/build.sh @@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://github.com/wasmerio/wasmer TERMUX_PKG_DESCRIPTION="A fast and secure WebAssembly runtime" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=2.0.0 +TERMUX_PKG_VERSION=2.2.1 TERMUX_PKG_SRCURL=https://github.com/wasmerio/wasmer/archive/${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_SHA256=f0d86dcd98882a7459f10e58671acf233b7d00f50dffe32f5770ab3bf850a9a6 +TERMUX_PKG_SHA256=e9da2d07c5336266f8a13332628610b3833b9d9d45001b1b0558d3b8b0262e4f TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_NO_STATICSPLIT=true @@ -28,11 +28,12 @@ termux_step_pre_configure() { termux_step_make() { # https://github.com/wasmerio/wasmer/blob/master/Makefile # Makefile only does host builds - make build-wasmer + # Dropping host build due to https://github.com/wasmerio/wasmer/issues/2822 # singlepass only for x86_64 # make build-wasmer + # https://github.com/wasmerio/wasmer/blob/master/lib/cli/Cargo.toml if [ "$TERMUX_ARCH" = "x86_64" ]; then cargo build \ --jobs "$TERMUX_MAKE_PROCESSES" \ @@ -40,7 +41,8 @@ termux_step_make() { --release \ --manifest-path lib/cli/Cargo.toml \ --bin wasmer \ - --features cranelift,singlepass + --no-default-features \ + --features wat,wast,universal,dylib,staticlib,cache,wasi,emscripten,cranelift,singlepass else cargo build \ --jobs "$TERMUX_MAKE_PROCESSES" \ @@ -48,7 +50,8 @@ termux_step_make() { --release \ --manifest-path lib/cli/Cargo.toml \ --bin wasmer \ - --features cranelift + --no-default-features \ + --features wat,wast,universal,dylib,staticlib,cache,wasi,emscripten,cranelift fi # make build-capi @@ -71,13 +74,8 @@ termux_step_make() { fi # make build-wapm - #wapm_version="$(grep "WAPM_VERSION = " "$TERMUX_PKG_SRCDIR/Makefile" | sed -e "s/.* = //")" - #[ -d "wapm-cli" ] || git clone --branch "${wapm_version}" "https://github.com/wasmerio/wapm-cli.git" - # use master to include important bugfix - [ -d "wapm-cli" ] || \ - git clone "https://github.com/wasmerio/wapm-cli.git" && \ - git -C wapm-cli pull && \ - git -C wapm-cli reset --hard d125632dbf6ff75cde8a82670e3665a95a84f5fb + wapm_version="$(grep "WAPM_VERSION = " "$TERMUX_PKG_SRCDIR/Makefile" | sed -e "s/.* = //")" + [ -d "wapm-cli" ] || git clone --branch "${wapm_version}" "https://github.com/wasmerio/wapm-cli.git" cargo build \ --jobs "$TERMUX_MAKE_PROCESSES" \ --target "$CARGO_TARGET_NAME" \ @@ -97,19 +95,31 @@ termux_step_make_install() { install -Dm644 "lib/c-api/README.md" "$TERMUX_PREFIX/include/wasmer-README.md" # make install-capi-lib - pkgver="$(target/release/wasmer --version | cut -d\ -f2)" - shortver="${pkgver%.*}" + shortver="${TERMUX_PKG_VERSION%.*}" majorver="${shortver%.*}" - install -Dm755 "target/$CARGO_TARGET_NAME/release/libwasmer_c_api.so" "$TERMUX_PREFIX/lib/libwasmer.so.$pkgver" - ln -sf "libwasmer.so.$pkgver" "$TERMUX_PREFIX/lib/libwasmer.so.$shortver" - ln -sf "libwasmer.so.$pkgver" "$TERMUX_PREFIX/lib/libwasmer.so.$majorver" - ln -sf "libwasmer.so.$pkgver" "$TERMUX_PREFIX/lib/libwasmer.so" + install -Dm755 "target/$CARGO_TARGET_NAME/release/libwasmer.so" "$TERMUX_PREFIX/lib/libwasmer.so.$TERMUX_PKG_VERSION" + ln -sf "libwasmer.so.$TERMUX_PKG_VERSION" "$TERMUX_PREFIX/lib/libwasmer.so.$shortver" + ln -sf "libwasmer.so.$TERMUX_PKG_VERSION" "$TERMUX_PREFIX/lib/libwasmer.so.$majorver" + ln -sf "libwasmer.so.$TERMUX_PKG_VERSION" "$TERMUX_PREFIX/lib/libwasmer.so" # make install-capi-staticlib - install -Dm644 "target/$CARGO_TARGET_NAME/release/libwasmer_c_api.a" "$TERMUX_PREFIX/lib/libwasmer.a" + install -Dm644 "target/$CARGO_TARGET_NAME/release/libwasmer.a" "$TERMUX_PREFIX/lib/libwasmer.a" # make install-pkg-config - target/release/wasmer config --pkg-config | install -Dm644 /dev/stdin "$TERMUX_PREFIX/lib/pkgconfig/wasmer.pc" + # https://github.com/wasmerio/wasmer/blob/master/lib/cli/src/commands/config.rs + mkdir -p "$TERMUX_PREFIX/lib/pkgconfig" + cat <<- EOF > "$TERMUX_PREFIX/lib/pkgconfig/wasmer.pc" + prefix=$TERMUX_PREFIX + exec_prefix=$TERMUX_PREFIX/bin + includedir=$TERMUX_PREFIX/include + libdir=$TERMUX_PREFIX/lib + + Name: wasmer + Description: The Wasmer library for running WebAssembly + Version: $TERMUX_PKG_VERSION + Cflags: -I$TERMUX_PREFIX/include + Libs: -L$TERMUX_PREFIX/lib -lwasmer + EOF # make install-wapm (non-existant) install -Dm755 "wapm-cli/target/$CARGO_TARGET_NAME/release/wapm" "$TERMUX_PREFIX/bin/wapm" diff --git a/packages/wasmer/lib_vm_src_trap_traphandlers.rs.patch b/packages/wasmer/lib_vm_src_trap_traphandlers.rs.patch index 46f14fb263..b7d3449bef 100644 --- a/packages/wasmer/lib_vm_src_trap_traphandlers.rs.patch +++ b/packages/wasmer/lib_vm_src_trap_traphandlers.rs.patch @@ -1,7 +1,7 @@ -diff -uNr wasmer-2.0.0/lib/vm/src/trap/traphandlers.rs wasmer-2.0.0.mod/lib/vm/src/trap/traphandlers.rs ---- wasmer-2.0.0/lib/vm/src/trap/traphandlers.rs 2021-06-16 04:59:00.000000000 +0800 -+++ wasmer-2.0.0.mod/lib/vm/src/trap/traphandlers.rs 2021-09-20 09:30:49.491362030 +0800 -@@ -207,6 +207,9 @@ +diff -uNr wasmer/lib/vm/src/trap/traphandlers.rs wasmer.mod/lib/vm/src/trap/traphandlers.rs +--- wasmer/lib/vm/src/trap/traphandlers.rs 2022-03-16 06:54:09.000000000 +0800 ++++ wasmer.mod/lib/vm/src/trap/traphandlers.rs 2022-05-22 16:42:49.608666718 +0800 +@@ -210,6 +210,9 @@ if #[cfg(all(target_os = "linux", target_arch = "x86_64"))] { let cx = &*(cx as *const libc::ucontext_t); cx.uc_mcontext.gregs[libc::REG_RIP as usize] as *const u8 @@ -11,7 +11,7 @@ diff -uNr wasmer-2.0.0/lib/vm/src/trap/traphandlers.rs wasmer-2.0.0.mod/lib/vm/s } else if #[cfg(all(target_os = "linux", target_arch = "x86"))] { let cx = &*(cx as *const libc::ucontext_t); cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8 -@@ -219,6 +222,12 @@ +@@ -222,6 +225,12 @@ } else if #[cfg(all(target_os = "android", target_arch = "aarch64"))] { let cx = &*(cx as *const libc::ucontext_t); cx.uc_mcontext.pc as *const u8 @@ -21,6 +21,6 @@ diff -uNr wasmer-2.0.0/lib/vm/src/trap/traphandlers.rs wasmer-2.0.0.mod/lib/vm/s + } else if #[cfg(all(target_os = "android", target_arch = "arm"))] { + let cx = &*(cx as *const libc::ucontext_t); + cx.uc_mcontext.arm_pc as *const u8 - } else if #[cfg(all(target_os = "macos", target_arch = "x86_64"))] { + } else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] { let cx = &*(cx as *const libc::ucontext_t); (*cx.uc_mcontext).__ss.__rip as *const u8