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

# To enable the Instrumentation and Tracing Technology API (ittnotify):
#   - install the package intel-seapi
#   - in build(), change '-DENABLE_ITT:BOOL=' from 'OFF' to 'ON'
#   - and then build intel-media-sdk-git
# intel-seapi will be autodetected by the build system, serving as a makedepend.
# Currently it will not be a mandatory makedepend.

pkgbase=intel-media-sdk-git
pkgname=('intel-media-sdk-git' 'libmfx-git')
pkgver=2023.2.2.r1.g7a72de33
pkgrel=2
pkgdesc='Legacy API for hardware video acceleration on Intel GPUs (Broadwell to Rocket Lake) (git version)'
arch=('x86_64')
url='https://software.intel.com/en-us/media-sdk/'
license=('MIT')
makedepends=('libdrm' 'libva' 'wayland' 'intel-media-driver'
             'git' 'git-lfs' 'cmake' 'libpciaccess' 'libx11' 'libxcb' 'python')
source=('git+https://github.com/Intel-Media-SDK/MediaSDK.git'
        '010-intel-media-sdk-fix-reproducible-build.patch'::'https://github.com/Intel-Media-SDK/MediaSDK/commit/f6925886f27a39eed2e43c5b7b6c342d00f7a970.patch'
        '020-intel-media-sdk-gcc13-fix.patch'
        '030-intel-media-libcttmetrics-static-only.patch')
sha256sums=('SKIP'
            'f1d8a4edf953cfec1516f1a8383c5ee033245aba16cfae0bc79b7de1a6365fcc'
            '38fc06cdc31372d26f1dc2a7e5b1ea57c22f8f83fbf84e0af5638a8040aa7f4e'
            'a473fd7dbd3c7240a3511471cfad6a39dc462b102c88cd23c35e25f2e8ec0246')

export GIT_LFS_SKIP_SMUDGE='1'

prepare() {
    git -C MediaSDK lfs install --local
    git -C MediaSDK lfs pull "${source[0]/git+/}"
    patch -d MediaSDK -Np1 -i "${srcdir}/010-intel-media-sdk-fix-reproducible-build.patch"
    patch -d MediaSDK -Np1 -i "${srcdir}/020-intel-media-sdk-gcc13-fix.patch"
    patch -d MediaSDK -Np1 -i "${srcdir}/030-intel-media-libcttmetrics-static-only.patch"
}

pkgver() {
    git -C MediaSDK describe --long --tags | sed 's/^intel-mediasdk-//;s/^[0-9]\{2\}/20&/;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
    export CFLAGS+=' -DNDEBUG -ffat-lto-objects'
    export CXXFLAGS+=' -DNDEBUG -ffat-lto-objects'
    cmake -B build -S MediaSDK \
        -G 'Unix Makefiles' \
        -DBUILD_ALL:BOOL='ON' \
        -DBUILD_TOOLS:BOOL='ON' \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DENABLE_ITT:BOOL='OFF' \
        -DENABLE_OPENCL:BOOL='OFF' \
        -DENABLE_WAYLAND:BOOL='ON' \
        -DENABLE_X11_DRI3:BOOL='ON' \
        -DMFX_APPS_DIR='/usr/lib/mfx' \
        -Wno-dev
    cmake --build build
}

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

package_intel-media-sdk-git() {
    depends=('libdrm' 'libva' 'wayland' "libmfx-git=${pkgver}" 'intel-media-driver')
    provides=('intel-media-sdk' 'vpl-runtime')
    conflicts=('intel-media-sdk')
    options=('!emptydirs')
    
    DESTDIR="$pkgdir" cmake --install build
    mv "${pkgdir}/usr/lib/libcttmetrics.a" "${pkgdir}/usr/lib/mfx/samples"
    install -D -m644 MediaSDK/LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
    
    [ -d 'libmfx' ] && rm -rf libmfx
    mkdir -p libmfx/usr/{include,lib/pkgconfig}
    mv "${pkgdir}/usr/include/mfx" libmfx/usr/include
    mv "${pkgdir}/usr/lib"/libmfx.so* libmfx/usr/lib
    mv "${pkgdir}/usr/lib/pkgconfig"/{,lib}mfx.pc libmfx/usr/lib/pkgconfig
}

package_libmfx-git() {
    pkgdesc='Intel Media SDK dispatcher library (git version)'
    depends=('gcc-libs')
    provides=('libmfx')
    conflicts=('libmfx')
    
    mv -T libmfx "$pkgdir"
    install -D -m644 MediaSDK/LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}