Skip to content

Commit

Permalink
[new package] wasmer 4.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ognevny committed Aug 10, 2024
1 parent 9eaf745 commit 83cf5a1
Show file tree
Hide file tree
Showing 4 changed files with 524 additions and 0 deletions.
76 changes: 76 additions & 0 deletions mingw-w64-wasmer/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Maintainer: Maksim Bondarenkov <[email protected]>

_realname=wasmer
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.3.5
pkgrel=1
pkgdesc="Universal Binaries Powered by WebAssembly (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64')
url="https://github.com/wasmerio/wasmer"
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-sqlite3")
makedepends=("${MINGW_PACKAGE_PREFIX}-rust"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-pkgconf"
"${MINGW_PACKAGE_PREFIX}-openssl"
'git')
source=("git+${url}.git#tag=v${pkgver}"
"tun-tap.tar.gz::https://crates.io/api/v1/crates/tun-tap/0.1.4/download"
"tun-tap-update-tokio.patch"
"mingw-build.patch"
"reproducible-builds.patch")
sha256sums=('9d82eba29ea066ba762d0994b3986dcb1cf99deaefe851ccd33a12bb1a2dab37'
'9a477a4e9367c72ac875d23cd07ac99ffa932497d8428767fed0cfa27bbabe50'
'096cb9b0a778b55d5bc57a784d6c707e3b3af2442cac6c09e757dfe3ea742148'
'303942451a0d380e647886c00af2012dd86a3342d61698ee597ea89368515138'
'7f08b41e0077a23b16eb2e9410ac953b293d1eeeaf1b83915a596ac437f81125')

prepare() {
cd "${_realname}"
rm -f rust-toolchain

patch -Np1 -i "${srcdir}/reproducible-builds.patch"
patch -Np1 -i "${srcdir}/mingw-build.patch"
# update tokio in tun-tap dependency so outdated [email protected], kerenel32-sys and ws2_32-sys are dropped
rm ../tun-tap-0.1.4/Cargo.lock && mv -f ../tun-tap-0.1.4/Cargo.toml.orig ../tun-tap-0.1.4/Cargo.toml
patch -d ../tun-tap-0.1.4 -Np1 -i "${srcdir}/tun-tap-update-tokio.patch"
sed -i 's|^tun-tap = { version = "0.1.3"|tun-tap = { version = "0.1.4"|' lib/cli/Cargo.toml
cat >> Cargo.toml <<END
[patch.crates-io]
tun-tap = { path = "../tun-tap-0.1.4" }
END

cargo update -p tun-tap
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
cd "${_realname}"

export WINAPI_NO_BUNDLED_LIBRARIES=1
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
export WASMER_INSTALL_PREFIX=${MINGW_PREFIX}
make ENABLE_SINGLEPASS=1 ENABLE_CRANELIFT=0
}

# tests require rustup binary
# check() {
# cd "${_realame}"
# make test-examples
# }

package() {
cd "${_realname}"

install -Dm755 target/release/wasmer "${pkgdir}${MINGW_PREFIX}/bin/wasmer"
install -Dm755 target/release/libwasmer.dll "${pkgdir}${MINGW_PREFIX}/bin/libwasmer-4.dll"
install -Dm644 lib/c-api/wasm.h "${pkgdir}${MINGW_PREFIX}/include/wasm.h"
install -Dm644 lib/c-api/wasmer.h "${pkgdir}${MINGW_PREFIX}/include/wasmer.h"
install -Dm644 lib/c-api/wasmer_wasm.h "${pkgdir}${MINGW_PREFIX}/include/wasmer_wasm.h"
target/release/wasmer config --pkg-config | install -Dm644 /dev/stdin "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/wasmer.pc"
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/wasmer/LICENSE"
}
72 changes: 72 additions & 0 deletions mingw-w64-wasmer/mingw-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
diff --git a/Makefile b/Makefile
index 97dc61d550..99b775c584 100644
--- a/Makefile
+++ b/Makefile
@@ -44,52 +44,11 @@ SHELL=/usr/bin/env bash
IS_DARWIN := 0
IS_LINUX := 0
IS_FREEBSD := 0
-IS_WINDOWS := 0
-IS_AMD64 := 0
+IS_WINDOWS := 1
+IS_AMD64 := 1
IS_AARCH64 := 0
IS_RISCV64 := 0

-# Test Windows apart because it doesn't support `uname -s`.
-ifeq ($(OS), Windows_NT)
- # We can assume it will likely be in amd64.
- IS_AMD64 := 1
- IS_WINDOWS := 1
-else
- # Platform
- uname := $(shell uname -s)
-
- ifeq ($(uname), Darwin)
- IS_DARWIN := 1
- else ifeq ($(uname), Linux)
- IS_LINUX := 1
- else ifeq ($(uname), FreeBSD)
- IS_FREEBSD := 1
- else
- # We use spaces instead of tabs to indent `$(error)`
- # otherwise it's considered as a command outside a
- # target and it will fail.
- $(error Unrecognized platform, expect `Darwin`, `Linux` or `Windows_NT`)
- endif
-
- # Architecture
- uname := $(shell uname -m)
-
- ifneq (, $(filter $(uname), x86_64 amd64))
- IS_AMD64 := 1
- else ifneq (, $(filter $(uname), aarch64 arm64))
- IS_AARCH64 := 1
- else ifneq (, $(filter $(uname), riscv64))
- IS_RISCV64 := 1
- else
- # We use spaces instead of tabs to indent `$(error)`
- # otherwise it's considered as a command outside a
- # target and it will fail.
- $(error Unrecognized architecture, expect `x86_64`, `aarch64`, `arm64`, 'riscv64')
- endif
-
- # Libc
- LIBC ?= $(shell ldd 2>&1 | grep -o musl | head -n1)
-endif


#####
diff --git a/lib/vm/src/probestack.rs b/lib/vm/src/probestack.rs
index fd78d8d0b2..0ffd5418cb 100644
--- a/lib/vm/src/probestack.rs
+++ b/lib/vm/src/probestack.rs
@@ -42,7 +42,7 @@ cfg_if::cfg_if! {
// ___chkstk (note the triple underscore) is implemented in compiler-builtins/src/x86_64.rs
// by the Rust compiler for the MinGW target
#[cfg(all(target_os = "windows", target_env = "gnu"))]
- pub fn ___chkstk();
+ pub fn ___chkstk_ms();
}
/// The probestack for Windows when compiled with GNU
pub const PROBESTACK: unsafe extern "C" fn() = ___chkstk;
11 changes: 11 additions & 0 deletions mingw-w64-wasmer/reproducible-builds.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/lib/cli/build.rs
+++ b/lib/cli/build.rs
@@ -21,7 +21,7 @@ pub fn main() {
println!("cargo:rustc-env=WASMER_BUILD_GIT_HASH_SHORT=???????");
}

- let utc: DateTime<Utc> = Utc::now();
+ let utc: DateTime<Utc> = DateTime::from_timestamp(0, 0).unwrap();
let date = utc.format("%Y-%m-%d").to_string();
println!("cargo:rustc-env=WASMER_BUILD_DATE={}", date);
}
Loading

0 comments on commit 83cf5a1

Please sign in to comment.