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

pkgname=libheif-git
pkgver=1.23.1.r6.gd035da94
pkgrel=1
pkgdesc='HEIF and AVIF file format decoder and encoder (git version)'
arch=('x86_64')
url='https://github.com/strukturag/libheif/'
license=('LGPL-3.0-or-later' 'MIT')
depends=(
    'glibc'
    'libde265'
    'libgcc'
    'libjpeg-turbo'
    'libpng'
    'libstdc++'
    'libtiff'
    'libwebp'
    'openh264'
    'sdl2-compat'
    'x265')
makedepends=(
    'cmake'
    'dav1d'
    'ffmpeg'
    'git'
    'openjpeg2'
    'rav1e'
    'svt-av1')
optdepends=(
    'dav1d: dav1d encoder'
    'ffmpeg: hardware decode'
    'openjpeg2: JPEG2000 decoder'
    'rav1e: rav1e encoder'
    'svt-av1: svt-av1 encoder')
provides=('libheif')
conflicts=('libheif')
source=('git+https://github.com/strukturag/libheif.git')
sha256sums=('SKIP')

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

build() {
    cmake -B build -S libheif \
        -G 'Unix Makefiles' \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -DBUILD_TESTING:BOOL='OFF' \
        -DWITH_AOM_DECODER:BOOL='OFF' \
        -DWITH_AOM_ENCODER:BOOL='OFF' \
        -DWITH_DAV1D:BOOL='ON' \
        -DWITH_KVAZAAR:BOOL='OFF' \
        -DWITH_RAV1E:BOOL='ON' \
        -DWITH_FFMPEG_DECODER:BOOL='ON' \
        -DWITH_FFMPEG_DECODER_PLUGIN:BOOL='ON' \
        -DWITH_GDK_PIXBUF:BOOL='OFF' \
        -DWITH_OpenJPEG_DECODER:BOOL='ON' \
        -DWITH_RAV1E:BOOL='ON' \
        -DWITH_SvtEnc:BOOL='ON' \
        -Wno-dev
    cmake --build build
    
    # create license files for the executable tools (lincensed under the MIT license)
    # https://github.com/strukturag/libheif/blob/0e043e64bf7038e4feefbcd24ca88d46db93d94c/COPYING#L1-L2
    local _tool
    for _tool in dec enc info thumbnailer
    do
        sed -n '/MIT[[:space:]]License$/,/^[[:space:]]*SOFTWARE\.$/p' "libheif/examples/heif_${_tool}.cc" > "build/LICENSE-${_tool}-tool"
        sed -i 's/^[[:space:]]*//' "build/LICENSE-${_tool}-tool"
    done
}

package() {
    DESTDIR="$pkgdir" cmake --install build
    install -D -m644 build/LICENSE-{dec,enc,info,thumbnailer}-tool -t "${pkgdir}/usr/share/licenses/${pkgname}"
}