summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 89ba8a92bc95560b137df9e3ce721fd485c60029 (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
# Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com>

pkgname=mpv-build-git
pkgver=0.36.0.285.gda400ed3a9
pkgrel=1
pkgdesc="Video player based on MPlayer/mplayer2 (uses statically linked ffmpeg). (GIT version)"
arch=('x86_64')
depends=(
  'gcc-libs'
  'glibc'
  'bash'
  'fribidi' 'libfribidi.so'
  'fontconfig' 'libfontconfig.so'
  'freetype2' 'libfreetype.so'
  'gnutls'
  'jack' 'libjack.so'
  'lcms2' 'liblcms2.so'
  'libarchive' 'libarchive.so'
  'libbluray' 'libbluray.so'
  'libdvdread' #libdvdread.so
  'libdvdnav' #'libdvdnav.so'
  'libbs2b' 'libbs2b.so'
  'libcaca'
  'libcdio'
  'libcdio-paranoia'
  'dav1d' 'libdav1d.so'
  'libdovi' 'libdovi.so'
  'libgme'
  'libmysofa'
  'libpulse' 'libpulse.so'
  'shaderc' 'libshaderc_shared.so'
  'libsixel'
  'libsoxr'
  'libssh' 'libssh.so'
  'libva' 'libva.so' 'libva-drm.so' 'libva-wayland.so' 'libva-x11.so'
  'libvdpau'
  'libxinerama'
  'libxkbcommon' 'libxkbcommon.so'
  'libx11'
  'libxcb'
  'libxext'
  'libxpresent'
  'libxrandr'
  'libxss'
  'libxv'
  'zimg' 'libzimg.so'
  'luajit'
  'mujs'
  'openal' 'libopenal.so'
  'rubberband' 'librubberband.so'
  'libpipewire' 'libpipewire-0.3.so'
  'sdl2'
  'sndio' 'libsndio.so'
  'uchardet'
  'v4l-utils'
  'spirv-cross'
  'davs2'
  'ffnvcodec-headers'
  'wayland-protocols'
  'alsa-lib' 'libasound.so'
  'libglvnd' 'libEGL.so' 'libGL.so'
  'glslang' #'libSPIRV.so'
  'libdrm'
  'bzip2' 'libbz2.so'
  'harfbuzz' 'libharfbuzz.so'
  'libunwind'
  'xz' 'liblzma.so'
  'libmysofa' 'libmysofa.so'
  'wayland' 'libwayland-client.so' 'libwayland-cursor.so' 'libwayland-egl.so'
  'libjpeg-turbo' 'libjpeg.so'
  'vulkan-icd-loader' 'libvulkan.so'
  'mesa'
  'zlib' 'libz.so'
  'python'
  'hicolor-icon-theme'
  'xxhash' 'libxxhash.so'
)

license=('GPL2' 'GPL3' 'LGPL3' 'LGPL2.1' 'BSD')
url='http://mpv.io'
makedepends=(
  'git'
  'meson'
  'python-docutils'
  'nasm'
  'ladspa'
  'vulkan-headers'
  'ffnvcodec-headers'
  'python-mako'
  'python-jinja'
  'python-markupsafe'
  'nuklear'
  'glad'
  'jbigkit'
)
optdepends=(
  'nvidia-utils: for hardware accelerated video decoding with CUDA'
  'youtube-dl: Another way to view youtuve videos with mpv'
  'yt-dlp: Another way to view youtuve videos with mpv'
  'zsh-completions: Additional completion definitions for Zsh users'
  'bash-completion: Additional completion definitions for Bash users'
)
provides=(
  'mpv'
  'libmpv.so'
)
conflicts=('mpv')
options=('!emptydirs' 'debug')
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'
  'git+https://github.com/haasn/libplacebo.git'
  'git+https://github.com/fastfloat/fast_float.git'
)
sha256sums=(
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
)
backup=('etc/mpv/encoding-profiles.conf')

if [ -f /usr/lib/libvapoursynth.so ]; then
  depends+=('vapoursynth')
fi
if [ -f /usr/lib/libavisynth.so.*.*.* ]; then
  depends+=('avisynthplus')
fi

pkgver() {
  cd mpv
  echo "$(git describe --long --tags | tr - . | tr -d v)"
}

prepare() {
  cd mpv-build
  # use arch-meson
  sed -e 's|meson setup|arch-meson|g' \
      -e 's|-Dbuildtype=release|--auto-features disabled|g' \
      -e '/LDFLAGS=/s/^/#/' \
      -i scripts/{mpv,libplacebo}-config

  git clone "${srcdir}/mpv"
  git clone "${srcdir}/ffmpeg"
  git clone "${srcdir}/libass"
  git clone "${srcdir}/libplacebo"

  # Set libplacebo/ffmpeg/libass/mpv flags

  _libplacebo_options=(
    '-Dvulkan=enabled'
    '-Dglslang=enabled'
    '-Dshaderc=enabled'
    '-Dlcms=enabled'
    '-Dd3d11=disabled'
    )

  _ffmpeg_options=(
    '--disable-programs'
    '--enable-libbs2b'
    '--enable-libdav1d'
    '--enable-libgme'
    '--enable-libmysofa'
    '--enable-libsoxr'
    '--enable-libssh'
    '--enable-libjack'
    '--enable-libpulse'
    '--enable-libdavs2'
    '--enable-nonfree'
    '--enable-cuda'
    '--enable-vulkan'
    '--enable-libshaderc'
    '--disable-cuda-llvm'
    )

  _mpv_options=(
    '-Ddefault_library=shared'
    '-Dlibmpv=true'
    '-Dbuild-date=false'

    '-Dcdda=enabled'
    '-Dcplugins=enabled'
    '-Ddvbin=enabled'
    '-Ddvdnav=enabled'
    '-Diconv=enabled'
    '-Djavascript=enabled'
    '-Dlcms2=enabled'
    '-Dlibarchive=enabled'
    '-Dlibavdevice=enabled'
    '-Dlibbluray=enabled'
    '-Dlua=luajit'
    '-Drubberband=enabled'
    '-Dsdl2=enabled'
    '-Dsdl2-gamepad=enabled'
    '-Duchardet=enabled'
    '-Dzimg=enabled'
    '-Dzlib=enabled'

    '-Dalsa=enabled'
    '-Djack=enabled'
    '-Dopenal=enabled'
    '-Dpipewire=enabled'
    '-Dpulse=enabled'
    '-Dsdl2-audio=enabled'
    '-Dsndio=enabled'

    '-Dcaca=enabled'
    '-Ddrm=enabled'
    '-Degl=enabled'
    '-Degl-drm=enabled'
    '-Degl-wayland=enabled'
    '-Degl-x11=enabled'
    '-Dgbm=enabled'
    '-Dgl=enabled'
    '-Dgl-x11=enabled'
    '-Djpeg=enabled'
    '-Dlibplacebo=enabled'
    '-Dsdl2-video=enabled'
    '-Dshaderc=enabled'
    '-Dsixel=enabled'
    '-Dspirv-cross=enabled'
    '-Dplain-gl=enabled'
    '-Dvdpau=enabled'
    '-Dvdpau-gl-x11=enabled'
    '-Dvaapi=enabled'
    '-Dvaapi-x11=enabled'
    '-Dvaapi-wayland=enabled'
    '-Dvaapi-drm=enabled'
    '-Dvulkan=enabled'
    '-Dwayland=enabled'
    '-Ddmabuf-wayland=enabled'
    '-Dvulkan-interop=enabled'
    '-Dx11=enabled'
    '-Dxv=enabled'
    '-Dcuda-hwaccel=enabled'
    '-Dcuda-interop=enabled'

    '-Dhtml-build=enabled'

    # Fix Build
    '-Dc_link_args=-Wl,-Bsymbolic -lstdc++'
    )

if [ -f /usr/lib/libavisynth.so.*.*.* ]; then
   _ffmpeg_options+=('--enable-avisynth')
fi
if [ -f /usr/lib/libvapoursynth.so ]; then
  _ffmpeg_options+=('--enable-vapoursynth')
  _mpv_options+=('-Dvapoursynth=enabled')
fi

  (IFS=$'\n'; echo "${_libplacebo_options[*]}" > libplacebo_options )
  (IFS=$'\n'; echo "${_ffmpeg_options[*]}" > ffmpeg_options )
  (IFS=$'\n'; echo "${_mpv_options[*]}" > mpv_options )

  cd libplacebo
  git config submodule.3rdparty/fast_float.url "${srcdir}/fast_float"
  git -c protocol.file.allow=always submodule update --init \
     3rdparty/fast_float
}

build() {
  cd mpv-build
  ./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"

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

  install -Dm644 mpv/LICENSE.GPL "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.GPL"
  install -Dm644 mpv/LICENSE.LGPL "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.LGPL"
}