summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 02ae7d6b412a29fbb170fa9dc7bce7ad67888998 (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
# Maintainer: Yves G. <theYinYeti@yalis.fr>

pkgname=ysflight
pkgver=20181124
pkgrel=1
pkgdesc="A portable flight simulator"
arch=('x86_64')
url="http://wwwe.ysflight.com/"
license=('freeware')
makedepends=(python)
ysflight_dir="/opt/ysflight-$pkgver"

source=('YsflightForLinux.zip::https://forum.ysfhq.com/download/file.php?id=499'
        'ysflight.sh')
md5sums=('26a8f7bcc79eb710895547f052a09fef'
         '540ca8dec29fec23c67f830c6cce5d5c')

prepare() {
  cd "${srcdir}"
  sed -i "s#YSFLIGHT_DIR#${ysflight_dir}#g" ysflight.sh
  cd "${srcdir}/Ysflight"
  sed -ri "
    s#^([[:blank:]]*)input\\(.*#\\1pass#

    s#join\\(\"~\",\"Desktop\"#join(\"${pkgdir}/usr/share/applications\"#
    s#Exec=\"\\+exe#Exec=/usr/bin/\"+os.path.basename(exe)#
    s#isfile\\(iconfile\\)#isfile(\"${pkgdir}\"+iconfile)#
    /Path=/d

    s#YSFLIGHTPATH=.*#YSFLIGHTPATH=\"${ysflight_dir}\"#
    s#to ~/YSFLIGHT.COM/ysflight#to ${ysflight_dir}#
    s#(isdir|rmtree)\\(YSFLIGHTPATH\\)#\\1(\"${pkgdir}\"+YSFLIGHTPATH)#
    s#(copytree\\(FindYsflight.*,)YSFLIGHTPATH#\1\"${pkgdir}\"+YSFLIGHTPATH#
    s#(FileCheck\\()YSFLIGHT#\1\"${pkgdir}\"+YSFLIGHT#
  " InstallInLinux.py
}

package() {
  echo '
[WARNING!]
[WARNING!] This installer does its best to enforce
[WARNING!] Linux’ standard file locations. Unfortunately,
[WARNING!]   “ $HOME/Documents/YSFLIGHT.COM ”
[WARNING!] is hard-coded into the binary programs…
[WARNING!]
'

  cd "${pkgdir}"
  mkdir -p usr/bin usr/share/applications opt

  cd "${srcdir}/Ysflight"
  python InstallInLinux.py

  cd "${pkgdir}"
  find "${ysflight_dir#/}" -type d -exec chmod 755 {} \;
  find "${ysflight_dir#/}" ! -type d -exec chmod 444 {} \;
  chmod 555 "${ysflight_dir#/}"/ysflight64_*
  install -Dm555 "${srcdir}/ysflight.sh" usr/bin/ysflight
  touch usr/bin/ysflight
  ln -s ysflight usr/bin/ysflight64_gl1
  ln -s ysflight usr/bin/ysflight64_gl2
  ln -s ysflight usr/bin/ysflight64_nownd
}