Skip to content

Commit 16390f8

Browse files
committed
[new package] wasmer 4.3.5
1 parent 9eaf745 commit 16390f8

File tree

4 files changed

+529
-0
lines changed

4 files changed

+529
-0
lines changed

mingw-w64-wasmer/PKGBUILD

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Maintainer: Maksim Bondarenkov <[email protected]>
2+
3+
_realname=wasmer
4+
pkgbase=mingw-w64-${_realname}
5+
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
6+
pkgver=4.3.5
7+
pkgrel=1
8+
pkgdesc="Universal Binaries Powered by WebAssembly (mingw-w64)"
9+
arch=('any')
10+
mingw_arch=('ucrt64' 'clang64')
11+
url="https://github.com/wasmerio/wasmer"
12+
license=('spdx:MIT')
13+
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
14+
"${MINGW_PACKAGE_PREFIX}-sqlite3")
15+
makedepends=("${MINGW_PACKAGE_PREFIX}-rust"
16+
"${MINGW_PACKAGE_PREFIX}-cmake"
17+
"${MINGW_PACKAGE_PREFIX}-pkgconf"
18+
"${MINGW_PACKAGE_PREFIX}-openssl"
19+
"${MINGW_PACKAGE_PREFIX}-nodejs"
20+
'git')
21+
source=("git+${url}.git#tag=v${pkgver}"
22+
"tun-tap.tar.gz::https://crates.io/api/v1/crates/tun-tap/0.1.4/download"
23+
"tun-tap-update-tokio.patch"
24+
"mingw-build.patch"
25+
"reproducible-builds.patch")
26+
sha256sums=('9d82eba29ea066ba762d0994b3986dcb1cf99deaefe851ccd33a12bb1a2dab37'
27+
'9a477a4e9367c72ac875d23cd07ac99ffa932497d8428767fed0cfa27bbabe50'
28+
'096cb9b0a778b55d5bc57a784d6c707e3b3af2442cac6c09e757dfe3ea742148'
29+
'2da427fb3a7f929fa54cde5bcbd8ee906606b6f458ea7cd5732e6f1281cb5354'
30+
'7f08b41e0077a23b16eb2e9410ac953b293d1eeeaf1b83915a596ac437f81125')
31+
32+
prepare() {
33+
cd "${_realname}"
34+
rm -f rust-toolchain
35+
36+
patch -Np1 -i "${srcdir}/reproducible-builds.patch"
37+
patch -Np1 -i "${srcdir}/mingw-build.patch"
38+
# update tokio in tun-tap dependency so outdated [email protected], kerenel32-sys and ws2_32-sys are dropped
39+
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
40+
patch -d ../tun-tap-0.1.4 -Np1 -i "${srcdir}/tun-tap-update-tokio.patch"
41+
sed -i 's|^tun-tap = { version = "0.1.3"|tun-tap = { version = "0.1.4"|' lib/cli/Cargo.toml
42+
cat >> Cargo.toml <<END
43+
44+
[patch.crates-io]
45+
tun-tap = { path = "../tun-tap-0.1.4" }
46+
END
47+
48+
cargo update -p tun-tap
49+
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
50+
}
51+
52+
build() {
53+
cd "${_realname}"
54+
55+
export WINAPI_NO_BUNDLED_LIBRARIES=1
56+
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
57+
export WASMER_INSTALL_PREFIX=${MINGW_PREFIX}
58+
make ENABLE_SINGLEPASS=1 ENABLE_CRANELIFT=0
59+
}
60+
61+
# tests require rustup binary
62+
# check() {
63+
# cd "${_realame}"
64+
# make test-examples
65+
# }
66+
67+
package() {
68+
cd "${_realname}"
69+
70+
install -Dm755 target/release/wasmer "${pkgdir}${MINGW_PREFIX}/bin/wasmer"
71+
install -Dm755 target/release/libwasmer.dll "${pkgdir}${MINGW_PREFIX}/bin/libwasmer-4.dll"
72+
install -Dm644 lib/c-api/wasm.h "${pkgdir}${MINGW_PREFIX}/include/wasm.h"
73+
install -Dm644 lib/c-api/wasmer.h "${pkgdir}${MINGW_PREFIX}/include/wasmer.h"
74+
install -Dm644 lib/c-api/wasmer_wasm.h "${pkgdir}${MINGW_PREFIX}/include/wasmer_wasm.h"
75+
target/release/wasmer config --pkg-config | install -Dm644 /dev/stdin "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/wasmer.pc"
76+
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/wasmer/LICENSE"
77+
}

mingw-w64-wasmer/mingw-build.patch

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
diff --git a/Makefile b/Makefile
2+
index 97dc61d550..99b775c584 100644
3+
--- a/Makefile
4+
+++ b/Makefile
5+
@@ -44,52 +44,11 @@ SHELL=/usr/bin/env bash
6+
IS_DARWIN := 0
7+
IS_LINUX := 0
8+
IS_FREEBSD := 0
9+
-IS_WINDOWS := 0
10+
-IS_AMD64 := 0
11+
+IS_WINDOWS := 1
12+
+IS_AMD64 := 1
13+
IS_AARCH64 := 0
14+
IS_RISCV64 := 0
15+
16+
-# Test Windows apart because it doesn't support `uname -s`.
17+
-ifeq ($(OS), Windows_NT)
18+
- # We can assume it will likely be in amd64.
19+
- IS_AMD64 := 1
20+
- IS_WINDOWS := 1
21+
-else
22+
- # Platform
23+
- uname := $(shell uname -s)
24+
-
25+
- ifeq ($(uname), Darwin)
26+
- IS_DARWIN := 1
27+
- else ifeq ($(uname), Linux)
28+
- IS_LINUX := 1
29+
- else ifeq ($(uname), FreeBSD)
30+
- IS_FREEBSD := 1
31+
- else
32+
- # We use spaces instead of tabs to indent `$(error)`
33+
- # otherwise it's considered as a command outside a
34+
- # target and it will fail.
35+
- $(error Unrecognized platform, expect `Darwin`, `Linux` or `Windows_NT`)
36+
- endif
37+
-
38+
- # Architecture
39+
- uname := $(shell uname -m)
40+
-
41+
- ifneq (, $(filter $(uname), x86_64 amd64))
42+
- IS_AMD64 := 1
43+
- else ifneq (, $(filter $(uname), aarch64 arm64))
44+
- IS_AARCH64 := 1
45+
- else ifneq (, $(filter $(uname), riscv64))
46+
- IS_RISCV64 := 1
47+
- else
48+
- # We use spaces instead of tabs to indent `$(error)`
49+
- # otherwise it's considered as a command outside a
50+
- # target and it will fail.
51+
- $(error Unrecognized architecture, expect `x86_64`, `aarch64`, `arm64`, 'riscv64')
52+
- endif
53+
-
54+
- # Libc
55+
- LIBC ?= $(shell ldd 2>&1 | grep -o musl | head -n1)
56+
-endif
57+
58+
59+
#####
60+
diff --git a/lib/vm/src/probestack.rs b/lib/vm/src/probestack.rs
61+
index fd78d8d0b2..814ddf9c20 100644
62+
--- a/lib/vm/src/probestack.rs
63+
+++ b/lib/vm/src/probestack.rs
64+
@@ -42,10 +42,10 @@ cfg_if::cfg_if! {
65+
// ___chkstk (note the triple underscore) is implemented in compiler-builtins/src/x86_64.rs
66+
// by the Rust compiler for the MinGW target
67+
#[cfg(all(target_os = "windows", target_env = "gnu"))]
68+
- pub fn ___chkstk();
69+
+ pub fn ___chkstk_ms();
70+
}
71+
/// The probestack for Windows when compiled with GNU
72+
- pub const PROBESTACK: unsafe extern "C" fn() = ___chkstk;
73+
+ pub const PROBESTACK: unsafe extern "C" fn() = ___chkstk_ms;
74+
} else if #[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))] {
75+
// As per
76+
// https://github.com/rust-lang/compiler-builtins/blob/cae3e6ea23739166504f9f9fb50ec070097979d4/src/probestack.rs#L39,
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/lib/cli/build.rs
2+
+++ b/lib/cli/build.rs
3+
@@ -21,7 +21,7 @@ pub fn main() {
4+
println!("cargo:rustc-env=WASMER_BUILD_GIT_HASH_SHORT=???????");
5+
}
6+
7+
- let utc: DateTime<Utc> = Utc::now();
8+
+ let utc: DateTime<Utc> = DateTime::from_timestamp(0, 0).unwrap();
9+
let date = utc.format("%Y-%m-%d").to_string();
10+
println!("cargo:rustc-env=WASMER_BUILD_DATE={}", date);
11+
}

0 commit comments

Comments
 (0)