summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 207bb990507ac8da604ea04de8f84331fa6a171a (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
94
95
96
97
98
99
100
101
102
103
104
105
# Maintainer: Severin Glöckner <severin.gloeckner@stud.htwk-leipzig.de>

# This doesn't compile with gcc 4.5, 4.9 or the current versions of gcc or clang.
# It does compile with gcc 4.3.

pkgname=wesnoth-1.2
pkgver=1.2.8+dev
pkgrel=1
pkgdesc="Turn-based strategy game on a fantasy world (for old replays)"
arch=('i486' 'i686' 'pentium4' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
url="https://www.wesnoth.org"
license=('GPL')
depends=('sdl' 'sdl_image' 'sdl_mixer' 'sdl_net' 'freetype2')
makedepends=('gcc44' 'git')
options=('!emptydirs')
source=("wesnoth-1.2-git::git+https://github.com/wesnoth/wesnoth.git#branch=1.2"
        "wesnoth-1.2.desktop"
        "wesnothd-1.2.tmpfiles.conf"
        "wesnothd-1.2.service"
        "wesnoth-1.2.appdata.xml")
# Not finding the files? https://aur.archlinux.org/packages/wesnoth-1.2
# Rest assured, they are optional. Things like a launcher for your convenience…

# If one wants to download wesnoth manually:
# git clone https://github.com/wesnoth/wesnoth.git -b 1.2 --shallow-exclude=1.2.8  wesnoth-1.2-git

md5sums=('SKIP'
         'c3ba9b84c818bba105b0ea236b1d3744'
         'd23cafae5c732d6bf10a836bdabd15b9'
         'f75bef73c448e101b09beb8ad92c791e'
         'b6dfb0e146e6ac3a265487b6e32e9766')


prepare() {
  # clean up previous builds, in case different flags or library versions were
  # used before. (|| true avoids failure if the makefile is not yet generated.)
  cd "$srcdir/wesnoth-1.2-git"
  make distclean || true
}


build() {
  cd "$srcdir/wesnoth-1.2-git"
  # As this is an older version and not worked on anymore, it will someday break
  # If you happen to find a fix, please fill a Pull Request for the 1.2 branch
  # at bugs.wesnoth.org

  # Archs default flags are too new for the old compiler
  unset CFLAGS CXXFLAGS
  export CXXFLAGS="-w -pipe"

  export CC=gcc-4.4
  export CXX=g++-4.4

  # It's a convention to use /usr/local when installing by hand, it allows you
  # to keep easier track of what was installed.
  # Feel free to replace ALL occurences of /usr with /usr/local in the commands
  # below, and edit the start command in the file wesnothd-1.2.service.
  ./autogen.sh

  ./configure --with-freetype-prefix=/usr/lib --prefix=/usr --with-preferences-dir=.local/share/wesnoth/1.2 --program-suffix=-1.2 --with-datadir-name=wesnoth-1.2 --enable-editor --enable-server --with-fifodir=/run/wesnothd-1.2

  make
}


# These commands have to be run with root privileges.
# E.g. by prefixing them with "sudo ".
package() {
  cd "$srcdir/wesnoth-1.2-git"

  # On Debian / Ubuntu / Mint / Fedora / Suse, just "make install"
  make DESTDIR="$pkgdir" install

  # The manpages have no suffix by default, so they have the same name like
  # the manpages of other wesnoth installations. To avoid conflicts, rename
  # (or delete) them.
  # Note that you can do this only the installation step shown above, as the
  # command will fail if it doesn't find these files.

  for filename in "$pkgdir"/usr/share/man/{,*/}man6/wesnoth{,d,_editor}.6
    do
      mv "$filename" $(dirname $filename)/$(basename $filename .6)-1.2.6
  done

  # use the tools from a recent version of wesnoth, where they received patches
  rm -r "$pkgdir/usr/share/wesnoth-1.2/data/tools"

  # remove unneeded files
  find "$pkgdir/usr/share" -name .gitignore -delete

  # placing launcher, icons and (not required) appdata and systemd files
  install -D -m644 "$srcdir/wesnoth-1.2.desktop" "$pkgdir/usr/share/applications/wesnoth-1.2.desktop"
  install -D -m644 "$srcdir/wesnoth-1.2-git/icons/wesnoth-icon.png" "$pkgdir/usr/share/icons/hicolor/64x64/apps/wesnoth-1.2-icon.png"
  install -D -m644 "$srcdir/wesnoth-1.2-git/icons/wesnoth-icon-Mac.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/wesnoth-1.2-icon.png"

  install -D -m644 "$srcdir/wesnoth-1.2.appdata.xml" "$pkgdir/usr/share/metainfo/wesnoth-1.2.appdata.xml"

  # On other Linux systems, the two files go into /etc instead of /usr/lib
  install -D -m644 "$srcdir/wesnothd-1.2.tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/wesnothd-1.2.conf"
  install -D -m644 "$srcdir/wesnothd-1.2.service" "$pkgdir/usr/lib/systemd/system/wesnothd-1.2.service"

  # All done, but it doesn't show up? Try that:
  # sudo update-desktop-database
}