summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 36ef425ae5158b0de8d3de48ad57af9dc8335639 (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
# Maintainer: Jacob Ledbetter <jledbetter460@gmail.com>
# Contributor: Daniel Bermond <dbermond@archlinux.org>

pkgname=rockchip-mpp-llvm
pkgver=1.0.11
pkgrel=5
epoch=1
pkgdesc='Rockchip Media Process Platform (MPP) — built with Clang and LLVM lld'
arch=('x86_64')
# https://github.com/HermanChen/mpp/issues/71
# https://github.com/HermanChen/mpp/issues/73
#url='https://github.com/rockchip-linux/mpp/'
url='https://github.com/HermanChen/mpp/'
license=('Apache-2.0' 'MIT')
depends=(
    'glibc'
    'libstdc++')
makedepends=(
    'clang'
    'cmake'
    'lld'
    'llvm')
provides=('rockchip-mpp')
conflicts=('rockchip-mpp')
source=("https://github.com/HermanChen/mpp/archive/${pkgver}/${pkgname}-HermanChen-${pkgver}.tar.gz"
        '010-rockchip-mpp-silence-unwanted-log-messages.patch')
sha256sums=('e97f67e0d2e028ef444099443b6e77efea9f7db83edcbf080f539a44c1c2d36c'
            '9764a01c08f5c1883e675295f8ebc8c26604a7b48d1f9c7df4c9d8c95f32dc26')

prepare() {
    patch -d "mpp-${pkgver}" -Np1 -i "${srcdir}/010-rockchip-mpp-silence-unwanted-log-messages.patch"
}

build() {
    # fix build with gcc 15+
    export CFLAGS+=' -Wno-error=incompatible-pointer-types'
    export CC=clang
    export CXX=clang++
    export AR=/usr/bin/llvm-ar
    export RANLIB=/usr/bin/llvm-ranlib
    export LD=/usr/bin/ld.lld
    export NM=/usr/bin/llvm-nm
    export OBJCOPY=/usr/bin/llvm-objcopy
    export OBJDUMP=/usr/bin/llvm-objdump
    export READELF=/usr/bin/llvm-readelf
    export STRIP=/usr/bin/llvm-strip
    export LDFLAGS="${LDFLAGS:-} -fuse-ld=lld"
    export CFLAGS="${CFLAGS:-} -O3 -march=native"
    export CXXFLAGS="${CXXFLAGS:-} -O3 -march=native"
    export CFLAGS+=" -ffile-prefix-map=${srcdir}=. -fdebug-prefix-map=${srcdir}=."
    export CXXFLAGS+=" -ffile-prefix-map=${srcdir}=. -fdebug-prefix-map=${srcdir}=."
    
    cmake -B build -S "mpp-${pkgver}" \
        -G 'Unix Makefiles' \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DCMAKE_STRIP:PATH='/usr/bin/strip' \
        -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
        -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" \
        -DENABLE_VPROC_VDPP:BOOL='ON' \
        -Wno-dev
    cmake --build build
}

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

package() {
    DESTDIR="$pkgdir" cmake --install build
    install -D -m644 "mpp-${pkgver}/LICENSES/MIT" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-MIT"
}