summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1112e2b17da1c6cbac756925fef62e39248377a7 (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
# Maintainer: Fabio 'Lolix' Loli <fabio.loli@disroot.org> -> https://github.com/FabioLolix

pkgname=openloco-git
pkgver=25.01.r2.gea4cb00e5
pkgrel=1
pkgdesc="An open source re-implementation of Chris Sawyer's Locomotion"
arch=(x86_64 i686)
url="https://github.com/OpenLoco/OpenLoco"
license=(MIT)
depends=(sdl2 libpng openal)
depends_x86_64+=(lib32-glibc lib32-gcc-libs lib32-sdl2 lib32-libpng lib32-openal)
makedepends=(cmake yaml-cpp git gtest fmt)
makedepends_x86_64+=(lib32-gtest lib32-yaml-cpp lib32-fmt)
optdepends_x86_64=(
    'lib32-libpipewire: audio output'
    'lib32-libpulse: audio output'
)
optdepends_i686=(
    'libpipewire: audio output'
    'libpulse: audio output'
)
provides=(openloco)
conflicts=(openloco)
options=(!lto)
source=("git+https://github.com/openloco/openloco.git"        )
sha256sums=('SKIP')

pkgver() {
  cd openloco
  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {

    # -Dfmt_DIR:PATH=/usr/lib/cmake/fmt -> pointless; want lib32-fmt
    # -Dsfl_DIR:PATH=/usr/include/sfl   -> pointless; want to checkout it, no system version


	local _flags=(
    -DFETCHCONTENT_QUIET:BOOL=OFF
    #-DFETCHCONTENT_FULLY_DISCONNECTED:BOOL=ON
    #-Dfmt_DIR:PATH=/usr/lib/cmake/fmt
    #-Dsfl_DIR:PATH=/usr/include/sfl
    #-Dyaml-cpp_DIR:PATH=/usr/lib/cmake/yaml-cpp
	)

  export CXXFLAGS="$CXXFLAGS -m32 -Wno-error=null-dereference"
  cmake -G "Unix Makefiles" -B build -S "openloco" -Wno-dev \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    "${_flags[@]}"

  cmake --build build
}

check() {
  ctest --test-dir build --output-on-failure
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
  ln -s /usr/bin/OpenLoco           "${pkgdir}/usr/bin/openloco"
  install -D "openloco/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"

  #remove bundled sfl from package
  rm -rf "${pkgdir}/usr/include/sfl"
}