summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dfad1d400f3c1c9c83cd3e2ca4d9e568892451c2 (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
# Maintainer:  Alexander <tx00100xt@yandex.ru>
# Contributer: Alexander <tx00100xt@yandex.ru>

pkgname=serioussam-tower
pkginstdir=serioussam
tower=SamTFE-Tower.tar.xz
pkgver=1.0.2
_srcname="SE1-TFE-Tower-$pkgver"
pkgrel=1
pkgdesc="Serious Sam Classic Nightmare Tower native Linux."
arch=('i686' 'x86_64')
url="https://github.com/tx00100xt/SE1-TFE-Tower"
license=('GPL2')

if pacman -Qq serioussam >/dev/null 2>&1; then
  depends=('sdl2' 'python' 'bash' 'serioussam')
elif pacman -Qq serioussam-vk >/dev/null 2>&1; then
  depends=('sdl2' 'python' 'bash' 'serioussam-vk')
else
  echo "This package requires either "serioussam" or "serioussam-vk", but neither is installed."
  echo "Compilation aborted."
  return 1
fi

makedepends=('cmake' 'make' 'sed')
source=("https://github.com/tx00100xt/SE1-TFE-Tower/archive/refs/tags/v$pkgver.tar.gz"
    "https://github.com/tx00100xt/serioussam-mods/raw/main/SamTFE-Tower/SamTFE-Tower.tar.xz")
sha256sums=('be443f50e34798eb5a34df873631746bd7ec62ca7bd49adb4258f4173411dbbd'
	"c665f8dd419c3147c4024f0ac2b7d678c1aed735189f6f8355409398e4eb76df")

if [[ $CARCH = "i686" ]]; then
  _bits="32"
else
  _bits="64"
fi

prepare(){
  # Install the Tower Modification data.
  rm -f "$srcdir/Mods/Tower/Bin/libGame.so" || return 1
  rm -f "$srcdir/Mods/Tower/Bin/libEntities.so" || return 1
  chmod -R o=rx "$srcdir/Mods/Tower"
  chmod -R g=rx "$srcdir/Mods/Tower"

  # Making building scripts.
  cd "$srcdir/$_srcname/Sources/"
  ls -l > ls.txt
  sed -i 's/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo/cmake -DCMAKE_BUILD_TYPE=Release/g' build-linux"$_bits".sh
  sed 's/cmake -DCMAKE_BUILD_TYPE=Release/cmake -DTFE=TRUE -DCMAKE_BUILD_TYPE=Release/g' build-linux"$_bits".sh > build-linux"$_bits"-tfe.sh

  chmod 755 build-linux"$_bits"-tfe.sh
}

build(){
  # Building Serious Sam Nightmare Tower.
  cd "$srcdir/$_srcname/Sources/"
  ./build-linux"$_bits"-tfe.sh

  mv "$srcdir/$_srcname/Sources/cmake-build/Debug/libGame.so" "$srcdir/Mods/Tower/Bin" || return 1
  mv "$srcdir/$_srcname/Sources/cmake-build/Debug/libEntities.so"  "$srcdir/Mods/Tower/Bin" || return 1

  # Removed Serious Nightmare Tower tmp stuff.
  cd "$srcdir/$_srcname/"
  rm -fr "Sources"
  rm -fr "Tools.Win32"

  rm -f  "$srcdir/$_srcname"/{*.sh,*.old,*.md}
  rm -fr "$srcdir/$_srcname"/{Images,x32,x64}
}

package(){
  # Making sure directories exist.
  install -d $pkgdir/usr/lib/{serioussam,serioussam/Mods,serioussam/Mods/Tower}
  install -d $pkgdir/usr/share/{serioussam,serioussam/Mods}

  install -D -m0755 $srcdir/Mods/Tower/Bin/libGame.so $pkgdir/usr/lib/serioussam/Mods/Tower
  install -D -m0755 $srcdir/Mods/Tower/Bin/libEntities.so  $pkgdir/usr/lib/serioussam/Mods/Tower

  rm -fr "$srcdir/Mods/Tower/Bin"

  # Making sure directories exist.
  install -d $pkgdir/usr/share/licenses

  # Install license.
  install -D -m 644 $srcdir/$_srcname/LICENSE \
       $pkgdir/usr/share/licenses/$pkgname/LICENSE
  rm -f  "$srcdir/$_srcname/LICENSE" || return 1

  # Install data.
  mv "$srcdir/Mods" "$pkgdir/usr/share/$pkginstdir/"
}