summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 21db881b48e37702be1a4e703f3822e9480cef47 (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
# Maintainer: Matti Niemenmaa <matti.niemenmaa+aur ät iki dȯt fi>

pkgname=lazyusf2-git
pkgver=r69.ab6a646
pkgrel=2
pkgdesc="Library for decoding Nintendo 64 Sound Format files using Mupen64plus"
arch=(i686 x86_64)
url='https://bitbucket.org/kode54/lazyusf2'
license=(GPL2 custom:CC0)
depends=(glibc zlib)
makedepends=(git grep)
source=(${pkgname}::git+https://bitbucket.org/kode54/lazyusf2.git
        makefile.patch
        makefile-i686.patch
        LICENSE.CC0)
sha256sums=('SKIP'
            '7a48693ef6e9d41d7f0fa93094603b5decad888454a1fc9bbf6de8fdf88e3995'
            'cc7592e8f50a89725949b6e69079104ded03cdbb7173cf2da82c2f3c4cae2e4d'
            'a90051e82202a5dc51162127c6834f8434fb2ece57795317951420fe6a8f4562')

pkgver() {
  cd "$srcdir/$pkgname"
  ( set -o pipefail
    git describe --long 2>/dev/null | sed -r 's/([^-]*-g)/r\1/;s/-/./g' ||
      printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

prepare() {
  cd "$srcdir/$pkgname"
  patch Makefile "$srcdir"/makefile.patch
  if [[ $CARCH = i686 ]]; then
    patch Makefile "$srcdir"/makefile-i686.patch
  fi
}

build() {
  cd "$srcdir/$pkgname"
  ROPTS="-c -O3 -I."
  CFLAGS="$CFLAGS -fPIC"
  { grep \^flags /proc/cpuinfo | fgrep -qw ssse3 && CFLAGS+=" -mssse3" && ROPTS+=" -DARCH_MIN_SSSE3"; } ||
    { grep \^flags /proc/cpuinfo | fgrep -qw sse2 && CFLAGS+=" -msse2" && ROPTS+=" -DARCH_MIN_SSE2"; }
  make liblazyusf.{a,so} CFLAGS="$CFLAGS" ROPTS="$ROPTS"
}

package() {
  cd "$srcdir/$pkgname"
  install -D -m644 -t "$pkgdir/usr/include" usf/usf.h
  install -D -m644 -t "$pkgdir/usr/lib" liblazyusf.{a,so}
  install -D -m644 -t "$pkgdir/usr/share/licenses/$pkgname" "$srcdir"/LICENSE.CC0
}

# vim:set sw=2 et: