summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 479a80b54f03f991bc9be08cead7c48b7d6ca148 (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
#Maintainer: archdevlab <https://github.com/archdevlab>
#Credits: Alexandre Bouvier <contact@amb.tf>

pkgname=lib32-volk-git
pkgdesc='Meta loader for Vulkan API (32-bit) (git version)'
pkgver=1.3.292.r359.g8a73954
_major=1.3
pkgrel=1
arch=(x86_64)
url='https://github.com/zeux/volk'
license=(MIT)
depends=(vulkan-headers lib32-vulkan-icd-loader volk)
makedepends=(cmake git ninja make)
conflicts=(lib32-volk)
provides=(lib32-volk)
options=(staticlibs)
source=(git+https://github.com/zeux/volk.git)

pkgver(){
  cd "${srcdir}"/volk
  #git describe --long --tags --abbrev=7 | sed 's/^vulkan-sdk-//;s/\([^-]*-g\)/r\1/;s/-/./g'
  #git describe --long --tags --abbrev=7 | sed -r 's,^[^0-9]+,,;s,([0-9]*-g),r\1,;s,[-_],.,g'
  #git describe --long --tags --abbrev=7 | sed -r 's,^[^0-9]+,,;s,([0-9]*-g),r\1,;s,[-_],.,g' | sed 's/.0//g'
  echo "${_major}".$(sed -n 7p CMakeLists.txt | sed 's/[^0-9]*//g').r$(git rev-list --count HEAD).g$(git rev-parse --short --abbrev=7 HEAD)
}

build(){
export CFLAGS+=" -m32"
export CXXFLAGS+=" -m32"
export LDFLAGS+=" -m32"
export ASFLAGS+=" --32"
export PKG_CONFIG_PATH=/usr/lib32/pkgconfig

  rm -rf "${srcdir}"/build

  cmake -B "${srcdir}"/build -S "${srcdir}"/volk \
  -D CMAKE_C_FLAGS=-m32 \
  -D CMAKE_CXX_FLAGS=-m32 \
  -G Ninja \
  -D CMAKE_BUILD_TYPE=Release \
  -D CMAKE_INSTALL_PREFIX=/usr \
  -D CMAKE_INSTALL_BINDIR=bin \
  -D CMAKE_INSTALL_LIBDIR=lib32 \
  -D CMAKE_INSTALL_INCLUDEDIR=include \
  -D CMAKE_INSTALL_SYSCONFDIR=/etc \
  -D CMAKE_INSTALL_DATADIR=share \
  -D VULKAN_HEADERS_INSTALL_DIR=/usr \
  -D Vulkan_INCLUDE_DIRS=/usr/include \
  -D VOLK_INSTALL=ON \
  -Wno-dev

  ninja -j$(nproc) -C "${srcdir}"/build
}

package(){
  DESTDIR="${pkgdir}" ninja -j$(nproc) -C "${srcdir}"/build install

  rm -rf "${pkgdir}"/usr/include

  # install license
  install -dm755 "${pkgdir}"/usr/share/licenses/"${pkgname}"
  install -m644 "${srcdir}"/volk/LICENSE.md "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
}

sha256sums=(SKIP)

# vim:set ts=8 sts=2 sw=2 et: