summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4e4215598dea5296e42f97598df3c5da0fb66c51 (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
# Maintainer: Darryl Pogue <darryl at dpogue dot ca>
# Contributor: Michael Hansen <zrax0111 at gmail dot com>

pkgname=mingw-w64-libwebm
pkgver=1.0.0.28
pkgrel=1
pkgdesc="WebM video file parser"
url="https://www.webmproject.org/"
arch=(any)
license=('BSD')
depends=(mingw-w64-crt)
makedepends=(cmake mingw-w64-gcc)
options=('!strip' '!buildflags' 'staticlibs')
source=("https://github.com/webmproject/libwebm/archive/libwebm-${pkgver}.tar.gz"
        cmake_install.patch)
sha256sums=('4df11d93260d3cd9f17c3697b0828d38400a8f87082183368df6a1ae7a9fc635'
            '8041827dc63d45c65af9870f2a7958a4be81db8da511f440f89aded8d29d8ca8')

_architectures="i686-w64-mingw32:x86-mingw-gcc x86_64-w64-mingw32:x86_64-mingw-gcc"

prepare() {
  cd "$srcdir/libwebm-libwebm-$pkgver"
  patch -p1 -i ../cmake_install.patch
}

build() {
  cd "$srcdir/libwebm-libwebm-$pkgver"
  for _arch in ${_architectures}; do
    IFS=':' read -ra ARCH <<< "${_arch}"
    mkdir -p build-${ARCH[0]} && pushd build-${ARCH[0]}
    cmake \
      -DCMAKE_TOOLCHAIN_FILE=build/${ARCH[1]}.cmake \
      -DCMAKE_INSTALL_PREFIX=/usr/${ARCH[0]} \
      -DCMAKE_INSTALL_LIBDIR=lib \
      -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
      -DBUILD_SHARED_LIBS=ON \
      -DENABLE_WEBM_PARSER=ON \
      -DENABLE_WEBMTS=OFF \
      -DENABLE_WEBMINFO=OFF \
      -DENABLE_SAMPLES=OFF \
      -DENABLE_TOOLS=OFF \
      ..
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
    IFS=':' read -ra ARCH <<< "${_arch}"
    cd "$srcdir/libwebm-libwebm-$pkgver/build-${ARCH[0]}"
    make DESTDIR="$pkgdir" install
    ${ARCH[0]}-strip --strip-unneeded "$pkgdir"/usr/${ARCH[0]}/bin/*.dll
    ${ARCH[0]}-strip -g "$pkgdir"/usr/${ARCH[0]}/lib/*.a
    if [[ $NO_EXECUTABLES ]]; then
      find "${pkgdir}/usr/${ARCH[0]}" -name '*.exe' -delete
    else
      find "${pkgdir}/usr/${ARCH[0]}" -name '*.exe' -exec ${ARCH[0]}-strip --strip-all {} \;
    fi
    install -Dm644 ../LICENSE.TXT $pkgdir/usr/${ARCH[0]}/share/licenses/libwebm/LICENSE
  done
}