summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 878659d438ce137dd1b769c9c121e6f68453220f (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
pkgname=vgmstream-git
pkgver=r1917.144.gae167795
pkgrel=1
pkgdesc='Library for playback of various streamed audio formats used in video games'
arch=(x86_64)
url='https://github.com/vgmstream/vgmstream'
license=(BSD)
depends=(ffmpeg libao libatrac9-git libogg libvorbis mpg123 speex)
makedepends=(audacious git gtk2)
optdepends=('audacious: for using the bundled plugin')
provides=(vgmstream)
conflicts=(vgmstream vgmstream-kode54-git)
replaces=(vgmstream-kode54-git)
source=(${pkgname}::git+https://github.com/vgmstream/vgmstream.git
        https://downloads.xiph.org/releases/celt/celt-0.6.1.tar.gz
        https://downloads.xiph.org/releases/celt/celt-0.11.0.tar.gz
        install-headers.patch
        add-missing-include.patch)
sha256sums=('SKIP'
            'a991dff4a9e0772ede0881d81cdc7ac559148c2194885cbdd534fe4af43779da'
            'c94d4d34f5a2caa1574b1a94869202cacd959b55f643a8bafe0660008acad9c3'
            'f8661e67a4af3c306bf6ad1512146ab8a32a8c5dce78a59d3de534135cea8ce4'
            'da37589638f1879155f50124fb2eca8b7ad41250b89f13018efbfc53a1c03693')

pkgver() {
  cd "$srcdir/$pkgname"
  git describe --tags --long | tr - .
}

prepare() {
  cd "$srcdir/$pkgname"
  patch -p0 < "$srcdir"/install-headers.patch
  patch -p0 < "$srcdir"/add-missing-include.patch
}

celt_symbols=(
  alg_quant
  alg_unquant
  celt_decode
  celt_decoder_create
  celt_decoder_create_custom
  celt_decoder_destroy
  celt_mode_create
  celt_mode_destroy
  celt_mode_info
  celt_encoder_destroy
  celt_encoder_create
  celt_encode
  celt_encode_float
  celt_encoder_ctl
  celt_decode_float
  celt_decoder_ctl
  compute_allocation
  compute_band_energies
  denormalise_bands
  ec_dec_init
  ec_decode
  ec_decode_bin
  ec_dec_update
  ec_dec_uint
  ec_dec_bits
  ec_enc_init
  ec_encode
  ec_encode_bin
  ec_enc_uint
  ec_enc_bits
  ec_enc_done
  normalise_bands
  renormalise_vector
  quant_coarse_energy
  quant_fine_energy
  quant_energy_finalise
  unquant_coarse_energy
  unquant_energy_finalise
  unquant_fine_energy)

build() {
  celt06_cflags="$CFLAGS -fPIC"
  for sym in ${celt_symbols[@]}; do
    celt06_cflags+=" -D$sym=${sym}_0061"
  done
  celt11_cflags="${celt06_cflags//_0061/_0110} -DCUSTOM_MODES=1"

  make -f /dev/stdin <<EOF
all .PHONY: $srcdir/celt-0.6.1 $srcdir/celt-0.11.0
$srcdir/celt-0.6.1:
	cd "\$@" && CFLAGS="$celt06_cflags" ./configure
	\$(MAKE) -C "\$@"
$srcdir/celt-0.11.0:
	cd "\$@" && CFLAGS="$celt11_cflags" ./configure
	\$(MAKE) -C "\$@"
EOF

  cd "$srcdir/$pkgname"
  ./bootstrap
  CFLAGS="$CFLAGS -DVGM_USE_FFMPEG -DVGM_USE_MPEG -DVGM_USE_VORBIS -DVGM_USE_G7221 -DVGM_USE_ATRAC9 -DVGM_USE_CELT -DVGM_USE_SPEEX" \
    LIBS="-lavcodec -lavformat -lavutil -latrac9 $srcdir/celt-0.6.1/libcelt/.libs/libcelt.a $srcdir/celt-0.11.0/libcelt/.libs/libcelt0.a -lm" \
    ./configure --prefix=/usr
  make -f Makefile.autotools
}

package() {
  cd "$srcdir/$pkgname"
  make -f Makefile.autotools install DESTDIR="$pkgdir"
  install -Dm644 -t "$pkgdir"/usr/share/licenses/$pkgname COPYING
}

check() {
  cd "$srcdir/$pkgname"
  make -f Makefile.autotools install DESTDIR="$srcdir/test"
  printf '#include <vgmstream/%s.h>\n' vgmstream api | gcc -E - -I "$srcdir/test/usr/include" -o /dev/null
}

# vim:set sw=2 et: