summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ef45fe21d8c5ec5c982ec2c6dc083c7f8fc92e9a (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
pkgname=wasip2-libc
pkgver=0+374+9e8c5423
_commit=9e8c542319242a5e536e14e6046de5968d298038 # main
pkgrel=1
epoch=1
pkgdesc='WASI preview 2 libc implementation for WebAssembly'
arch=('any')
url='https://github.com/WebAssembly/wasi-libc'
license=('Apache' 'MIT')
makedepends=('git' 'llvm' 'clang')
source=("git+https://github.com/WebAssembly/wasi-libc.git#commit=${_commit}")
b2sums=('b38704e419dba9be28004d2615800082832769874573d8d9534e4c0386cf9a93214872bda7ce2d3793ec7a5a16bd444adef0b221cfbe60e38216b53b1cf02346')
options=('staticlibs')

pkgver() {
  cd wasi-libc
  printf "0+%s+%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  local make_options=(
    WASM_CC=/usr/bin/clang
    WASM_AR=/usr/bin/llvm-ar
    WASM_NM=/usr/bin/llvm-nm

    # Remove bulk memory support
    # https://bugzilla.mozilla.org/show_bug.cgi?id=1773200#c4
    BULK_MEMORY_SOURCES=
    WASI_SNAPSHOT=p2
  )

  cd wasi-libc
  make "${make_options[@]}"
}

package() {
  cd wasi-libc
  install -dm755 "${pkgdir}"/usr/share
  cp -dr --preserve=mode,timestamp sysroot "${pkgdir}"/usr/share/wasi-sysroot
}