summaryrefslogtreecommitdiff
path: root/community/dumb/PKGBUILD
blob: b499d95794784f09b63a23da811744445184243e (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
# $Id: PKGBUILD 83614 2013-02-03 23:11:33Z arodseth $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Chris Brannon <cmbrannon79@gmail.com>
# Contributor: JJDaNiMoTh <jjdanimoth@gmail.com>
# Contributor: Bjørn Lindeijer <bjorn lindeijer nl>

pkgname=dumb
pkgver=0.9.3
pkgrel=7
pkgdesc='IT, XM, S3M and MOD player library'
arch=('x86_64' 'i686' 'mips64el')
license=('custom:dumb' 'GPL')
url='http://dumb.sourceforge.net/'
makedepends=('setconf')
depends=('glibc' 'allegro4')
source=("http://downloads.sourceforge.net/sourceforge/dumb/$pkgname-$pkgver.tar.gz"
        'as-needed.patch'
        'CVE-2006-3668.patch')
sha256sums=('8d44fbc9e57f3bac9f761c3b12ce102d47d717f0dd846657fb988e0bb5d1ea33'
            'f7a41576d5dcecad2f9a01cbb0228457b434423046cb67c9a0a720ec87f43fb9'
            '9f6785435757db725bc73b1c4874b91e80b9277c6fdd2b56e47dae1cfbc968e6')

build() {
  cd "$srcdir/$pkgname-$pkgver"

  # Add -fPIC for anything but i686
  [ "$CARCH" = 'i686' ] || export CFLAGS="${CFLAGS} -fPIC"

  # Patch from Gentoo for CVE-2006-3668
  patch -p1 < "$srcdir/CVE-2006-3668.patch"

  # Patch from Gentoo for binutils >= 2.22
  patch -p1 < "$srcdir/as-needed.patch"
  sed -i '/LDFLAGS :=/d' Makefile
  cp Makefile Makefile.rdy

  # Make with Allegro support
  # Upstream's make process is interactive, and we can't simply pass
  # a here-document to the make command.  The best way is to write our
  # own config.txt, circumventing the interactive configuration step,
  # as is done in Gentoo's ebuild.
	cat << EOF > make/config.txt
include make/unix.inc
ALL_TARGETS := core core-examples core-headers
ALL_TARGETS += allegro allegro-examples allegro-headers
PREFIX := /usr
EOF
  # For some reason -lm is not linked for Allegro examples.
  sed -ri 's/^(LINK_ALLEGRO := .+)$/\1 -lm/' make/unix.inc

  # Use OFLAGS to be able to set CFLAGS without replacing the -I directives
  make -j1 OFLAGS="${CFLAGS}"
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  install -d "$pkgdir"/usr/{lib,bin,include}
  install -Dm644 licence.txt \
    "$pkgdir/usr/share/licenses/$pkgname/licence.txt"
  setconf make/config.txt PREFIX "$pkgdir/usr"
  make DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et: