summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a53636565f4d42958c9cf0c08ab12c49859980e0 (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
# Maintainer: Mike Swanson <mikeonthecomputer@gmail.com>
# Old Maintainer: Ezekiel Sulastin <zekesulastin@gmail.com>

# Warning: this package is BIG - 1.3 GiB for the GOG installer,
#   2 GiB for the actual unpacked game data, and 2 GiB for
#   the finished package if uncompressed.  mv is used over cp
#   in the package phase to save a bit of space, but make sure
#   there is enough room for everything.

# This package preferentially uses GOG's installer, using the
#   build function to extract the data.  Please ensure the
#   file is available in the build directory via copy or
#   symlink, i.e. ~/aur/fs2_open-data/setup_freespace_2.exe.
#	If using a copy of the retail CD, follow the instructions
#   from the website below to extract the data. Once extracted, place
#   the data directly in the $builddir/src directory, i.e.
#	~/aur/fs2_open-data/src/.
#   http://www.hard-light.net/wiki/index.php/Fs2_open_on_Linux/Acquiring_the_Game_Data

# TODO: acquire copy of CDs to test, refine, and include CD installer
# script in pkgbuild

pkgname=fs2_open-data
pkgver=1.20
pkgrel=3
pkgdesc="Freespace 2 retail data for fs2_open"
arch=('any')
url="http://www.gog.com/en/gamecard/freespace_2"
license=('custom:freespace2')
makedepends=('innoextract' 'recode')

# This package is about 2 GiB uncompressed and takes
#	a while to recompress for not too much space savings;
#	the following PKGEXT disables compression of the
#	package.  Add .xz or similar to the end of PKGEXT
#	to compress the package.
PKGEXT=".pkg.tar"

prepare() {
  # Could possibly support older versions of the GOG installer too,
  # but it's worth it to have the latest version.
  local _gog_md5="06341f1ccd8f70a1e02cc236712e7726"
  local _gog_exe="setup_freespace_2.exe"
  if [[ -f ../$_gog_exe ]]; then
    echo "GOG installer detected; checking md5sum ..."
    if ! echo "$_gog_md5 ../$_gog_exe" | md5sum -c --status; then
      error "Invalid md5sum; verify your download and try again."
      return 1
    else
      ln -s ../$_gog_exe .
      innoextract $_gog_exe
    fi
  elif [[ -f readme.txt ]]; then
    echo "Retail CD files detected."
  else
    error "You must have either $_gog_exe or the extracted files\
 from the retail CD present (.exe in main dir or CD files in src)."
    error "Either download the game from your GOG shelf or extract the files\
 from the retail CD and try again."
    return 1
  fi
}

package() {
  cd "$srcdir"

  if [[ -r readme.txt ]]; then sed -n 416,471p readme.txt > LICENSE;
  else head -n 19 < tmp/gog_EULA.txt | recode windows-1252/CRLF..utf8 > LICENSE;
    license=('custom:goodoldgames');
  fi

  install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  # This whole thing goes in /opt/fs2_open as a lot of upstream stuff
  #   expects binaries and data to be together like in Windows
  mkdir -p "$pkgdir/opt/fs2_open"

  if [[ -r readme.txt ]]; then
    mv ./* "$pkgdir/opt/fs2_open"
  else
    # The GOG installer places cutscenes and data copies in folders
    #   corresponding with the original CDs; we need to move the
    #   cutscenes and delete the redundant data and folders.
    mkdir app/data/movies
    mv app/data{2,3}/*.MVE app/data/movies/
    rm -rf app/data{2,3}
    mv app/* "$pkgdir/opt/fs2_open"
  fi
}