summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 342e9c92dc06bfe1fd030de8f5c9aded9275fd09 (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
# Maintainer: Michael Lass <bevan@bi-co.net>
# Contributor: Sean Lynch <seanl@literati.org>
# Contributor: Bruno Pagani <archange@archlinux.org>
# Contributor: Antoine Lubineau <antoine@lubignon.info>
# Contributor: Leopold Bloom <blinxwang@gmail.com>
# Contributor: Michal Krenek (a.k.a. Mikos) <m.krenek@gmail.com>

# For me, the compiler_rotate() utest fails when built with Clang 9.
# I therefore by default stick to Clang 7 for which support is somehow
# maintained upstream by Debian developers. Patches to build against
# Clang 9 are however included and can be simply commented in.
# - Michael

pkgname=beignet-git
pkgver=1.0.0.r1395.g419c0417
pkgrel=1
pkgdesc="An open source OpenCL implementation for Intel IvyBridge & Haswell iGPUs"
arch=(x86_64)
url="https://01.org/beignet"
license=(LGPL)
depends=(glu clang70 mesa opencl-headers)
makedepends=(git llvm70 cmake ninja python ocl-icd)
provides=(beignet opencl-intel opencl-driver)
conflicts=(beignet opencl-intel)
source=("git+https://github.com/intel/beignet.git"
        'GBE-let-GenRegister-reg-never-return-uninitialized-m.patch'
        'llvm8.patch'
        'llvm9.patch')
sha256sums=('SKIP'
            'c1f5880bb192103c371d51f57f646837ca01a8bbe012b9022d4e345c2f1187de'
            'f16b13a3263b5042081094cd20c9e09c20a3a6d6e1dd796f460e4f447cfbb598'
            '2a0229629ad228b54fdb930d18a94c6879024a41b43ed5265c758bf508cd4bc6')

function pkgver() {
    cd "$srcdir/beignet"
    git describe --long --tags | sed 's/^Release_v//;s/-/.r/;s/-/./'
}

prepare() {
    mkdir -p build
    cd beignet

    # Remove implementation of cl_intel_device_side_avc_motion_estimation
    # (conflicts with the implemention in Clang 8)
    # git revert -n 9b7ca443cf7b d61933205874 a4257c7475e7 5a288032ab23 9cb7ff4c285d

    # Static linking leads to build failure
    git revert -n 1bd0d252d733

    # Fix undefined behavior
    # See:
    #  * https://github.com/intel/beignet/pull/16
    #  * https://gitlab.freedesktop.org/beignet/beignet/issues/12
    # patch -Np1 -i ../GBE-let-GenRegister-reg-never-return-uninitialized-m.patch

    # Patches from FreeBSD to build with newer LLVM
    # patch -Np0 -i ../llvm8.patch
    # patch -Np0 -i ../llvm9.patch
}

build() {
    cd build
    cmake -G Ninja ../beignet \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=/usr/lib \
        -DCMAKE_BUILD_TYPE=RELEASE \
        -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
        -DLLVM_INSTALL_DIR=/opt/llvm70/bin
    ninja
}

package() {
    cd build
    DESTDIR="${pkgdir}" ninja install
    # Remove headers already provided by 'opencl-headers'
    cd "${pkgdir}/usr/include/CL"
    rm cl.h cl_egl.h cl_ext.h cl_gl.h cl_gl_ext.h cl_platform.h opencl.h
}