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

pkgname=mpv-build-git
pkgver=v0.34.0.440.g04062b6f89
pkgrel=1
pkgdesc="Video player based on MPlayer/mplayer2 (uses statically linked ffmpeg). (GIT version)"
arch=('x86_64')
depends=(
         'libfribidi.so'
         'gnutls'
         'libjack.so'
         'liblcms2.so'
         'libarchive.so'
         'libbluray.so'
         'libbs2b.so'
         'libcaca'
         'libcdio-paranoia'
         'libdav1d.so'
         'libdvdnav'
         'libgme'
         'libmysofa'
         'libpulse.so'
         'libshaderc_shared.so'
         'libsixel'
         'libsoxr'
         'libssh.so'
         'libva.so'
         'libvdpau'
         'libxinerama'
         'libxkbcommon'
         'libxrandr'
         'libxss'
         'libxv'
         'luajit'
         'mujs'
         'libopenal.so'
         'libxpresent'
         'rubberband'
         'sdl2'
         'sndio'
         'uchardet'
         'v4l-utils'
         'libvulkan.so'
         'wayland'
         'spirv-cross'
         'zimg'
         'libpipewire-0.3.so'
         'davs2'
         )
license=('GPL2' 'GPL3' 'LGPL3' 'LGPL2.1' 'BSD')
url='http://mpv.io'
makedepends=(
             'git'
             'python-docutils'
             'nasm'
             'ladspa'
             'fontconfig'
             'vulkan-headers'
             'wayland-protocols'
             'ffnvcodec-headers'
             'clang'
             'python-mako'
             'python-jinja'
             'python-markupsafe'
             )
optdepends=(
            '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'
            'bash-completion: Additional completion definitions for Bash users'
            )
provides=('mpv'
          'libmpv.so'
          )
conflicts=('mpv'
           'libmpv.so'
           )
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'
        'git+https://github.com/haasn/libplacebo.git'
        'git+https://github.com/Immediate-Mode-UI/Nuklear.git'
        'git+https://github.com/Dav1dde/glad.git'
        )
sha256sums=('SKIP'
            '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 - .)"
}

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

  pushd "${srcdir}/libplacebo"
    git config submodule.demos/3rdparty/nuklear.url "${srcdir}/Nuklear"
    git config submodule.3rdparty/glad.url "${srcdir}/glad"
    git submodule update --init \
      demos/3rdparty/nuklear \
      3rdparty/glad

  popd

  # Set ffmpeg/libass/mpv flags
  _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'
    )
if [ -f /usr/lib/libavisynth.so.*.*.* ]; then
  _ffmpeg_options+=('--enable-avisynth')
fi
if [ -f /usr/lib/libvapoursynth.so ]; then
  _ffmpeg_options+=('--enable-vapoursynth')
fi
  _mpv_options=(
    '--prefix=/usr'
    '--confdir=/etc/mpv'
    '--htmldir=/usr/share/doc/mpv/html'
    '--disable-build-date'
    '--lua=luajit'
    '--enable-cdda'
    '--enable-dvbin'
    '--enable-dvdnav'
    '--enable-html-build'
    '--enable-libarchive'
    '--enable-libmpv-shared'
    '--enable-openal'
    '--enable-sdl2'
    '--enable-shaderc'
    '--enable-vulkan'
    '--enable-gl-x11'
    '--enable-egl'
    '--enable-egl-x11'
    '--enable-egl-drm'
    '--enable-gl-wayland'
    '--enable-drm'
    '--enable-gbm'
    '--enable-wayland-scanner'
    '--enable-wayland-protocols'
    '--enable-wayland'
    '--enable-vdpau'
    '--enable-vdpau-gl-x11'
    '--enable-vaapi'
    '--enable-vaapi-x11'
    '--enable-vaapi-wayland'
    '--enable-vaapi-drm'
    '--enable-vaapi-x-egl'
    '--enable-cuda-hwaccel'
    '--enable-cuda-interop'
    '--color=yes'
    )
  _libplacebo_options=('')

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

  cd mpv

  ./bootstrap.py
}

build() {
  cd mpv-build
  PYTHONPATH="${srcdir}/libplacebo/3rdparty/glad" ./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.GPL "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.LGPL"
}