AllegroFont PKGBUILD

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
# Maintainer: Jonathan Fine
# Contributor: quantax -- contact via Arch Linux forum or AUR
# Contributor: xx4h

pkgname=alfont
pkgver=2.0.9
pkgrel=6
pkgdesc="Allegro wrapper for FreeType2 enabling the use of various font formats"
arch=(i686 x86_64)
url="http://chernsha.sitesled.com/"
license=(custom:FreeType2)
depends=(allegro4 freetype2)
makedepends=(unrar)
source=(http://chernsha.sitesled.com/AlFont209.rar
        http://opensnc.sourceforge.net/alfont/alfont.c)
noextract=(AlFont209.rar)
md5sums=('92898c28788d42d0eaa53c607ff40974'
         '9259678a2598f11b00d83b525fdcefc0')

build() {
    cd "$srcdir"
    msg "Extracting AlFont209.rar with unrar"
    unrar x -idq -o+ AlFont209.rar $pkgname/{docs/FTL.txt,include}
    # use fixed alfont.c from http://opensnc.sourceforge.net/alfont/
    install -D alfont.c "$pkgname/src/alfont.c"
    cd "$pkgname"

    # we are building for Linux
    sed -e '/^#define ALFONT_WINDOWS/s,^,//,' \
            -e '/^\/\/#define ALFONT_LINUX/s,^//,,' -i include/alfont.h
    # build instructions adapted from Fedora's:
    # http://pkgs.fedoraproject.org/gitweb/?p=alfont.git;a=blob;f=alfont.spec
    gcc $CFLAGS -fPIC $(freetype-config --cflags) -Iinclude \
            -c src/alfont.c -o src/alfont.o
    gcc -shared $LDFLAGS -Wl,--no-as-needed,-soname,libalfont.so.${pkgver%%.*} \
            $(allegro-config --libs) $(freetype-config --libs) \
            src/alfont.o -o libalfont.so.$pkgver
}

package() {
    cd "$srcdir/$pkgname"
    install -Dm755 libalfont.so.$pkgver \
            "$pkgdir/usr/lib/lib$pkgname.so.$pkgver"
    ln -s libalfont.so.$pkgver \
            "$pkgdir/usr/lib/libalfont.so.${pkgver%%.*}"
    ln -s libalfont.so.$pkgver "$pkgdir/usr/lib/libalfont.so"
    install -Dm644 include/alfont.h "$pkgdir/usr/include/alfont.h"
    install -Dm644 include/alfontdll.h "$pkgdir/usr/include/alfontdll.h"
    install -Dm644 docs/FTL.txt "$pkgdir/usr/share/licenses/$pkgname/FTL.txt"
}