summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 11442aed3fd1a609bb217b2274410967520f6f55 (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
# Maintainer: Karl-Felix Glatzer <karl.glatzer@gmx.de>
pkgname=mingw-w64-libvpx
pkgver=1.15.0
pkgrel=1
pkgdesc="VP8 and VP9 codec (mingw-w64)"
arch=('any')
url="http://www.webmproject.org/"
license=('custom:BSD')
depends=('mingw-w64-crt')
options=(!strip !buildflags staticlibs !debug)
makedepends=('mingw-w64-gcc' 'yasm' 'git')
_tag=5a65405dde363f5c50b568cf85bd7d6d874ce145
source=(git+https://chromium.googlesource.com/webm/libvpx#tag=${_tag}
        # patches from MSYS2 (https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-libvpx)
        '0001-enable-shared-on.mingw.patch'
        '0005-fix-exports.mingw.patch')
b2sums=('6b2db5d77c0f6f8f0353dc9ae021a55e32ff8412d0cea9f2c0c5b258497d77c93968535bf98abb8108bf639fed303d961016817902767875d959fd5f21c8a2d3'
        '717394b571a5fa8325cd64092886e2f013facde7bea08aef4f8361e97e10fd2c9ffc93ab8d070ab2f16e994766206e9ba39e793b7852e5b70f426b50fb9e63f1'
        '89024d854bf3fd514b2c219f133f2fc82bdab22158b74da90053c3a3812c148f6b43e7061d179ab8dbc0e6c441a23f95499a00180fb52b20effb9ba2504f00a8')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

pkgver() {
  cd libvpx

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd ${srcdir}/libvpx

  patch -Np1 -i "${srcdir}/0001-enable-shared-on.mingw.patch"
  patch -Np1 -i "${srcdir}/0005-fix-exports.mingw.patch"
}

build() {
  for _arch in ${_architectures}; do
    mkdir -p ${srcdir}/libvpx/build-${_arch} && cd ${srcdir}/libvpx/build-${_arch}

    unset EXTRA_CFLAGS

    if [ ${_arch} = "i686-w64-mingw32" ]; then
      _targetarch="x86-win32-gcc"
      EXTRA_CFLAGS="-mstackrealign"
    else
      _targetarch="x86_64-win64-gcc"
    fi

    CFLAGS="$EXTRA_CFLAGS $CFLAGS -fno-asynchronous-unwind-tables" CROSS="${_arch}-" ../configure \
        --prefix=/usr/${_arch} \
        --target=${_targetarch} \
        --disable-docs \
        --disable-install-docs \
        --disable-install-srcs \
        --disable-unit-tests \
        --enable-pic \
        --enable-postproc \
        --enable-runtime-cpu-detect \
        --enable-shared \
        --enable-vp8 \
        --enable-vp9 \
        --enable-vp9-highbitdepth \
        --enable-vp9-temporal-denoising

    make
  done
}

package() {
  for _arch in ${_architectures}; do
    cd ${srcdir}/libvpx/build-${_arch}
    make DIST_DIR="$pkgdir/usr/${_arch}" install

    ${_arch}-strip -s ${pkgdir}/usr/${_arch}/bin/*.exe
    ${_arch}-strip -g --strip-unneeded ${pkgdir}/usr/${_arch}/bin/*.dll
    ${_arch}-strip -g ${pkgdir}/usr/${_arch}/lib/*.a
  done

  cd ${srcdir}/libvpx

  install -Dm 644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}/
}

# vim: ts=2 sw=2 et: