summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 38275d82f634367a1bb96e224bce95278393b3d7 (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
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Martchus <martchus@gmx.net>

_android_arch=x86-64

pkgname=android-${_android_arch}-x265
pkgver=4.0
pkgrel=1
arch=('any')
pkgdesc="Open Source H265/HEVC video encoder (Android ${_android_arch})"
license=('GPL')
groups=('android-x265')
url='https://bitbucket.org/multicoreware/x265_git'
depends=('android-ndk')
makedepends=('android-cmake'
             'nasm')
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://bitbucket.org/multicoreware/x265_git/downloads/x265_${pkgver}.tar.gz")
md5sums=('44e0082a7635eab2488bebd18875a09a')

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

    if [[ "${_android_arch}" = armv7a-eabi || "${_android_arch}" = x86 ]]; then
        ENABLE_PIC=TRUE
    else
        ENABLE_PIC=FALSE
    fi

    android-${_android_arch}-cmake \
        -S source \
        -B build-12 \
        -DCMAKE_CXX_STANDARD=11 \
        -DLIB_INSTALL_DIR=lib \
        -DENABLE_SHARED=FALSE \
        -DENABLE_PIC=${ENABLE_PIC} \
        -DENABLE_ASSEMBLY=FALSE \
        -DENABLE_CLI=FALSE \
        -DHIGH_BIT_DEPTH=TRUE \
        -DMAIN12=TRUE \
        -DEXPORT_C_API=FALSE \
        -Wno-dev
    make -C build-12 $MAKEFLAGS

    android-${_android_arch}-cmake \
        -S source \
        -B build-10 \
        -DCMAKE_CXX_STANDARD=11 \
        -DLIB_INSTALL_DIR=lib \
        -DENABLE_SHARED=FALSE \
        -DENABLE_PIC=${ENABLE_PIC} \
        -DENABLE_ASSEMBLY=FALSE \
        -DENABLE_CLI=FALSE \
        -DHIGH_BIT_DEPTH=TRUE \
        -DEXPORT_C_API=FALSE \
        -Wno-dev
    make -C build-10 $MAKEFLAGS

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

    android-${_android_arch}-cmake \
        -S source \
        -B build-8 \
        -DCMAKE_CXX_STANDARD=11 \
        -DLIB_INSTALL_DIR=lib \
        -DENABLE_SHARED=TRUE \
        -DENABLE_HDR10_PLUS=TRUE \
        -DENABLE_PIC=${ENABLE_PIC} \
        -DENABLE_ASSEMBLY=FALSE \
        -DENABLE_CLI=FALSE \
        -DEXTRA_LIB='x265_main10.a;x265_main12.a' \
        -DEXTRA_LINK_FLAGS='-L.' \
        -DLINKED_10BIT=TRUE \
        -DLINKED_12BIT=TRUE \
        -Wno-dev
    sed -i 's|-lpthread||g' build-8/CMakeFiles/x265-shared.dir/link.txt
    sed -i 's|-Wl,--no-undefined-version||g' build-8/CMakeFiles/x265-shared.dir/link.txt
    sed -i 's|-Wl,--no-undefined||g' build-8/CMakeFiles/x265-shared.dir/link.txt
    make -C build-8 $MAKEFLAGS
}

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

    make -C build-8 DESTDIR="${pkgdir}" install
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
}