summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 231bda2364e175ad2a401e414ee138d558c8e044 (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
# Maintainer:  Philip Sequeira <phsequei@gmail.com>
# Contributor: Rudolf Polzer <divVerent@xonotic.org>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Eivind Uggedal <eivind@uggedal.com>

# Upstream recommends their forked ffmpeg, which can be installed alongside a
# different system ffmpeg. You can build mpv against the system ffmpeg instead
# by uncommenting the second line below, but this may sometimes fail to build
# when mpv depends on a feature that hasn't been merged into upstream ffmpeg.
_ffmpeg_depend=ffmpeg-mpv-git
#_ffmpeg_depend=ffmpeg

_opt_features=(

  # Disabled by default, need to be enabled every build:

  #dvd
  #cd
  #smb
  #libarchive

  # Lua is automatically detected, so you don't need to enable these if you
  # already have it installed. If you have both lua52 and luajit installed, mpv
  # will use the former. Uncommenting luajit below will tell mpv to use that
  # even if lua52 is also installed.

  #lua
  #luajit

  # The rest of these are autodetected, and are just provided to set
  # dependencies the first time you build. If you have the dependencies
  # installed, subsequent builds will pick them up automatically.

  #x11
  #wayland

  #vulkan
  #shaderc # preferred SPIR-V compiler; only available as -git from AUR

  #uchardet
  #rubberband

  # Features disabled by default, but don't require any extra dependencies on an
  # Arch system: (should these just be default?)

  #dvbin

)

# Note: The configure script will automatically enable most optional features it
# finds support for on your system. The dependencies of the built package will
# be updated based on dynamic libraries, but if you want to avoid linking
# against something you have installed, you'll have to disable it in the
# configure below.

pkgname=mpv-git
_gitname=mpv
pkgver=0.27.0_332_g09c61347a8
pkgrel=1
pkgdesc='Video player based on MPlayer/mplayer2 (git version)'
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
license=('GPL')
url='https://mpv.io'
_undetected_depends=('hicolor-icon-theme')
depends=("$_ffmpeg_depend" "${_undetected_depends[@]}")
optdepends=('youtube-dl: for --ytdl')
makedepends=('git' 'python-docutils')
provides=('mpv')
conflicts=('mpv')
options=('!emptydirs')
install=mpv.install
source=('git+https://github.com/mpv-player/mpv'
        'find-deps.py')
md5sums=('SKIP'
         'ffb774b13decbefc62908dda0332046b')
sha256sums=('SKIP'
            'ce974e160347202e0dc63f6a7a5a89e52d2cc1db2d000c661fddb9dc1d007c02')

_opt_extra_flags=()

for feature in "${_opt_features[@]}"; do
  case "$feature" in
    dvd)
      depends+=('libdvdnav')
      _opt_extra_flags+=('--enable-dvdread' '--enable-dvdnav')
      ;;
    cd)
      depends+=('libcdio-paranoia')
      _opt_extra_flags+=('--enable-cdda')
      ;;
    smb)
      depends+=('smbclient')
      _opt_extra_flags+=('--enable-libsmbclient')
      ;;
    libarchive)
      depends+=('libarchive')
      _opt_extra_flags+=('--enable-libarchive')
      ;;
    lua)
      depends+=('lua52')
      _opt_extra_flags+=('--lua=52arch')
      ;;
    luajit)
      depends+=('luajit')
      _opt_extra_flags+=('--lua=luajit')
      ;;
    x11)
      depends+=('libxinerama' 'libxrandr' 'libxss')
      ;;
    wayland)
      depends+=('wayland' 'libxkbcommon')
      ;;
    vulkan)
      makedepends+=('vulkan-headers')
      depends+=('vulkan-icd-loader')
      ;;
    shaderc)
      #depends+=('shaderc')
      depends+=('shaderc-git')
      ;;
    uchardet|rubberband)
      depends+=("$feature")
      ;;
    dvbin)
      _opt_extra_flags+=("--enable-$feature")
      ;;
    *)
      echo "ERROR: Unknown feature option: $feature" >&2
      exit 1
  esac
done

pkgver() {
  cd "$srcdir/$_gitname"
  ./version.sh | sed s/-/_/g
}

prepare() {
  cd "$srcdir/$_gitname"
  ./bootstrap.py
}

build() {
  cd "$srcdir/$_gitname"

  if [[ "$_ffmpeg_depend" = *-mpv* ]]; then
    export CFLAGS="$CFLAGS -I/usr/include/ffmpeg-mpv-git" \
           LDFLAGS="$LDFLAGS -L/usr/lib/ffmpeg-mpv-git" \
           PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}/usr/lib/ffmpeg-mpv-git/pkgconfig"
  else
    _opt_extra_flags+=("--enable-ffmpeg-upstream")
  fi

  ./waf configure --prefix=/usr \
        --confdir=/etc/mpv \
        --enable-zsh-comp \
        --enable-libmpv-shared \
        "${_opt_extra_flags[@]}"

  ./waf build
}

package() {
  cd "$srcdir/$_gitname"
  ./waf install --destdir="$pkgdir"

  # Update dependencies automatically based on dynamic libraries
  _detected_depends=($("$srcdir"/find-deps.py "$pkgdir"/usr/{bin/mpv,lib/libmpv.so}))
  echo 'Auto-detected dependencies:'
  echo "${_detected_depends[@]}" | fold -s -w 79 | sed 's/^/ /'
  depends=("${_detected_depends[@]}" "${_undetected_depends[@]}")
}