summaryrefslogtreecommitdiff
path: root/manualPorts/openttd-git/Pkgfile
blob: 46162d5afdf826534641629de8f6b8006372402b (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
# Description: A FOSS clone of Transport Tycoon Deluxe.
# URL: http://www.openttd.org
# Maintainer: Erich Eckner, crux at eckner dot net
# Packager: Lennart Sauerbeck, devel at lennart dot sauerbeck dot org
# Depends on: libsdl libpng fontconfig lzo

name=openttd-git
version=29036.dabccf70b4

gfxversion=0.5.4
sfxversion=0.2.3
msxversion=0.3.1
release=2
source=(http://bundles.openttdcoop.org/opengfx/releases/$gfxversion/opengfx-$gfxversion.zip
        http://bundles.openttdcoop.org/opensfx/releases/$sfxversion/opensfx-$sfxversion.zip
        http://bundles.openttdcoop.org/openmsx/releases/$msxversion/openmsx-$msxversion.zip
        signaltunnel.patch
        sloped-stations.patch
        underground.patch
        https://github.com/OpenTTD/OpenTTD/archive/${version##*.}.tar.gz)

build() {

    tar -xf opengfx-$gfxversion.tar

    cd OpenTTD-${version##*.}*

    ISODATE=$(find {src,bin} -type f -printf "%TY%Tm%Td\n" | sort -n | tail -n1)
    HASH=$(find {src,bin} -type f -exec sha512sum {} \; | sort | sha512sum - | cut -d' ' -f1)
    SHORTHASH=$(echo ${HASH} | cut -c1-8)
    printf '%s\t%s\t%s\t%s\t%s\t%s\n' \
      "${ISODATE}-ewe-g${SHORTHASH}" \
      "${ISODATE}" \
      "0" \
      "${HASH}" \
      0 \
      0 \
      > .ottdrev
    sed -i '
      s,"\$ROOT_DIR/\.git","/dev/does/not/exist",
    ' findversion.sh
    patch -p1 -i "$SRC/signaltunnel.patch"
    patch -p1 -i "$SRC/sloped-stations.patch"
#    patch -p1 -i "$SRC/underground.patch" # broken?

    sed -i '
      s/readme\.txt/README.md/g
    ' Makefile.bundle.in

    ./configure --prefix-dir=/usr \
                --binary-dir=bin \
                --data-dir=share/openttd \
                --icon-dir=share/openttd \
                --man-dir=share/man/man6 \
                --personal-dir=.openttd \
                --install-dir=$PKG

    make
    make DESTDIR=$PKG install

    # Install OpenGFX
    install -d $PKG/usr/share/openttd/data/opengfx-$gfxversion
    install -m 644 $SRC/opengfx-$gfxversion/* $PKG/usr/share/openttd/data/opengfx-$gfxversion
    chown -R root:root $PKG/usr/share/openttd/data/opengfx-$gfxversion

    # Install OpenSFX
    install -d $PKG/usr/share/openttd/data/opensfx-$sfxversion
    install -m 644 $SRC/opensfx-$sfxversion/* $PKG/usr/share/openttd/data/opensfx-$sfxversion
    chown -R root:root $PKG/usr/share/openttd/data/opensfx-$sfxversion

    # Install OpenMSX
    install -d $PKG/usr/share/openttd/gm
    install -m 644 $SRC/openmsx-$msxversion/* $PKG/usr/share/openttd/gm
    chown -R root:root $PKG/usr/share/openttd/gm/*

    # Remove unnecessary languages
    cp $PKG/usr/share/openttd/lang/{english,german}.lng $SRC
    rm $PKG/usr/share/openttd/lang/*
    install -m 644 $SRC/{english,german}.lng $PKG/usr/share/openttd/lang

    # Remove junk
    rm -rf $PKG/usr/share/doc
    rm -rf $PKG/usr/share/openttd/scripts
    rm $PKG/usr/share/openttd/data/opengfx-$gfxversion/{changelog,readme}.txt
    rm $PKG/usr/share/openttd/data/opensfx-$sfxversion/{changelog,readme}.txt
    rm $PKG/usr/share/openttd/gm/{changelog,readme}.txt
}