summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cf081836073e05227d8a06bb7b607c9770b8ede4 (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
91
92
93
94
95
96
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Bruno Pagani <archange@archlinux.org>

_android_arch=x86

pkgname=android-${_android_arch}-libavif
pkgver=1.1.1
pkgrel=1
arch=('any')
pkgdesc="Library for encoding and decoding .avif files (Android ${_android_arch})"
url="https://github.com/AOMediaCodec/libavif"
license=('LicenseRef-libavif')
groups=('android-libavif')
depends=("android-${_android_arch}-aom"
         "android-${_android_arch}-dav1d"
         "android-${_android_arch}-svt-av1"
         "android-${_android_arch}-libpng"
         "android-${_android_arch}-libjpeg"
         "android-${_android_arch}-libyuv")
makedepends=('android-cmake'
             "android-${_android_arch}-gdk-pixbuf2"
             'nasm')
options=(!strip !buildflags staticlibs !emptydirs)
source=("${url}/archive/v${pkgver}/libavif-${pkgver}.tar.gz")
md5sums=('633c2113d52aecab5f0073da3456e2ae')

build() {
    cd "${srcdir}/libavif-${pkgver}"
    source android-env ${_android_arch}

    android-${_android_arch}-cmake \
        -S . \
        -B build-shared \
        -DBUILD_SHARED_LIBS=ON \
        -DAVIF_BUILD_APPS=OFF \
        -DAVIF_CODEC_AOM=SYSTEM \
        -DAVIF_CODEC_DAV1D=SYSTEM \
        -DAVIF_CODEC_RAV1E=SYSTEM \
        -DAVIF_CODEC_SVT=SYSTEM \
        -DAVIF_BUILD_GDK_PIXBUF=ON \
        -DAVIF_ENABLE_GTEST=OFF \
        -DDAV1D_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DDAV1D_LIBRARY="${ANDROID_PREFIX_LIB}/libdav1d.so" \
        -DRAV1E_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}/rav1e" \
        -DRAV1E_LIBRARY="${ANDROID_PREFIX_LIB}/librav1e.so" \
        -DSVT_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DSVT_LIBRARY="${ANDROID_PREFIX_LIB}/libSvtAv1Enc.so" \
        -DAOM_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DAOM_LIBRARY="${ANDROID_PREFIX_LIB}/libaom.so" \
        -DPNG_PNG_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DPNG_LIBRARY="${ANDROID_PREFIX_LIB}/libpng.so" \
        -DJPEG_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DJPEG_LIBRARY="${ANDROID_PREFIX_LIB}/libjpeg.so" \
        -DLIBYUV_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}/libyuv" \
        -DLIBYUV_LIBRARY="${ANDROID_PREFIX_LIB}/libyuv.so"
    sed -i "s|  -lgdk_pixbuf-2.0|  -L${ANDROID_PREFIX_LIB} -lgdk_pixbuf-2.0|g" build-shared/contrib/gdk-pixbuf/CMakeFiles/pixbufloader-avif.dir/link.txt
    make -C build-shared $MAKEFLAGS

    android-${_android_arch}-cmake \
        -S . \
        -B build-static \
        -DBUILD_SHARED_LIBS=OFF \
        -DAVIF_BUILD_APPS=OFF \
        -DAVIF_CODEC_AOM=SYSTEM \
        -DAVIF_CODEC_DAV1D=SYSTEM \
        -DAVIF_CODEC_RAV1E=SYSTEM \
        -DAVIF_CODEC_SVT=SYSTEM \
        -DAVIF_BUILD_GDK_PIXBUF=ON \
        -DAVIF_ENABLE_GTEST=OFF \
        -DDAV1D_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DDAV1D_LIBRARY="${ANDROID_PREFIX_LIB}/libdav1d.a" \
        -DRAV1E_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}/rav1e" \
        -DRAV1E_LIBRARY="${ANDROID_PREFIX_LIB}/librav1e.a" \
        -DSVT_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DSVT_LIBRARY="${ANDROID_PREFIX_LIB}/libSvtAv1Enc.a" \
        -DAOM_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DAOM_LIBRARY="${ANDROID_PREFIX_LIB}/libaom.a" \
        -DPNG_PNG_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DPNG_LIBRARY="${ANDROID_PREFIX_LIB}/libpng.a" \
        -DJPEG_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DJPEG_LIBRARY="${ANDROID_PREFIX_LIB}/libjpeg.a" \
        -DLIBYUV_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}/libyuv" \
        -DLIBYUV_LIBRARY="${ANDROID_PREFIX_LIB}/libyuv.a"
    sed -i "s|  -lgdk_pixbuf-2.0|  -L${ANDROID_PREFIX_LIB} -lgdk_pixbuf-2.0|g" build-static/contrib/gdk-pixbuf/CMakeFiles/pixbufloader-avif.dir/link.txt
    make -C build-static $MAKEFLAGS
}

package() {
    cd "${srcdir}/libavif-${pkgver}"
    source android-env ${_android_arch}

    make -C build-shared DESTDIR="${pkgdir}" install
    make -C build-static DESTDIR="${pkgdir}" install
    find "${pkgdir}/${ANDROID_PREFIX_LIB}" -type f -name "*.so" -exec ${ANDROID_STRIP} -g --strip-unneeded {} \;
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
}