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

pkgname=serioussam-alpha
pkginstdir=serioussam
ssa=SeriousSamAlphaRemake_v1.5.tar.xz
pkgver=1.5.3
_srcname="SeriousSamAlphaRemake-$pkgver"
pkgrel=1
pkgdesc="Serious Sam Classic Alpha Reamake native Linux."
arch=('i686' 'x86_64')
url="https://github.com/tx00100xt/SeriousSamAlphaRemake"
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/SeriousSamAlphaRemake/archive/refs/tags/v$pkgver.tar.gz"
    "https://github.com/tx00100xt/serioussam-mods/raw/main/SamTFE-SSA/SeriousSamAlphaRemake_v1.5.tar.xz.partaa"
	"https://github.com/tx00100xt/serioussam-mods/raw/main/SamTFE-SSA/SeriousSamAlphaRemake_v1.5.tar.xz.partab"
	"https://github.com/tx00100xt/serioussam-mods/raw/main/SamTFE-SSA/SeriousSamAlphaRemake_v1.5.tar.xz.partac"
	"https://github.com/tx00100xt/serioussam-mods/raw/main/SamTFE-SSA/SeriousSamAlphaRemake_v1.5.tar.xz.partad")
noextract=("SeriousSamAlphaRemake_v1.5.tar.xz.partaa"
	"SeriousSamAlphaRemake_v1.5.tar.xz.partab"
	"SeriousSamAlphaRemake_v1.5.tar.xz.partac"
	"SeriousSamAlphaRemake_v1.5.tar.xz.partad")
sha256sums=('c8f23cba992bfea160a47d1542fe6814bc305e31083b2c28a9157d145b63eba9'
	"d5eef988652bf0f157f58c4faf92911b1c71a948229a035e7a237f973b39db5b"
	"c412a76659b87892d4bb879d53f774ba72b1e6905901a1e042a72821a6a412c1"
	"331a0d2fd0cc6dce4a3eda3c2a898043ca4bc55fa8ab7fc2094f7f1f1df8853e"
	"0e3749e6c0492a3cdd5ff3f9f55e6141fb415090c32922d7073f6c5eb265d479")

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

prepare(){
  # Prepare Alpha Reamake archive
  cat "$ssa".part* > "$ssa"

  # Install the SSA Modification data.
  mkdir "$srcdir/$_srcname"/{SamTFE,SamTFE/Mods,SamTFE/Mods/SSA} || return 0
  tar -xJvf "$srcdir/$ssa" -C "$srcdir/$_srcname/SamTFE/"
  rm -f "$srcdir/$_srcname/SamTFE/Mods/SSA/Bin/libGame.so" || return 0
  rm -f "$srcdir/$_srcname/SamTFE/Mods/SSA/Bin/libEntities.so" || return 0
  rm -f "$srcdir/$_srcname/SamTFE/Mods/SSA/Data/Translations/engine.txt" || return 0
  chmod -R o=rx "$srcdir/$_srcname/SamTFE/Mods/SSA"
  chmod -R g=rx "$srcdir/$_srcname/SamTFE/Mods/SSA"

  # Making building scripts.
  cd "$srcdir/$_srcname/Sources/"
  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 Alpha Reamake.
  cd "$srcdir/$_srcname/Sources/"
  ./build-linux"$_bits"-tfe.sh

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

  # Building Serious Sam Alpha Reamake 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/SSA}
  install -d $pkgdir/usr/share/{serioussam,serioussam/Mods}

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

  rm -fr "$srcdir/$_srcname/SamTFE/Mods/SSA/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/$_srcname/SamTFE/Mods" "$pkgdir/usr/share/$pkginstdir/"
}