summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ffe1b06be6b669f939e0096eef8f5129fda08bc2 (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
# Maintainer : Daniel Bermond < gmail-com: danielbermond >

# NOTE:
# This package provides both 8 and 10-bit support in a single package.
# x264 from the [extra] official repository is currently 8-bit only.
# When used "normally", this package is just like x264 from [extra]
# in terms of bith depth, acting as 8-bit. For explanation and
# comparison about 8-bit and 10-bit, please see, e.g.:
# https://gist.github.com/l4n9th4n9/4459997

_commit='72db437770fd1ce3961f624dd57a8e75ff65ae0b'

pkgname=x264-noffmpeg
pkgver=157.r2945.g72db4377
pkgrel=1
arch=('x86_64')
pkgdesc='Open Source H264/AVC video encoder (no ffmpeg dependency)'
url='https://www.videolan.org/developers/x264.html'
license=('GPL')
depends=('liblsmash.so')
makedepends=('git' 'nasm' 'l-smash')
provides=('x264' 'libx264' 'libx264.so')
conflicts=('x264' 'libx264' 'libx264-10bit' 'libx264-all')
source=("git+https://git.videolan.org/git/x264.git#commit=${_commit}")
sha256sums=('SKIP')

prepare() {
    mkdir -p x264/build-{8,10}bit
}

pkgver() {
    cd x264
    
    local _version
    local _revision
    local _shorthash
    
    _version="$(grep '#define X264_BUILD' x264.h | awk '{ print $3 }')"
    _revision="$( git rev-list  --count HEAD)"
    _shorthash="$(git rev-parse --short HEAD)"
    
    printf '%s.r%s.g%s' "$_version" "$_revision" "$_shorthash"
}

build() {
    printf '%s\n' '  -> Building for 8-bit...'
    cd x264/build-8bit
    ../configure \
        --prefix='/usr' \
        --enable-shared \
        --bit-depth='8' \
        --enable-lto \
        --enable-pic \
        --disable-swscale \
        --disable-lavf \
        --disable-ffms \
        --disable-gpac
    make
    
    printf '%s\n' '  -> Building for 10-bit...'
    cd "${srcdir}/x264/build-10bit"
    ../configure \
        --prefix='/usr' \
        --libdir='/usr/lib/x264-10bit' \
        --includedir='/usr/include/x264-10bit' \
        --enable-shared \
        --bit-depth='10' \
        --enable-lto \
        --enable-pic \
        --disable-swscale \
        --disable-lavf \
        --disable-ffms \
        --disable-gpac
    make
}

package() {
    cd x264
    
    local _depth
    for _depth in 10 8
    do
        printf '%s\n' "  -> Installing for ${_depth}-bit..."
        make -C "build-${_depth}bit" DESTDIR="$pkgdir" install-cli install-lib-shared
        
        if [ "$_depth" -eq '10' ] 
        then
            mv "${pkgdir}/usr/bin/x264" "${pkgdir}/usr/bin/x264-${_depth}bit"
        fi
    done
}