summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a983f9c6f8a5e253556e04a818bb9fa360fa777c (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
94
95
96
97
98
99
100
101
102
103
104
105
106
# Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com>

pkgbase=khronos-ocl-icd-git
pkgname=(
  'khronos-ocl-icd-git'
  'lib32-khronos-ocl-icd-git'
)
pkgver=2024.10.24.1.g9228024
pkgrel=1
arch=('x86_64')
url="http://www.khronos.org/registry/cl"
license=('apache')
makedepends=(
  'git'
  'cmake'
  'glibc'
  'lib32-glibc'
)
source=('git+https://github.com/KhronosGroup/OpenCL-ICD-Loader.git')
sha256sums=('SKIP')
options=('debug')

pkgver() {
  cd OpenCL-ICD-Loader
  echo "$(git describe --long --tags | tr - . | tr -d v)"
}

prepare() {
  # fix .cmake path
  sed 's|${CMAKE_INSTALL_DATADIR}/cmake|${CMAKE_INSTALL_LIBDIR}/cmake|g' -i OpenCL-ICD-Loader/CMakeLists.txt
}

build() {
  cmake -S OpenCL-ICD-Loader -B build64 \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_TESTING=ON

  cmake --build build64

  export CC="gcc -m32"
  export CXX="g++ -m32"
  export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"

  cmake -S OpenCL-ICD-Loader -B build32 \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib32 \
    -DBUILD_TESTING=ON

  cmake --build build32
}

check() {
  (cd build64; OCL_ICD_FILENAMES="$(pwd)/libOpenCLDriverStub.so" ctest)
  (cd build32; OCL_ICD_FILENAMES="$(pwd)/libOpenCLDriverStub.so" ctest)
}

package_khronos-ocl-icd-git() {
  pkgdesc="Khronos Group OpenCL installable client driver (ICD) loader. (GIT Version)"
  depends=(
    'glibc' # libc.so
    'opencl-headers-git'
  )
  provides=(
    'khronos-ocl-icd'
    'khronos-ocl-icd-loader'
    'opencl-icd-loader'
    'ocl-icd'
    'libOpenCL.so'
  )
  conflicts=(
    'khronos-ocl-icd'
    'khronos-ocl-icd-loader'
    'opencl-icd-loader'
    'ocl-icd'
  )
  DESTDIR="${pkgdir}" cmake --install build64

  install -Dm644 OpenCL-ICD-Loader/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

package_lib32-khronos-ocl-icd-git() {
  pkgdesc="Khronos Group OpenCL installable client driver (ICD) loader. (GIT Version) (32-bits)"
  depends=(
    'lib32-glibc' # libc.so
    'opencl-headers-git'
  )
  provides=(
    'lib32-khronos-ocl-icd'
    'lib32-khronos-ocl-icd-loader'
    'lib32-opencl-icd-loader'
    'lib32-ocl-icd'
    'libOpenCL.so'
  )
  conflicts=(
    'lib32-khronos-ocl-icd'
    'lib32-khronos-ocl-icd-loader'
    'lib32-opencl-icd-loader'
    'lib32-ocl-icd'
  )
  DESTDIR="${pkgdir}" cmake --install build32
  (cd "${pkgdir}/usr/bin/" ; mv cllayerinfo{,32})

  install -Dm644 OpenCL-ICD-Loader/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}