summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f2aa3485c751aaeb7faf1caf6f1831f6707f13ef (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
_pkgname=mpv
pkgname="mingw-w64-${_pkgname}"
pkgver=0.30.0
pkgrel=1
pkgdesc="Video player based on MPlayer/mplayer2 (mingw-w64)"
url="https://mpv.io/"
arch=('any')
license=('GPL')
depends=("mingw-w64-ffmpeg"
         "mingw-w64-lcms2"
         "mingw-w64-libass"
         "mingw-w64-libbluray"
         "mingw-w64-libjpeg-turbo"
         "mingw-w64-shaderc"
         "mingw-w64-crossc")
makedepends=("mingw-w64-gcc"
             "perl"
             "mingw-w64-pkg-config"
             "python")
options=(staticlibs !strip !buildflags)
source=(${_pkgname}-${pkgver}.tar.gz::https://github.com/mpv-player/${_pkgname}/archive/v${pkgver}.tar.gz)
sha256sums=('33a1bcb7e74ff17f070e754c15c52228cf44f2cefbfd8f34886ae81df214ca35')

_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

prepare() {
  pushd ${_pkgname}-${pkgver}
  [[ -x ./waf ]] || /usr/bin/python3 ./bootstrap.py
  popd

  for _arch in ${_architectures}; do
    cp -rf "${_pkgname}-${pkgver}" "build-${_arch}"
  done
  rm -rf "${_pkgname}-${pkgver}"
}

build() {
  cd "${srcdir}/"
  for _arch in ${_architectures}; do
    pushd build-${_arch}
    DEST_OS=win32 \
    TARGET=${_arch} \
    PKG_CONFIG=/usr/bin/${_arch}-pkg-config \
    CC=/usr/bin/${_arch}-gcc \
    PERL=/usr/bin/perl \
    AR=/usr/bin/${_arch}-ar \
    WINDRES=/usr/bin/${_arch}-windres \
    ./waf configure \
      --prefix=/usr/$_arch \
      --check-c-compiler=gcc \
      --enable-libmpv-shared \
      --disable-egl-angle \
      --disable-egl-angle-lib
    ./waf build
    popd
  done
}

package() {
  cd "${srcdir}"
  for _arch in ${_architectures}; do
    pushd build-${_arch}

    export PYTHON=/usr/$_arch/bin/python
    ./waf install --destdir="${pkgdir}"

    find "$pkgdir/usr/${_arch}" -name '*.exe' -exec ${_arch}-strip {} \;
    find "$pkgdir/usr/${_arch}" -name '*.dll' -exec ${_arch}-strip --strip-unneeded {} \;
    find "$pkgdir/usr/${_arch}" -name '*.a' -o -name '*.dll' | xargs ${_arch}-strip -g

    # Move encoding-profiles.conf to share/doc alongside the example .conf files.
    # mpv doesn't search /etc for configuration on MinGW.
    mv "${pkgdir}/usr/$_arch/etc/mpv/"*.conf "${pkgdir}/usr/$_arch/share/doc/mpv/"

    popd
  done
}