summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 15edc6cfe4be4f4942576928c2469df5067de436 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>
# Contributor: BrinkerVII <brinkervii@gmail.com>

pkgname=luau
pkgver=0.606
pkgrel=1
pkgdesc="A fast, small, safe, gradually typed embeddable scripting language derived from Lua"
arch=(x86_64)
url="https://github.com/luau-lang/luau"
license=(MIT)
depends=(
  gcc-libs
  glibc
)
makedepends=(
  cmake
)
source=(
  "$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz"
  "Luau.pc"
)
sha256sums=(
  '1b5fbe2204128a729f2ad794029e98cb708efb41078d4e8c6087e7435a46de27'
  'f65bc28fd66aac60cc8c7a33c7e64bec7ed296a69628dce57d2dfa57ba7ebab4'
)

_archive="$pkgname-$pkgver"

build() {
  cd "$_archive"

  cmake -S . -B build \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -Wno-dev \
    -DLUAU_BUILD_TESTS=ON \
    -DCMAKE_CXX_FLAGS="-Wstringop-overread"
  cmake --build build
}

check() {
  cd "$_archive"

  ./build/Luau.Conformance
  ./build/Luau.UnitTest
}

package() {
  cd "$_archive"

  _executables=(
    luau
    luau-analyze
    luau-ast
    luau-bytecode
    luau-compile
    luau-reduce
  )
  for executable in "${_executables[@]}"; do
    install -Dm755 -t "$pkgdir/usr/bin" "build/$executable"
  done

  _libraries=(
    libLuau.Analysis.a
    libLuau.Ast.a
    libLuau.CodeGen.a
    libLuau.Compiler.a
    libLuau.Config.a
    libLuau.VM.a
    libisocline.a
  )
  for library in "${_libraries[@]}"; do
    install -Dm644 -t "$pkgdir/usr/lib/Luau" "build/$library"
  done

  _headers=(
    ./Analysis/include/Luau/*.h
    ./Ast/include/Luau/*.h
    ./CodeGen/include/Luau/*.h
    ./CodeGen/include/*.h
    ./Common/include/Luau/*.h
    ./Compiler/include/Luau/*.h
    ./Config/include/Luau/*.h
    ./VM/include/*.h
    ./extern/isocline/include/*.h
  )
  for header in "${_headers[@]}"; do
    install -Dm644 -t "$pkgdir/usr/include/Luau" "$header"
  done

  install -Dm644 "$srcdir/Luau.pc" "$pkgdir/usr/lib/pkgconfig/Luau.pc"
  install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt
}