summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8ec250010549fce8f53554bd2aeef23daa893bda (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
# Maintainer: Daniel Bermond <dbermond@archlinux.org>

pkgname=libvpl-tools-git
pkgver=1.1.0.r0.gdf0e9d8
pkgrel=1
pkgdesc='Tools for Intel Video Processing Library (git version)'
arch=('x86_64')
url='https://github.com/intel/libvpl-tools/'
license=('MIT')
depends=('libdrm' 'libva' 'libvpl-git' 'libx11' 'vpl-runtime' 'wayland')
makedepends=('git' 'cmake' 'libpciaccess' 'wayland-protocols')
provides=('libvpl-tools')
conflicts=('libvpl-tools')
source=('git+https://github.com/intel/libvpl-tools.git')
sha256sums=('SKIP')

pkgver() {
    git -C libvpl-tools describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

build() {
    # fix warning: "_FORTIFY_SOURCE" redefined
    # note: upstream forces _FORTIFY_SOURCE=2
    export CFLAGS="${CFLAGS/-Wp,-D_FORTIFY_SOURCE=?/}"
    export CXXFLAGS="${CXXFLAGS/-Wp,-D_FORTIFY_SOURCE=?/}"
    
    # NOTE: fails with 'None' build type
    export CFLAGS+=' -DNDEBUG'
    export CXXFLAGS+=' -DNDEBUG'
    cmake -B build -S libvpl-tools \
        -G 'Unix Makefiles' \
        -DCMAKE_BUILD_TYPE:STRING='Release' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DBUILD_TESTS:BOOL='ON' \
        -DTOOLS_ENABLE_OPENCL:BOOL='ON' \
        -DVPL_INSTALL_LICENSEDIR:PATH="share/licenses/${pkgname}" \
        -Wno-dev
    cmake --build build
}

check() {
    ctest --test-dir build --output-on-failure
}

package() {
    DESTDIR="$pkgdir" cmake --install build
    
    local _file
    while read -r -d '' _file
    do
        if ! grep -q '^vpl-' <<< "$_file"
        then
            mv "${pkgdir}/usr/bin"/{,vpl-}"$_file"
        fi
    done < <(find "${pkgdir}/usr/bin" -mindepth 1 -maxdepth 1 -type f -print0 | sed -z 's|.*/||')
}