summaryrefslogtreecommitdiff
path: root/community/dumb/PKGBUILD
blob: 2ddfc6153f625f1c264423e7c325f537da639261 (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
# 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=6
pkgdesc="An IT, XM, S3M and MOD player library"
arch=('i686' 'x86_64')
license=('custom:dumb' 'GPL')
url="http://dumb.sourceforge.net/"
depends=('glibc' 'allegro4')
source=(http://downloads.sourceforge.net/sourceforge/dumb/$pkgname-$pkgver.tar.gz
        as-needed.patch
        CVE-2006-3668.patch)
md5sums=('f48da5b990aa8aa822d3b6a951baf5c2'
         '580676387b07d3b5998bbd525df2df52'
         'e1378e2eb30346073ee188608ac2c9e7')

build() {
  cd "$srcdir/$pkgname-$pkgver"
  [ "${CARCH}" = "x86_64" ] && export CFLAGS="${CFLAGS} -fPIC"

  # Fix CVE-2006-3668 (Patch found in Gentoo and other distros).
  patch -p1 < "$srcdir/CVE-2006-3668.patch"

  # Apply a patch from Gentoo, so that we can build against binutils
  # 2.22 and above.
  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 := "$pkgdir/usr"
EOF

  # Upstream's makefile ignores our CFLAGS.  They put -I directives in
  # their own CFLAGS, so we can't just say
  # make CFLAGS=...
  # Gentoo's ebuild overrides another of their makefile variables, named
  # OFLAGS.
  make OFLAGS="${CFLAGS}"
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  # Create directories
  install -d "$pkgdir"/usr/{lib,bin,include}
  install -D -m644 licence.txt \
    "$pkgdir/usr/share/licenses/$pkgname/licence.txt"

  make install
}