summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4f6ff6919506c72fae0211b25a1e5a45ca0d480b (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: Gustavo Alvarez <sl1pkn07@gmail.com>
# Contributor: DrZaius <lou[at]fakeoutdoorsman.com>

pkgname=x262-git
pkgver=0.142.2633.bb887aa
pkgrel=2
pkgdesc="x264 with MPEG-2 video support (GIT version)"
arch=('x86_64')
license=('GPL')
depends=(
  'gcc-libs' # libgcc_s.so libstdc++.so
  'glibc' # libc.so libm.so
  'zlib' 'libz.so'
  'bzip2' 'libbz2.so'
  'xz' 'liblzma.so'
  'sdl12-compat' # libSDL-1.2.so
  'libx11' # libX11.so
  'libxcb' # libxcb-shape.so libxcb-shm.so libxcb-xfixes.so libxcb.so 
)
makedepends=(
  'git'
  'yasm'
)
url="https://www.videolan.org/developers/x262.html"
source=(
  'git+https://git.videolan.org/git/x262.git'
  'git+https://github.com/ffmpeg/ffmpeg.git#tag=n2.7.7'
  'git+https://github.com/FFMS/ffms2.git#tag=2.20'
  'mathops_fix.patch'
)
provides=('x262')
conflicts=('x262')
sha256sums=(
  'SKIP'
  'SKIP'
  'SKIP'
  'a50d7da9870a3fd801ad3a4d13d5c9b260acb094cf8bfa4afd95a54741173a7f'
)
options=('debug')

pkgver() {
  cd x262
  echo "$(sh version.sh | grep 'X264_POINTVER' | cut -d '"' -f2 | tr M m | tr ' ' .)"
}

prepare() {
  mkdir -p build-{ffmpeg,ffms2}

  patch -d ffmpeg -p1 -i "${srcdir}/mathops_fix.patch"
}

build() {
  export CFLAGS="${CFLAGS/-march=x86-64 -mtune=generic/-march=native}"
  export CXXFLAGS="${CXXFLAGS/-march=x86-64 -mtune=generic/-march=native}"

  msg2 "Build FFmpeg"
  cd "${srcdir}/build-ffmpeg"
  ../ffmpeg/configure \
    --prefix="${srcdir}/fakeroot" \
    --disable-{network,{encod,mux}ers,hwaccels,{in,out}devs,debug,doc,vdpau,vaapi,programs} \
    --enable-pic \
    --enable-gpl

  make install-libs install-headers

  export PKG_CONFIG_LIBDIR="${srcdir}/fakeroot/lib/pkgconfig"
  export PKG_CONFIG_PATH="${PKG_CONFIG_LIBDIR}:/usr/lib/pkgconfig"

  msg2 "Build FFmpegsource"
  cd "${srcdir}/build-ffms2"
  (cd "${srcdir}/ffms2"; mkdir -p src/config; autoreconf -vfi)
  ../ffms2/configure \
    --prefix="${srcdir}/fakeroot" \
    --enable-shared=no

  make install-libLTLIBRARIES install-pkgconfigDATA install-includeHEADERS

  msg2 "Build x262"
  cd "${srcdir}/x262"
  ./configure \
    --prefix=/usr \
    --disable-lsmash \
    --enable-pic

  make
}

package() {
  make -C x262 DESTDIR="${pkgdir}" install
  rm -fr "${pkgdir}/usr/bin/x262"
  mv "${pkgdir}/usr/bin/x264" "${pkgdir}/usr/bin/x262"
}