summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fd7f4cd28c7497dc3e3e109735c13583275b8e25 (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
# Maintainer:  ahjolinna <@yahoo.com>

# WARNING: The configure script will automatically enable any optional
# features it finds support for on your system. If you want to avoid
# linking against something you have installed, you'll have to disable
# it in the configure below. The package() script will attempt to
# update the dependencies based on dynamic libraries when packaging.

pkgname=mpv-ahjolinna-git
_gitname=mpv
pkgver=0.20.0_76_g026ccca
pkgrel=1
pkgdesc='Video player based on MPlayer/mplayer2 (git version)'
arch=('x86_64')
license=('GPL3')
url='http://mpv.io'
screenshot='http://i.imgur.com/6TacA5I.png'
_undetected_depends=('desktop-file-utils' 'hicolor-icon-theme' 'xdg-utils')
depends=('pulseaudio' 'ffmpeg' 'lcms2' 'libdvdread' 'libgl' 'libvdpau'
         'libxinerama' 'libxv' 'libxkbcommon' 'libva'  'libass' 'uchardet' 
	 'wayland' 'v4l-utils' 'luajit' 'libdvdnav' 'libcdio-paranoia' 'libbluray' 'libxss'
         'enca' 'libguess' 'harfbuzz' 'libxrandr' 'rubberband' 'smbclient' "${_undetected_depends[@]}")

optdepends=('ttf-soure-sans-pro:  needed for subtitles'
            'youtube-dl: Another way to view youtuve videos with mpv'
            'zsh-completions: Additional completion definitions for Zsh users'
            'livestreamer: to watch live video streams (twitch.tv)'
            'vapoursynth-plugin-mvtools: Realtime motion interpolating playback in mpv'
            'acpitool: for battery detection'
            'inxi: HIDPI-detection'
            'svp: SmoothVideo Project' )

makedepends=('mesa' 'python-docutils' 'ladspa' 'x264' 'x265' 'openal' 'jack'
             'samba' 'acpitool' 'waf' 'inxi' 'git' 'vapoursynth'
             'livestreamer' 'youtube-dl')
# check kind of graphic card
if [ -f /usr/bin/nvidia-settings ]||[ $_vdpau = 1 ]|| [ -f /usr/lib/xorg/modules/drivers/nouveau_drv.so ]; then
   # msg "installing libvdpau for NVIDIA users" 
makedepends+=('libvdpau')
optdepends+=('libvdpau: hardware-acceleration for NVIDIA users')
   elif [ -f /usr/bin/aticonfig ]||[ $_vdpau = 1 ]|| [ -f /usr/lib/xorg/modules/drivers/radeon_drv.so ]; then
    msg "installing libvdpau for Radeon users" 
makedepends+=('libvdpau')
optdepends+=('libvdpau: hardware-acceleration for Radeon users')
else
    msg "installing libva for hardware-acceleration support for opensource driver users " 
makedepends+=('libva')
optdepends+=('libva: for open source driver users')
    fi
    
provides=('mpv')
conflicts=('mpv' 'mpv-vapoursynth' 'mpv-ahjolinna-build-git' 'mpv-build-git' )
options=('!emptydirs')
install=mpv.install
source=('git+https://github.com/mpv-player/mpv'
        'find-deps.py'
         "ftp://ftp.ritual.org/common/ColorManagement/BT.709_Profiles.zip"
         "https://github.com/ahjolinna/mpv-conf/raw/master/PKGBUILD/mpv.tar.gz"
        'mpv-hq.desktop'
         'mpv-lq.desktop'
         'mpv-mq.desktop'
         'mpv-MVtools.desktop')

sha256sums=('SKIP'
            'ce974e160347202e0dc63f6a7a5a89e52d2cc1db2d000c661fddb9dc1d007c02'
            'd53aa2c59350a8e364b1a18a5509ba995826f7d37e34ad029251bee082f3c360'
            'fb0fea391407e3a91a158816a716a9ca2bbcc9d5070756a70ba07b31c6a76362'
            'ddd18dbccdaa4513586cb97299e88564e3289940f25d7ebe762c4482fbad3809'
            'e02f7b07653ea4ce9745b9f699954f5a4eafd416ada5a5d032c7dd7294921f90'
            '8cf41f23572417836084209fce343f779e72dea9688dc84e23e8eb913d002d5f'
            'b4a5a64a84c5be668de880d7199195e2e476f980b1e719743931665a7c3ec8bf')

pkgver() {
  cd "$srcdir/$_gitname"
  _curtag="$(git rev-list --tags --max-count=1)"
  _tagver="$(git describe --tags $_curtag | sed -e 's:^v::' -e 's:-:_:g')"
  _commits="$(git rev-list --count HEAD --since=$_tagver)"
  _sha="$(git rev-parse --short HEAD)"
  printf "%s_%s_g%s" $_tagver $_commits $_sha
  #msg "$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)"
}

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

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

  CFLAGS="$CFLAGS -I/usr/include/samba-4.0"
  
msg "cheking if VPDAU or VAAPI will be enabled or disabled" 
if [[ $_libvdpau = 1 ]] || [ -f /usr/bin/nvidia-settings ] ; then
      _vdpau="--enable-vdpau"
      _hwaccel="--enable-vdpau-hwaccel"
      _vaapi=""
      
  elif [[ $_libvdpau = 1 ]] | [ -f /usr/bin/aticonfig ]|[ -f /usr/lib/xorg/modules/drivers/radeon_drv.so ]; then
        _vdpau="--enable-vdpau"
        _hwaccel="--enable-vdpau-hwaccel"
      _vaapi=""
  else
     _vdpau=""
       _vaapi="--enable-vaapi"
       _hwaccel="--enable-vaapi-hwaccel"
  fi

  waf configure \
    --prefix=/usr \
  --confdir=/etc/mpv \
  --disable-test \
  --disable-build-date \
  --enable-libmpv-shared \
  --enable-openal \
  --disable-sdl1 \
  --enable-sdl2 \
  --enable-libmpv-shared \
  --enable-zsh-comp \
  --enable-pulse \
  --enable-egl-x11 \
  --enable-wayland \
  $_vdpau \
  $_hwaccel \
  $_vaapi \
  --enable-libsmbclient \
  --enable-dvdread \
  --enable-libarchive \
  --lua=luajit \
  --enable-libavdevice \
  --enable-vapoursynth
waf build
}

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


 # install the .desktop files
  install -Dm644 "${srcdir}/mpv-lq.desktop" "${pkgdir}/usr/share/applications/mpv-lq.desktop"
  install -Dm644 "${srcdir}/mpv-mq.desktop" "${pkgdir}/usr/share/applications/mpv-mq.desktop"
  install -Dm644 "${srcdir}/mpv-hq.desktop" "${pkgdir}/usr/share/applications/mpv-hq.desktop"
  install -Dm644 "${srcdir}/mpv-MVtools.desktop" "${pkgdir}/usr/share/applications/mpv-MVtools.desktop"
  
  
  # install BT.709 ICC profiles (https://github.com/mpv-player/mpv/issues/534#issuecomment-35823203)
   install -Dm755 "${srcdir}/BT.709_Profiles/BT.709.gamma.1.95.icc" "${pkgdir}/usr/share/color/icc/BT.709_Profiles/BT.709.gamma.1.95.icc"
   install -Dm755 "${srcdir}/BT.709_Profiles/BT.709.gamma.1.95.icc" "${pkgdir}/usr/share/color/icc/BT.709_Profiles/BT.709.icc"
   install -Dm755 "${srcdir}/BT.709_Profiles/BT.709.gamma.1.95.icc" "${pkgdir}/usr/share/color/icc/BT.709_Profiles/BT.709.linear.icc"
  
  
    #install ahjolinna "config-build" files
 cp -R ${srcdir}/mpv/etc*/* ${pkgdir}/etc/mpv
    install -d "${pkgdir}/etc/mpv/"
  

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