summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 75d512fccf7844460db0ed8d5838354abccabed2 (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
#Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com>

pkgname=lib32-shaderc-git
pkgver=v2020.4.1.g4089217
pkgrel=1
pkgdesc="A collection of tools, libraries and tests for shader compilation. (GIT version)"
url='https://github.com/google/shaderc'
license=('Apache')
arch=('x86_64')
depends=('shaderc'
         'lib32-glibc'
         'lib32-gcc-libs'
         'lib32-glslang'
         'lib32-spirv-tools'
        )
makedepends=('git'
             'cmake'
             'ninja'
             'python'
             'spirv-headers'
             )
provides=('lib32-shaderc'
          'libshaderc_shared.so'
          )
conflicts=('lib32-shaderc')
source=('git+https://github.com/google/shaderc.git#branch=main'
        'fix-glslang-link-order.patch'
        )

sha256sums=('SKIP'
            'b4b05ccea7c2905cf018efef15a86d8807011db1a8cabe57314f6aaade33a644'
            )

pkgver() {
  cd shaderc
  echo "$(git describe --long --tags | tr - .)"
}

prepare() {
  mkdir -p build

  cd shaderc
  patch -p1 -i "${srcdir}/fix-glslang-link-order.patch"

  # de-vendor libs and disable git versioning
  sed '/examples/d;/third_party/d' -i CMakeLists.txt
  sed '/build-version/d' -i glslc/CMakeLists.txt
  cat <<- EOF > glslc/src/build-version.inc
"${pkgver}\\n"
"$(pacman -Q spirv-tools|cut -d \  -f 2|sed 's/-.*//')\\n"
"$(pacman -Q glslang|cut -d \  -f 2|sed 's/-.*//')\\n"
EOF
}

build() {
  CFLAGS=" -m32"
  CXXFLAGS=" -m32"
  PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
  CPPFLAGS="${CPPFLAGS//2/0}"

  cd build
  cmake ../shaderc \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib32 \
    -DSHADERC_SKIP_TESTS=ON \
    -DBUILD_SHARED_LIBS=ON \
    -Dglslang_SOURCE_DIR=/usr/include/glslang \
    -GNinja

  ninja
}

package() {
  DESTDIR="${pkgdir}" ninja -C build  install

  rm -fr "${pkgdir}/usr/include"
  mv "${pkgdir}/usr/bin/glslc" "${pkgdir}/usr/bin/glslc-32"
}