summaryrefslogtreecommitdiff
path: root/manualPorts/openttd-git/Pkgfile
blob: c4cc7eed0939037cf9e67a2b0e9398b9d4e5630a (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
# 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=31295.236f71640

gfxversion=0.5.4
sfxversion=0.2.3
msxversion=0.3.1
release=1
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
#        chunnel.patch
#        chunnel-signaltunnel-pre.patch
#        chunnel-underground-pre.patch
        signaltunnel.patch
        sloped-stations.patch
        underground.patch
        opntitle.dat
        https://github.com/OpenTTD/OpenTTD/archive/${version##*.}.tar.gz)

build() {

#    cp chunnel.patch chunnel.pre.patch
#    patch -p1 -i chunnel-signaltunnel-pre.patch
#    patch -p1 -i chunnel-underground-pre.patch

    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 \
      "${ISODATE:0:4}" \
      > .ottdrev
    sed -i '
      s,"\${CMAKE_SOURCE_DIR}/\.git","/dev/does/not/exist",
    ' cmake/scripts/FindVersion.cmake
    patch -p1 -i "$SRC/signaltunnel.patch"
#    patch -p1 -i "$SRC/sloped-stations.patch" # broken!
    patch -p1 -i "$SRC/underground.patch" # broken?
#    patch -p1 -i "$SRC/chunnel.pre.patch" # broken!

    mkdir build
    cd build
    cmake \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DCMAKE_INSTALL_BINDIR=bin \
      -DPERSONAL_DIR=.openttd \
      ..
    make
    make DESTDIR=$PKG install

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

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

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

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

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