summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8e0908c2f0bd132aa2b9640002b743d5e1333ddb (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Maintainer: xiota / aur.chaotic.cx

_pkgname=flycast
pkgname="$_pkgname"
pkgver=2.1
_tag="V${pkgver%%.r*}"
pkgrel=3
pkgdesc='A multi-platform Sega Dreamcast, Naomi and Atomiswave emulator'
arch=('x86_64' 'i686')
url="https://github.com/flyinghead/flycast"
license=('GPL2')

depends=(
  'alsa-lib'
  'hicolor-icon-theme'
  'libgl'
  'libzip'
)
makedepends=(
  'cmake'
  'git'
  'python'
  'systemd'
)

provides=(reicast)

if [ x"$pkgname" == x"$_pkgname" ] ; then
  # normal package
  _pkgsrc="$_pkgname"
  source+=(
    "$_pkgsrc"::"git+$url.git#tag=$_tag"
  )
  sha256sums+=(
    'SKIP'
  )

  pkgver() {
    cd "$_pkgsrc"
    echo "${pkgver%%.r*}"
  }
else
  # git package
  provides+=("$_pkgname")
  conflicts+=("$_pkgname")

  _pkgsrc="$_pkgname"
  source+=(
    "$_pkgsrc"::"git+$url.git"

    # submodules
    'Spout'::'git+https://github.com/vkedwardli/Spout2'
    'Syphon'::'git+https://github.com/vkedwardli/Syphon-Framework'
  )
  sha256sums+=(
    'SKIP'

    'SKIP'
    'SKIP'
  )

  pkgver() {
    cd "$_pkgsrc"
    git describe --long --tags | sed -E 's/^[Vv]//;s/([^-]*-g)/r\1/;s/-/./g'
  }
fi

source+=(
  # common submodules
  "SDL"::"git+https://github.com/libsdl-org/SDL"
  "Vulkan-Headers"::"git+https://github.com/KhronosGroup/Vulkan-Headers"
  "VulkanMemoryAllocator"::"git+https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator"
  "breakpad"::"git+https://github.com/flyinghead/mingw-breakpad"
  "glslang"::"git+https://github.com/KhronosGroup/glslang"
  "libchdr"::"git+https://github.com/flyinghead/libchdr"
  "luabridge"::"git+https://github.com/vinniefalco/LuaBridge"
  "oboe"::"git+https://github.com/google/oboe"
)
sha256sums+=(
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
  'SKIP'
)

prepare() {
  cd "$_pkgsrc"

  local _submodules=(
    'core/deps/SDL'
    'core/deps/Vulkan-Headers'
    'core/deps/VulkanMemoryAllocator'
    'core/deps/breakpad'
    'core/deps/glslang'
    'core/deps/libchdr'
    'core/deps/luabridge'
    'core/deps/oboe'
  )

  if [ x"${pkgname: -4}" != x"-git" ] ; then
    _submodules+=(
      'core/deps/Spout'
      'core/deps/Syphon'
    )
  fi

  for submodule in "${_submodules[@]}" ; do
    git submodule init "${submodule}"
    git submodule set-url "${submodule}" "${srcdir}/${submodule##*/}"
    git -c protocol.file.allow=always submodule update "${submodule}"
  done

  # add missing includes
  local _file='core/deps/breakpad/src/client/linux/handler/minidump_descriptor.h'
  if ! grep cstdint "$_file" > /dev/null ; then
    sed -Ei 's@^(#include "common/using_std_string.h")$@\1\n#include <cstdint>@' "$_file"
  fi
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -DCMAKE_INSTALL_PREFIX='/usr'
  )
  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}