summaryrefslogtreecommitdiff
path: root/libre/handbrake/PKGBUILD
blob: 5a9e15de171647f5ba315d5e9355d57c9edb80e9 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
# Maintainer (Arch): Evangelos Foutras <evangelos@foutrelis.com>
# Contributor (Arch): Giovanni Scafora <giovanni@archlinux.org>
# Contributor (Arch): Sebastien Piccand <sebcactus gmail com>

pkgname=('handbrake' 'handbrake-cli')
pkgver=0.10.2
pkgrel=1.parabola1
url="http://handbrake.fr/"
license=('GPL')

arch=('i686' 'x86_64')
depends=('gcc-libs')
_gui_depends=('libnotify' 'dbus-glib' 'gtk3' 'gst-plugins-base')
makedepends=('intltool' 'python2' "${_gui_depends[@]}")
source=(https://handbrake.fr/mirror/HandBrake-$pkgver.tar.bz2)

# HandBrake has a bunch of dependencies that may be either pacman
# packages, or built in the contrib/ directory as "modules".  This is
# a big config section to decide which dependencies are going to be
# pacman packages, and which dependencies are going to be modules.
#
# This list should pretty closely correspond to
#     `grep contrib/ make/include/main.defs`
#
# The format for _depends[n] is: handbrake_name[:pacman_name]
# The format for _modules[n] is: handbrake_name:tarball_name
makedepends+=('pkgconfig')       # module if FEATURE.local_pkgconfig
makedepends+=('cmake')           # module if FEATURE.local_cmake
makedepends+=('autoconf')        # module if FEATURE.local_autotools
makedepends+=('automake')        # module if FEATURE.local_autotools
makedepends+=('libtool')         # module if FEATURE.local_autotools
makedepends+=('m4')              # module if FEATURE.local_autotools
depends+=('bzip2')               # module if !HAS.bz2
depends+=('fontconfig')          # module if on darwin, cygwin, or mingw
depends+=('freetype2')           # module if on darwin, cygwin, or mingw
depends+=('fribidi')             # module if on darwin, cygwin, or mingw
depends+=('libxml2')             # module if on darwin, cygwin, or mingw
depends+=('libass')              # module if on darwin, cygwin, or mingw
depends+=('libogg')              # module if on darwin, cygwin, or mingw
depends+=('libvorbis')           # module if on darwin, cygwin, or mingw
depends+=('libtheora')           # module if on darwin, cygwin, or mingw
depends+=('libsamplerate')       # module if on darwin, cygwin, or mingw
depends+=('lame')                # module if on darwin, cygwin, or mingw
depends+=('libx264')             # module if on darwin, cygwin, or mingw
_depends+=('fdk-aac:libfdk-aac') # enable as module if FEATURE.fdk_aac
_depends+=('x265')               # enable as module if FEATURE.x265
# Using system ffmpeg will break PGS subtitle processing
# https://forum.handbrake.fr/viewtopic.php?f=13&t=27581
_modules+=('ffmpeg:libav-v10.1.tar.bz2') # always a module
_depends+=('libvpx')             # always a module
_depends+=('libdvdread')         # always a module; also forced in Arch
_depends+=('libdvdnav')          # always a module; also forced in Arch
_depends+=('libbluray')          # always a module; also forced in Arch
#_depends+=('pthreadw32')        # module if !HAS.pthread (glibc)
#_depends+=('libmfx')            # enable as module if FEATURE.qsv
#_depends+=('libiconv')          # module if !HAS.iconv (glibc)
depends+=('zlib')                # module if !HAS.libz
#_depends+=('libgnurx')          # module if !HAS.regex (glibc)
makedepends+=('yasm')            # module if FEATURE.local_yasm

depends+=("${_depends[@]#*:}")
source+=("${_modules[@]/#*:/http://download.handbrake.fr/handbrake/contrib/}")
noextract+=("${_modules[@]#*:}")

# Lock the specific version of libx264, as it changes often.
depends+=('libx264.so')

sha256sums=('4cc3828393b26a982dbe00febd700c5090d3443c1d45492e0b373e02da73c699'
            'bc3807426d4e73fe8c245730b0df4ba95766cf7e17e47c738ee302f73d066ac9')

prepare() {
  cd "$srcdir/HandBrake-$pkgver"

  local dep

  # Use more system libraries
  for dep in "${_depends[@]}"; do
    sed -i \
      -e "s/MODULES += contrib\/${dep%:*}\$/#& # provided by ${dep#*:}/" \
      make/include/main.defs
  done
  echo 'TEST.GCC.l += fdk-aac x265' >> test/module.defs

  # Use the pre-downloaded files
  mkdir -p download
  for dep in "${_modules[@]}"; do
    ln -srf "${srcdir}/${dep[@]#*:}" download/
  done
}

build() {
  cd "$srcdir/HandBrake-$pkgver"

  ./configure \
    --prefix=/usr \
    --force \
    --disable-gtk-update-checks
  cd build
  make
}

package_handbrake() {
  pkgdesc="Multithreaded video transcoder"
  depends+=("${_gui_depends[@]}" 'hicolor-icon-theme' 'desktop-file-utils')
  optdepends=('gst-plugins-good: for video previews'
              'gst-libav: for video previews')
  install=$pkgname.install

  conflicts=("$pkgname-svn")
  replaces=("$pkgname-svn")

  cd "$srcdir/HandBrake-$pkgver/build"
  make DESTDIR="$pkgdir" install
  rm "$pkgdir/usr/bin/HandBrakeCLI"
}

package_handbrake-cli() {
  pkgdesc+="Multithreaded video transcoder (CLI)"

  conflicts=("$pkgname-svn")
  replaces=("$pkgname-svn")

  cd "$srcdir/HandBrake-$pkgver/build"
  install -D HandBrakeCLI "$pkgdir/usr/bin/HandBrakeCLI"
}

# vim:set ts=2 sw=2 et: