summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 94a4fb0ae59dea7d7cdc3610225bc15419adca2e (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
# Maintainer: HurricanePootis <hurricanepootis@protonmail.com>
# Contributor: seth <getchoo at tuta dot io>
# Contributor: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: loqs
# Contributor: Jorge Araya Navarro <jorgejavieran@yahoo.com.mx>
# Contributor: Cristian Porras <porrascristian@gmail.com>
# Contributor: Matthew Bentley <matthew@mtbentley.us>

_pkgname=godot
pkgname=godot3-mono
pkgver=3.5.3
pkgrel=2
pkgdesc='Advanced cross-platform 2D and 3D game engine (3.x Branch Mono)'
url='https://godotengine.org'
license=(MIT)
arch=(x86_64)
makedepends=(gcc scons yasm alsa-lib pulseaudio nuget xorg-server-xvfb)
depends=(embree3 freetype2 libglvnd libtheora libvorbis libvpx libwebp libwslay
         libsquish libxcursor libxi libxinerama libxrandr miniupnpc opusfile dotnet-sdk)
optdepends=(pipewire-alsa pipewire-pulse)
source=("$_pkgname-$pkgver.tar.gz::https://github.com/godotengine/godot/archive/$pkgver-stable.tar.gz"
        "godot"
        "godot3-mono.patch")
b2sums=('07ee037803e103f863e56a00c6106d00834870881ec75ecc43f947ea3d6e04a560763aa183661fa6437c4c8307f9231b250f2d51462057add1720d71d2ada827'
        '3929ecb0ce01d4bf67df2f6ebf4ce2c92390c585c70c4aacfe283cf9978bf034884388d00d929f16e15adf3e65b95c7484bab9e64007b79a9a6c3e30d4b1da45'
        'a5f2aeacb377ed177614c4226c5de6b8dfd68b818591d93786c5c8114c6b55d52c37d8fca5a291966ea01a2c5104ad2d242a7dbc71bc8bf5292f7f6c5107660a')

prepare() {
  # Disable the check that adds -no-pie to LINKFLAGS, for gcc != 6
  sed -i 's,0] >,0] =,g' $_pkgname-$pkgver-stable/platform/x11/detect.py

  # Make godot3-mono be installed with godot
  cd "$srcdir/$_pkgname-$pkgver-stable"
  patch -p1 < "$srcdir/godot3-mono.patch"
}

build() {
  # Not unbundled (yet):
  #  bullet (FS#72924, https://github.com/godotengine/godot/issues/55599)
  #  certs (FS#72762)
  #  enet (contains no upstreamed IPv6 support)
  #  recast, xatlas
  #  AUR: libwebm
  local to_unbundle="embree freetype libogg libpng libsquish libtheora libvorbis libvpx libwebp miniupnpc opus pcre2 wslay zlib zstd"
  local system_libs=""
  for _lib in $to_unbundle; do
    system_libs+="builtin_"$_lib"=no "
    rm -rf thirdparty/$_lib
  done

  # Build one to generate mono glue
  
  cd $_pkgname-$pkgver-stable
  export BUILD_NAME=arch_linux
  scons -j$(nproc) \
    bits=64 \
    colored=yes \
    platform=x11 \
    pulseaudio=yes \
    system_certs_path=/etc/ssl/certs/ca-certificates.crt \
    target=release_debug \
    tools=yes \
    use_llvm=no \
    module_mono_enabled=yes \
    mono_glue=no \
    CFLAGS="$CFLAGS -fPIC -Wl,-z,relro,-z,now -w" \
    CXXFLAGS="$CXXFLAGS -fPIC -Wl,-z,relro,-z,now -w" \
    LINKFLAGS="$LDFLAGS" \
    $system_libs

    # Generate godot mono glue
    cd $srcdir/$_pkgname-$pkgver-stable
    xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
    ./bin/godot.x11.opt.tools.64.mono --generate-mono-glue $srcdir/$_pkgname-$pkgver-stable/modules/mono/glue

    # Build two with mono glue
    cd $srcdir/$_pkgname-$pkgver-stable
    export BUILD_NAME=arch_linux
    scons -j$(nproc) \
      bits=64 \
      colored=yes \
      platform=x11 \
      pulseaudio=yes \
      system_certs_path=/etc/ssl/certs/ca-certificates.crt \
      target=release_debug \
      tools=yes \
      use_llvm=no \
      module_mono_enabled=yes \
      mono_glue=yes \
      CFLAGS="$CFLAGS -fPIC -Wl,-z,relro,-z,now -w" \
      CXXFLAGS="$CXXFLAGS -fPIC -Wl,-z,relro,-z,now -w" \
      LINKFLAGS="$LDFLAGS" \
      $system_libs
}

package() {
  # Make godot3-mono compataible with godot
  cd "$srcdir/$_pkgname-$pkgver-stable/misc/dist/linux"
  gzip -9 godot.6

  sed -i 's/Godot Engine/Godot Engine 3 LTS Mono/g' org.godotengine.Godot.desktop

  cd "$srcdir"/$_pkgname-$pkgver-stable
  install -Dm644 misc/dist/linux/org.godotengine.Godot.desktop \
    "$pkgdir/usr/share/applications/org.godotengine.Godot3-mono.desktop"
  install -Dm644 icon.svg "$pkgdir/usr/share/pixmaps/$pkgname.svg"
  install -Dm755 bin/godot.x11.opt.tools.64.mono "$pkgdir/opt/$pkgname/godot.x11.opt.tools.64.mono"
  install -Dm755 bin/libmonosgen-2.0.so "$pkgdir/opt/$pkgname/libmonosgen-2.0.so"
  cp -r bin/GodotSharp "$pkgdir/opt/$pkgname/GodotSharp"
  install -Dm755 "$srcdir/godot" "$pkgdir/usr/bin/$pkgname"
  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 misc/dist/linux/godot.6.gz "$pkgdir/usr/share/man/man6/$pkgname.6"
  install -Dm644 misc/dist/linux/org.godotengine.Godot.xml \
    "$pkgdir/usr/share/mime/packages/org.godotengine.Godot3-Mono.xml"
}