summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dc8ee7ce7904aaed173232ee73e5aabe22bb7b2e (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: Chris Zhang <develop [at] zcy [dot] moe>

pkgname=shader-slang-git
pkgver=2024.13+18.g509409ef11
pkgrel=1
pkgdesc='Shading language that makes it easier to build and maintain large shader codebases in a modular and extensible fashion.'
url='https://github.com/shader-slang/slang'
arch=('x86_64')
license=('MIT')
source=("git+$url"
        "git+https://github.com/shader-slang/glslang"
        "git+https://github.com/syoyo/tinyobjloader"
        "git+https://github.com/g-truc/glm"
        "git+https://github.com/ocornut/imgui"
        "git+https://github.com/shader-slang/slang-binaries"
        # "spirv-tools::git+https://github.com/shader-slang/SPIRV-Tools"
        "spirv-headers::git+https://github.com/KhronosGroup/SPIRV-Headers"
        "git+https://github.com/richgel999/miniz"
        "git+https://github.com/lz4/lz4"
        "git+https://github.com/martinus/unordered_dense"
        "vulkan-headers::git+https://github.com/KhronosGroup/Vulkan-Headers")
sha1sums=('SKIP'
          'SKIP'
          'SKIP'
          'SKIP'
          'SKIP'
          'SKIP'
          # 'SKIP'
          'SKIP'
          'SKIP'
          'SKIP'
          'SKIP'
          'SKIP')
makedepends=(git)
depends=(glslang)
conflicts=(shader-slang shader-slang-bin)
provides=(shader-slang)

prepare() {
  cd slang
  git submodule init
  for external_lib in glslang tinyobjloader glm imgui slang-binaries spirv-headers miniz lz4 unordered_dense vulkan-headers # spirv-tools
  do
    git config submodule."external/$external_lib".url "$srcdir/$external_lib"
  done
  git -c protocol.file.allow=always submodule update
}

pkgver() {
  git -C slang describe --tags --abbrev=10 | sed 's/^v//; s/-/+/; s/-/./'
}

build() {
  cd slang

  msg2 "Configuring project"
  cmake --preset default
  msg2 "Building shader-slang"
  cmake --build --preset release
}

check() {
  cd slang
#   build/Release/bin/slang-test
}

package() {
  cd slang

  for bin in slangc slangd
  do
    install -Dm755 "build/Release/bin/$bin" "$pkgdir/opt/shader-slang/bin/$bin"
  done

  for lib in libslang{,-glslang,-llvm}.so libgfx.so
  do
    install -Dm755 "build/Release/lib/$lib" "$pkgdir/opt/shader-slang/lib/$lib"
  done

  for header in include/*.h
  do
    install -Dm644 "$header" "$pkgdir/opt/shader-slang/include/$header"
  done

  for header in prelude/*.h
  do
    install -Dm644 "$header" "$pkgdir/opt/shader-slang/include/prelude/$header"
  done

  find docs examples -type f -exec install -Dm644 "{}" "$pkgdir/opt/shader-slang/{}" \;
  install -Dm644 LICENSE "$pkgdir/opt/shader-slang/LICENSE"
  msg2 "You may manually add /opt/shader-slang/bin to your PATH."
}