summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e91d92b78e3a7b3e90d7de93f4a5e578e5ad2e45 (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
# Maintainer : Daniel Bermond < gmail-com: danielbermond >
# Contributor: Det <nimetonmaili at-gmail a-dot com>
# Contributor: PelPix <kylebloss[at]pelpix[dot]info>
# Contributor: DrZaius <lou[at]fakeoutdoorsman.com>
# Contributor: zhuqin <zhuqin83[at]gmail>
# Contributor: pressh <pressh[at]gmail>

# 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],
# acting as 8-bit. For explanation and comparison about 8-bit and
# 10-bit, please see, e.g.: https://gist.github.com/l4n9th4n9/4459997

pkgname=x264-git
pkgver=157.r2969.gd4099dd4
pkgrel=1
arch=('x86_64')
pkgdesc='Open Source H264/AVC video encoder (git version)'
url='https://www.videolan.org/developers/x264.html'
license=('GPL')
depends=('libavcodec.so' 'libavformat.so' 'libavutil.so' 'liblsmash.so'
         'libswscale.so')
makedepends=('git' 'nasm' 'ffmpeg' 'l-smash')
provides=('x264' 'libx264' 'libx264-git' 'libx264.so')
conflicts=('x264' 'libx264' 'libx264-10bit' 'libx264-all')
replaces=('libx264-git' 'libx264-10bit-git' 'libx264-all-git')
source=('git+https://git.videolan.org/git/x264.git')
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-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-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
}