summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 79919693bb9ad953f45a2f648d307957a910d186 (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
# Maintainer: drakkan <nicola.murino at gmail dot com>
pkgname=mingw-w64-openh264
pkgver=2.0.0
pkgrel=2
pkgdesc="OpenH264 is a codec library which supports H.264 encoding and decoding (mingw-w64)"
arch=(any)
url="http://www.openh264.org/"
license=("BSD")
depends=('mingw-w64-gcc')
makedepends=('nasm')
options=(!strip !buildflags staticlibs)
source=("https://github.com/cisco/openh264/archive/v${pkgver}.tar.gz")
sha256sums=('73c35f80cc487560d11ecabb6d31ad828bd2f59d412f9cd726cc26bfaf4561fd')

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


build() {
  export CPPFLAGS="-D_FORTIFY_SOURCE=2"
  export CFLAGS="-pipe -fno-plt -fexceptions --param=ssp-buffer-size=4"
  export CXXFLAGS=${CFLAGS}
  export LDFLAGS="-Wl,-O1,--sort-common,--as-needed -fstack-protector -lssp"
  for _arch in ${_architectures}; do
    [[ -d "build-${_arch}" ]] && rm -rf "build-${_arch}"
    cp -rf "$srcdir/openh264-${pkgver}" "${srcdir}/build-${_arch}"

    pushd build-${_arch}	
    if [ ${_arch} = "i686-w64-mingw32" ]; then
      _targetarch="i686"
    else
      _targetarch="x86_64"
    fi
    make OS=mingw_nt ARCH=${_targetarch} CC=${_arch}-gcc CXX=${_arch}-g++ AR=${_arch}-ar
    popd	
  done
}

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

    if [ ${_arch} = "i686-w64-mingw32" ]; then
      _targetarch="i686"
    else
      _targetarch="x86_64"
    fi

    make OS=mingw_nt ARCH=${_targetarch} CC=${_arch}-gcc CXX=${_arch}-g++ AR=${_arch}-ar DESTDIR="${pkgdir}" PREFIX="/usr/${_arch}" install
 
    install -Dm755 h264dec.exe "$pkgdir"/usr/${_arch}/bin/h264dec.exe
    install -Dm755 h264enc.exe "$pkgdir"/usr/${_arch}/bin/h264enc.exe

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

# vim: ts=2 sw=2 et: