Skip to content

Commit

Permalink
split wasmer; make libwasmer and libwasmtime conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ognevny authored Oct 9, 2024
1 parent 4875a52 commit e553b73
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 248 deletions.
1 change: 1 addition & 0 deletions mingw-w64-wasmer/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/wasmer
/corosensei-fix-compilation.patch
57 changes: 35 additions & 22 deletions mingw-w64-wasmer/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

_realname=wasmer
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-lib${_realname}")
pkgver=4.4.0
pkgrel=1
pkgdesc="Universal Binaries Powered by WebAssembly (mingw-w64)"
pkgrel=2
pkgdesc="The leading Wasm Runtime supporting WASIX, WASI and Emscripten (mingw-w64)"
arch=('any')
mingw_arch=('ucrt64' 'clang64')
url="https://github.com/wasmerio/wasmer"
Expand All @@ -18,15 +19,13 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-rust"
'git')
options=('!lto')
source=("git+${url}.git#tag=v${pkgver}"
"corosensei.tar.gz::https://crates.io/api/v1/crates/corosensei/0.1.4/download"
"tun-tap.tar.gz::https://crates.io/api/v1/crates/tun-tap/0.1.4/download"
"corosensei-fix-compilation.patch"
"corosensei-fix-compilation.patch::${url}/commit/688cf64faba9c2420829cfbe94c0835c097c507c.patch"
"tun-tap-update-tokio.patch"
"reproducible-builds.patch")
sha256sums=('1ab4b4b98cd1442b8b23336f78f7e0f2e167985bd50c5f923dbc6eeee56a9d1d'
'80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e'
'9a477a4e9367c72ac875d23cd07ac99ffa932497d8428767fed0cfa27bbabe50'
'1636cded85171dc138c68e81336823e2db1e269e744c428426ab05157b41cf34'
'9b9264dffa90e10bfd098b0c8fab9183b7676809a9a8019dc779a64ece0d7bb6'
'684f6a479385e3646b82d5d6588d9290a78708a59dec4aab7af76a0f23aaa249'
'7f08b41e0077a23b16eb2e9410ac953b293d1eeeaf1b83915a596ac437f81125')

Expand All @@ -38,17 +37,16 @@ prepare() {
# update old dependencies in corosensei and tun-tap crates so outdated [email protected],
# kernel32-sys, ws2_32-sys and [email protected] are dropped; fix compile error in corosensei
mv -f ../tun-tap-0.1.4/Cargo.toml.orig ../tun-tap-0.1.4/Cargo.toml
mv -f ../corosensei-0.1.4/Cargo.toml.orig ../corosensei-0.1.4/Cargo.toml
patch -d ../corosensei-0.1.4 -Np1 -i "../corosensei-fix-compilation.patch"
# https://github.com/wasmerio/wasmer/commit/688cf64faba9c2420829cfbe94c0835c097c507c
patch -Np1 -i "../corosensei-fix-compilation.patch"
patch -d ../tun-tap-0.1.4 -Np1 -i "../tun-tap-update-tokio.patch"
cat >> Cargo.toml <<END
[patch.crates-io]
corosensei = { path = "../corosensei-0.1.4" }
tun-tap = { path = "../tun-tap-0.1.4" }
END

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

Expand All @@ -67,16 +65,31 @@ build() {
# make test-examples
# }

package() {
cd "${_realname}"
package_wasmer() {
install -Dm755 "${_realname}"/target/release/wasmer "${pkgdir}${MINGW_PREFIX}/bin/wasmer"
install -Dm644 "${_realname}"/LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}

package_libwasmer() {
pkgdesc+=' (C-API)'
conflicts=("${MINGW_PACKAGE_PREFIX}-libwasmtime")

install -Dm755 target/release/wasmer "${pkgdir}${MINGW_PREFIX}/bin/wasmer"
install -Dm755 target/release/wasmer.dll "${pkgdir}${MINGW_PREFIX}/bin/libwasmer-4.dll"
install -Dm755 target/release/wasmer.dll.a "${pkgdir}${MINGW_PREFIX}/lib/libwasmer.dll.a"
install -Dm755 target/release/libwasmer.a "${pkgdir}${MINGW_PREFIX}/lib/libwasmer.a"
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"
install -Dm755 "${_realname}"/target/release/wasmer.dll "${pkgdir}${MINGW_PREFIX}/bin/wasmer.dll"
install -Dm755 "${_realname}"/target/release/wasmer.dll.a "${pkgdir}${MINGW_PREFIX}/lib/wasmer.dll.a"
install -Dm755 "${_realname}"/target/release/libwasmer.a "${pkgdir}${MINGW_PREFIX}/lib/libwasmer.a"
install -Dm644 "${_realname}"/lib/c-api/wasm.h "${pkgdir}${MINGW_PREFIX}/include/wasm.h"
install -Dm644 "${_realname}"/lib/c-api/wasmer.h "${pkgdir}${MINGW_PREFIX}/include/wasmer.h"
install -Dm644 "${_realname}"/lib/c-api/wasmer_wasm.h "${pkgdir}${MINGW_PREFIX}/include/wasmer_wasm.h"
"${_realname}"/target/release/wasmer config --pkg-config | install -Dm644 /dev/stdin \
"${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/wasmer.pc"
install -Dm644 "${_realname}"/LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/lib${_realname}/LICENSE"
}

# vim: set ft=bash :

# generate wrappers
for _name in "${pkgname[@]}"; do
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
_func="$(declare -f "${_short}")"
eval "${_func/#${_short}/package_${_name}}"
done
225 changes: 0 additions & 225 deletions mingw-w64-wasmer/corosensei-fix-compilation.patch

This file was deleted.

3 changes: 2 additions & 1 deletion mingw-w64-wasmtime/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-lib${_realname}"
"${MINGW_PACKAGE_PREFIX}-${_realname}-docs")
pkgver=25.0.1
pkgrel=5
pkgrel=6
pkgdesc="A fast and secure runtime for WebAssembly (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
Expand Down Expand Up @@ -111,6 +111,7 @@ package_wasmtime() {

package_libwasmtime() {
pkgdesc+=' (C-API)'
conflicts=("${MINGW_PACKAGE_PREFIX}-libwasmer")

DESTDIR="${pkgdir}" cmake --install "build-${MSYSTEM}-static"
DESTDIR="${pkgdir}" cmake --install "build-${MSYSTEM}-shared"
Expand Down

0 comments on commit e553b73

Please sign in to comment.