summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3e643aae6cddd040c258c054920e8ec6754a16c3 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# Maintainer: Inochi Amaoto <libraryindexsky@gmail.com>

pkgname=mpv-full-build-git
pkgver=0.29.0.r326.g91c1691b35
pkgrel=1
pkgdesc="Video player based on MPlayer/mplayer2 with all possible libs (uses statically linked ffmpeg with all possible libs). (GIT version )"
arch=('x86_64')
depends=(
         # official repositories:
         'alsa-lib'
         'aom'
         'aribb24'
         'bzip2'
         'celt'
         'dav1d'
         'desktop-file-utils'
         'fontconfig'
         'freetype2'
         'frei0r-plugins'
         'fribidi'
         'glibc'
         'gmp'
         'gnutls'
         'gsm'
         'hicolor-icon-theme'
         'jack2'
         'ladspa'
         'lame'
         'lcms2'
         'lensfun'
         'libarchive'
         'libass'
         'libavc1394'
         'libbluray'
         'libbs2b'
         'libcaca'
         'libcdio-paranoia'
         'libdc1394'
         'libdrm'
         'libdvdnav'
         'libfdk-aac'
         'libgcrypt'
         'libgl'
         'libglvnd'
         'libgme'
         'libiec61883'
         'libmodplug'
         'libomxil-bellagio'
         'libpng'
         'libpulse'
         'librsvg'
         'libsoxr'
         'libssh'
         'libtheora'
         'libva'
         'libvdpau'
         'libvorbis'
         'libvpx'
         'libwebp'
         'libx11'
         'libxcb'
         'libxext'
         'libxinerama'
         'libxkbcommon'
         'libxml2'
         'libxrandr'
         'libxss'
         'libxv'
         'lilv'
         'luajit'
         'lv2'
         'ocl-icd'
         'openal'
         'opencore-amr'
         'openjpeg2'
         'opus'
         'pulseaudio'
         'rtmpdump'
         'rubberband'
         'sdl2'
         'shaderc'
         'smbclient'
         'snappy'
         'sndio'
         'speex'
         'srt'
         'tesseract'
         'twolame'
         'uchardet'
         'v4l-utils'
         'vid.stab'
         'vulkan-icd-loader'
         'wavpack'
         'wayland'
         'x264'
         'x265'
         'xdg-utils'
         'xvidcore'
         'xz'
         'zeromq'
         'zimg'
         'zlib'
         'zvbi'

         # AUR:
         'chromaprint-fftw'
         'codec2'
         'crossc'
         'davs2'
         'flite1-patched'
         'kvazaar'
         'libilbc'
         'libklvanc-git'
         'libmysofa-git'
         'libopenmpt-svn'
         'mujs'
         'openh264'
         'rockchip-mpp'
         'rsound'
         'shine'
         'vo-amrwbenc'
         'xavs'
         'xavs2'
         )
license=('GPL2' 'GPL3' 'LGPL3' 'LGPL2.1' 'BSD' 'custom')
url='http://mpv.io'
makedepends=(
             'git'
             'mesa'
             'python-docutils'
             'nasm'
             'ladspa'
             'fontconfig'
             'vulkan-headers'
             'opencl-headers'
             'wayland-protocols'
             'ffnvcodec-headers'
             )
optdepends=(
            'cuda: mpv ffmpeg nvcc and libnpp support'
            'libplacebo-git: Addition GPU-accelerated rendering primitives'
            'mpv-bash-completion-git: Additional completion definitions for Bash users'
            'nvidia-utils: for hardware accelerated video decoding with CUDA'
            'youtube-dl: Another way to view youtuve videos with mpv'
            'zsh-completions: Additional completion definitions for Zsh users'
            'tensorflow: mpv ffmpeg DNN module backend'
            )
provides=('mpv' 'mpv-git' 'mpv-build-git')
conflicts=('mpv' 'mpv-git' 'mpv-build-git')
options=('!emptydirs')
source=('git+https://github.com/mpv-player/mpv-build.git'
        'git+https://github.com/mpv-player/mpv.git'
        'git+https://github.com/ffmpeg/ffmpeg.git'
        'git+https://github.com/libass/libass.git'
        'LICENSE'
        )
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            '04a7176400907fd7db0d69116b99de49e582a6e176b3bfb36a03e50a4cb26a36'
            )
backup=('etc/mpv/encoding-profiles.conf')

# MPV_NO_CHECK_OPT_DEPEND
# if you don't need opt dependency checked, defined this
# for example
# MPV_NO_CHECK_OPT_DEPEND=yes makepkg -sif

if [ -z ${MPV_NO_CHECK_OPT_DEPEND+yes} ]; then
  if [ -f /usr/lib/libvapoursynth.so ]; then
    depends+=('vapoursynth')
  fi
  if [ -f /usr/lib/libtensorflow.so ]; then
    depends+=('tensorflow')
  fi
  if [ -f /usr/lib/libplacebo.so ]; then
    depends+=('libplacebo-git')
  fi
  if [ -d /opt/cuda ]; then
    makedepends+=('cuda')
    depends+=('cuda')
  fi
fi

pkgver() {
  cd mpv
  git describe --tags | sed 's/^v\(.*\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd mpv-build
  rm -rf mpv
  rm -rf ffmpeg
  rm -rf libass
  git clone "${srcdir}/mpv"
  git clone "${srcdir}/ffmpeg"
  git clone "${srcdir}/libass"

  # Set ffmpeg/libass/mpv flags
  _ffmpeg_options=(
    '--disable-libopencv'
    '--disable-libtls'
    '--disable-mbedtls'
    '--disable-programs'
    '--enable-alsa'
    '--enable-avisynth'
    '--enable-bzlib'
    '--enable-chromaprint'
    '--enable-cuvid'
    '--enable-ffnvcodec'
    '--enable-fontconfig'
    '--enable-frei0r'
    '--enable-gcrypt'
    '--enable-gmp'
    '--enable-gnutls'
    '--enable-gpl'
    '--enable-gray'
    '--enable-iconv'
    '--enable-ladspa'
    '--enable-libaom'
    '--enable-libaribb24'
    '--enable-libass'
    '--enable-libbluray'
    '--enable-libbs2b'
    '--enable-libcaca'
    '--enable-libcdio'
    '--enable-libcelt'
    '--enable-libcodec2'
    '--enable-libdavs2'
    '--enable-libdc1394'
    '--enable-libdrm'
    '--enable-libfdk-aac'
    '--enable-libflite'
    '--enable-libfreetype'
    '--enable-libfribidi'
    '--enable-libgme'
    '--enable-libgsm'
    '--enable-libiec61883'
    '--enable-libilbc'
    '--enable-libjack'
    '--enable-libklvanc'
    '--enable-libkvazaar'
    '--enable-liblensfun'
    '--enable-libmodplug'
    '--enable-libmp3lame'
    '--enable-libmysofa'
    '--enable-libopencore-amrnb'
    '--enable-libopencore-amrwb'
    '--enable-libopenh264'
    '--enable-libopenjpeg'
    '--enable-libopenmpt'
    '--enable-libopus'
    '--enable-libpulse'
    '--enable-librsvg'
    '--enable-librtmp'
    '--enable-librubberband'
    '--enable-libshine'
    '--enable-libsnappy'
    '--enable-libsoxr'
    '--enable-libspeex'
    '--enable-libsrt'
    '--enable-libssh'
    '--enable-libtesseract'
    '--enable-libtheora'
    '--enable-libtwolame'
    '--enable-libv4l2'
    '--enable-libvidstab'
    '--enable-libvo-amrwbenc'
    '--enable-libvorbis'
    '--enable-libvpx'
    '--enable-libwavpack'
    '--enable-libwebp'
    '--enable-libx264'
    '--enable-libx265'
    '--enable-libxavs'
    '--enable-libxavs2'
    '--enable-libxcb'
    '--enable-libxcb-shape'
    '--enable-libxcb-shm'
    '--enable-libxcb-xfixes'
    '--enable-libxml2'
    '--enable-libxvid'
    '--enable-libzimg'
    '--enable-libzmq'
    '--enable-libzvbi'
    '--enable-lv2'
    '--enable-lzma'
    '--enable-nonfree'
    '--enable-nvdec'
    '--enable-nvenc'
    '--enable-omx'
    '--enable-omx-rpi'
    '--enable-openal'
    '--enable-opencl'
    '--enable-opengl'
    '--enable-rkmpp'
    '--enable-sdl2'
    '--enable-sndio'
    '--enable-v4l2-m2m'
    '--enable-vaapi'
    '--enable-vapoursynth'
    '--enable-vdpau'
    '--enable-version3'
    '--enable-xlib'
    '--enable-zlib'
  )
  _mpv_options=(
    '--prefix=/usr'
    '--confdir=/etc/mpv'
    '--htmldir=/usr/share/doc/mpv/html'
    '--disable-test'
    '--disable-build-date'
    '--disable-vapoursynth-lazy'
    '--lua=luajit'
    '--enable-alsa'
    '--enable-audio-input'
    '--enable-caca'
    '--enable-cdda'
    '--enable-cplugins'
    '--enable-crossc'
    '--enable-cuda-hwaccel'
    '--enable-drm'
    '--enable-drmprime'
    '--enable-dvbin'
    '--enable-dvdnav'
    '--enable-dvdread'
    '--enable-egl-drm'
    '--enable-egl-x11'
    '--enable-gbm'
    '--enable-gl'
    '--enable-gl-wayland'
    '--enable-gl-x11'
    '--enable-html-build'
    '--enable-iconv'
    '--enable-jack'
    '--enable-javascript'
    '--enable-jpeg'
    '--enable-lcms2'
    '--enable-libarchive'
    '--enable-libass'
    '--enable-libass-osd'
    '--enable-libavdevice'
    '--enable-libbluray'
    '--enable-libmpv-shared'
    '--enable-libsmbclient'
    '--enable-libv4l2'
    '--enable-lua'
    '--enable-manpage-build'
    '--enable-openal'
    '--enable-plain-gl'
    '--enable-pulse'
    '--enable-rsound'
    '--enable-rubberband'
    '--enable-sdl2'
    '--enable-shaderc'
    '--enable-sndio'
    '--enable-tv'
    '--enable-tv'
    '--enable-tv-v4l2'
    '--enable-uchardet'
    '--enable-vaapi'
    '--enable-vaapi-drm'
    '--enable-vaapi-glx'
    '--enable-vaapi-wayland'
    '--enable-vaapi-x11'
    '--enable-vaapi-x-egl'
    '--enable-vdpau'
    '--enable-vdpau-gl-x11'
    '--enable-vulkan'
    '--enable-wayland'
    '--enable-wayland-protocols'
    '--enable-wayland-scanner'
    '--enable-x11'
    '--enable-xv'
    '--enable-zlib'
    '--enable-zsh-comp'
  )

    # '--enable-libdav1d'
    # '--enable-libsmbclient'
    # '--enable-avresample'

  local _ffmpeg_cflags=''
  local _ffmpeg_ldflags=''
  if [ -z ${MPV_NO_CHECK_OPT_DEPEND+yes} ]; then
    if [ -f /usr/lib/libplacebo.so ]; then
      _mpv_options+=('--enable-libplacebo')
    fi
    if [ -f /usr/lib/libvapoursynth.so ]; then
      _mpv_options+=('--enable-vapoursynth')
    fi
    if [ -d /opt/cuda ]; then
      _ffmpeg_options+=('--enable-cuda-nvcc')
      _ffmpeg_options+=('--enable-libnpp')
      _ffmpeg_options+=('--extra-cflags=-I/opt/cuda/include')
      _ffmpeg_options+=('--extra-ldflags=-L/opt/cuda/lib64')
    fi
    if [ -f /usr/lib/libtensorflow.so ]; then
      _ffmpeg_options+=('--enable-libtensorflow')
      _ffmpeg_options+=('--extra-cflags=-I/usr/include/tensorflow')
    fi
  fi

  echo ${_ffmpeg_options[@]} > ffmpeg_options
  echo ${_mpv_options[@]} > mpv_options

  cd mpv

  ./bootstrap.py
}

build() {
  cd mpv-build
  if [ -d /opt/cuda ]; then
    sed -i 's|scripts/mpv-config|sed \-i "s\|-lavfilter\|-L/opt/cuda/targets/x86_64-linux/lib/ -lavfilter\|" build_libs/lib/pkgconfig/libavfilter.pc\nscripts/mpv-config|' "${srcdir}/mpv-build/build"
  fi
  ./build
}

package() {
  cd mpv-build
  DESTDIR="${pkgdir}" ./install

  install -Dm755 mpv/TOOLS/mpv_identify.sh "${pkgdir}/usr/bin/mpv-identify"
  install -Dm755 mpv/TOOLS/idet.sh "${pkgdir}/usr/bin/mpv-idet"
  install -Dm755 mpv/TOOLS/umpv "${pkgdir}/usr/bin/umpv"

  install -Dm644 mpv/DOCS/encoding.rst "${pkgdir}/usr/share/doc/mpv/encoding.rst"
  install -Dm644 mpv/DOCS/edl-mpv.rst "${pkgdir}/usr/share/doc/mpv/edl-mpv.rst"
  install -Dm644 mpv/DOCS/client-api-changes.rst "${pkgdir}/usr/share/doc/mpv/client-api-changes.rst"
  install -Dm644 mpv/DOCS/contribute.md "${pkgdir}/usr/share/doc/mpv/contribute.md"

  sed 's|/usr/local/etc/mpv.conf|/etc/mpv.conf|g' -i "${pkgdir}/usr/share/doc/mpv/mpv.conf"
  install -D -m644 "${srcdir}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}/ffmpeg"

  (cd mpv/TOOLS/lua; for i in $(find . -type f); do install -Dm644 "${i}" "${pkgdir}/usr/share/mpv/scripts/${i}"; done)
}