summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9ca9b697f96d98c999497687245f859b26a26241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Maintainer: wackbyte <wackbyte@protonmail.com>

_pkgname=wasynth
pkgname=wasynth-git
pkgver=0.13.0.r8.g27f3498
pkgrel=2
pkgdesc='WebAssembly translation tools targeting Lua'
arch=('aarch64' 'arm' 'armv6h' 'armv7h' 'i686' 'x86_64')
url="https://github.com/Rerumu/Wasynth"
license=('GPL-3.0')
depends=('gcc-libs' 'glibc')
makedepends=('cargo' 'git')
provides=("wasynth=${pkgver}")
conflicts=('wasynth')
_commit='27f34987341ec1837d3ff911f3e583647920af16'
source=("${_pkgname}::git+${url}#commit=${_commit}")
md5sums=('SKIP')

pkgver() {
    cd $_pkgname
    git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target

    cd $_pkgname
    # Wasynth does not publish a Cargo.lock file.
    cargo update
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target

    cd $_pkgname
    # Binaries must be specified to prevent the fuzz targets (which depend on libFuzzer) from being
    # built.
    cargo build --frozen --release --bin wasm2luajit --bin wasm2luau
}

# Tests require the WebAssembly test suite repository (https://github.com/WebAssembly/testsuite) as
# a Git submodule, so no check.

package() {
    cd $_pkgname
    install -Dm0755 -t "${pkgdir}/usr/bin/" target/release/wasm2luajit
    install -Dm0755 -t "${pkgdir}/usr/bin/" target/release/wasm2luau
    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}