summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 31a1c1741de3c0675a743e5638cb9ecaeb2b4c18 (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
53
54
# Maintainer: BrinkerVII <brinkervii@gmail.com>

_pkgbase=luau
pkgname=luau-git
pkgver=0.605.2ea71937
pkgrel=1

pkgdesc='A fast, small, safe, gradually typed embeddable scripting language derived from Lua'
arch=('any')
url='https://github.com/Roblox/luau'
license=('MIT')

makedepends=('git' 'cmake')
conflicts=("$_pkgbase" "$_pkgbase"-bin)
provides=("$_pkgbase")

source=(
  'git+https://github.com/Roblox/luau.git'
)

sha512sums=(
  'SKIP'
)

pkgver() {
  pushd "$srcdir/$_pkgbase" > /dev/null

  _latest_tag=$(git describe --abbrev=0 --tags)
  _git_hash=$(git rev-parse --short HEAD)

  popd > /dev/null
  
  echo "$_latest_tag.$_git_hash"
}

build() {
    _build_dir=$srcdir/build
    
    _cpu_threads=$(grep -c processor /proc/cpuinfo)
    export MAKEFLAGS="-j $_cpu_threads"

    mkdir -p "$_build_dir"
    cd "$_build_dir"

    cmake "$srcdir/$_pkgbase" -DCMAKE_BUILD_TYPE=Release
    cmake --build . --target Luau.Repl.CLI Luau.Analyze.CLI --config Release
}

package() {
    _build_dir=$srcdir/build

    install -Dm755 "$_build_dir/luau" "$pkgdir/usr/bin/luau"
    install -Dm755 "$_build_dir/luau-analyze" "$pkgdir/usr/bin/luau-analyze"
}