summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d5c6adc12d1f32870e4490d05ba77a55142cc74e (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
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>

_android_arch=aarch64

pkgname=android-${_android_arch}-x265
pkgver=3.3
pkgrel=2
arch=('any')
pkgdesc='Open Source H265/HEVC video encoder (android)'
license=('GPL')
url='https://github.com/videolan/x265'
depends=('android-ndk')
options=(!strip !buildflags staticlibs !emptydirs)
makedepends=('android-cmake' 'nasm')
source=("https://github.com/videolan/x265/archive/${pkgver}.tar.gz")
sha256sums=('ca25a38772fc6b49e5f1aa88733bc1dc92da7dc18f02a85cc3e99d76ba85b0a9')

build() {
    cd "${srcdir}"/x265-${pkgver}
    source android-env ${_android_arch}
    unset LDFLAGS CPPFLAGS

    if [[ ${_android_arch} != x86 ]]; then
        mkdir build-12 && cd build-12

        android-${_android_arch}-cmake \
            -DCMAKE_CXX_STANDARD=11 \
            -DLIB_INSTALL_DIR=lib \
            -DENABLE_SHARED=FALSE \
            -DENABLE_CLI=FALSE \
            -DHIGH_BIT_DEPTH=TRUE \
            -DMAIN12=TRUE \
            -DEXPORT_C_API=FALSE \
            ../source
        make $MAKEFLAGS

        cd .. && mkdir build-10 && cd build-10

        android-${_android_arch}-cmake \
            -DCMAKE_CXX_STANDARD=11 \
            -DLIB_INSTALL_DIR=lib \
            -DENABLE_SHARED=FALSE \
            -DENABLE_CLI=FALSE \
            -DHIGH_BIT_DEPTH=TRUE \
            -DEXPORT_C_API=FALSE \
            ../source
        make $MAKEFLAGS

        cd .. && mkdir build-8 && cd build-8
        ln -s ../build-10/libx265.a libx265_main10.a
        ln -s ../build-12/libx265.a libx265_main12.a

        android-${_android_arch}-cmake \
            -DCMAKE_CXX_STANDARD=11 \
            -DLIB_INSTALL_DIR=lib \
            -DENABLE_SHARED=FALSE \
            -DENABLE_CLI=FALSE \
            -DEXTRA_LIB='x265_main10.a;x265_main12.a' \
            -DEXTRA_LINK_FLAGS='-L .' \
            -DLINKED_10BIT=TRUE \
            -DLINKED_12BIT=TRUE \
            ../source
        make $MAKEFLAGS
    else
        mkdir build-8 && cd build-8

        android-${_android_arch}-cmake \
            -DCMAKE_CXX_STANDARD=11 \
            -DLIB_INSTALL_DIR=lib \
            -DENABLE_SHARED=FALSE \
            -DENABLE_CLI=FALSE \
            ../source
        make $MAKEFLAGS
    fi
}

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

    make DESTDIR="$pkgdir" install
    ${ANDROID_STRIP} -g "$pkgdir"/${ANDROID_PREFIX_LIB}/*.a
}