summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 17224412591dbc66e95b3e41be96c99e6aa57996 (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
# Maintainer: Oscar Morante <spacepluk at gmail dot com>

_version=2018.1.0
_build=b8
_buildtag=20180221
_randomstring=ee2fb9f9da52
_prefix=/opt/UnityBeta
_unitydownloads="http://beta.unity3d.com/download/${_randomstring}"
#_keepdownloads=yes

pkgname=unity-editor-beta
pkgver=${_version}${_build}+${_buildtag}
pkgrel=1
pkgdesc="The world's most popular development platform for creating 2D and 3D multiplatform games and interactive experiences."
arch=('x86_64')
url='https://unity3d.com/'
license=('custom')
depends=('desktop-file-utils'
         'xdg-utils'
         'gcc-libs'
         'lib32-gcc-libs'
         'gconf'
         'libgl'
         'glu'
         'nss'
         'libpng12'
         'libxtst'
         'libpqxx'
         'npm')
optdepends=('unity-editor-beta-doc'
            'unity-editor-beta-standardassets'
            'unity-editor-beta-example'
            'unity-editor-beta-android'
            'unity-editor-beta-ios'
            'unity-editor-beta-mac'
            'unity-editor-beta-tizen'
            'unity-editor-beta-webgl'
            'unity-editor-beta-windows'
            'unity-editor-beta-facebook')
makedepends=('gtk2' 'libsoup' 'libarchive')
source=("${_unitydownloads}/UnitySetup-${_version}${_build}"
        'unity-editor-beta'
        'unity-editor-beta.desktop'
        'unity-editor-beta-icon.png')
sha1sums=('1322e5922b3a5b37910b30e308740cc453211ebd'
          'd61175685d0836a79b2d4582c09ea23ed5ee18e9'
          'c348f141232ec06c6558fd42b5cbf86a75e2d02d'
          'fddf4861974f88f0565de7f54f7418204e729894')
options=(!strip)
PKGEXT='.pkg.tar' # Prevent compressing of the final package

unity-setup() {
  ./UnitySetup-${_version}${_build} \
    --download-location="${startdir}" \
    --install-location="${pkgdir}${_prefix}" \
    --unattended $@
}

extract-component() {
  msg2 "Extracting $1..."
  yes | unity-setup --components=$1 > "/tmp/$1.log"
}

prepare() {
  chmod +x "${srcdir}/UnitySetup-${_version}${_build}"
}

package() {
  msg2 "Extracting EULA..."
  echo n | unity-setup | head -n -2 > "${srcdir}/EULA"

  mkdir -p "${pkgdir}${_prefix}"
  extract-component Unity

  if [ -z "${_keepdownloads}" ]; then
    rm "${startdir}/Unity.tar.xz"
  fi

  # HACK: fixes WebGL builds by adding a symlink (python -> python2) to the PATH
  ln -s /usr/bin/python2 "${pkgdir}${_prefix}/Editor/python"

  # Fix permissions
  find "${pkgdir}${_prefix}/Editor/Data" -type d -exec chmod ga+rx {} \;

  # Add version to desktop file
  sed -i "/^Version=/c\Version=${_version}${_build}" "${srcdir}/unity-editor-beta.desktop"

  install -Dm644 -t "${pkgdir}/usr/share/applications" "${srcdir}/unity-editor-beta.desktop"
  install -Dm644 -t "${pkgdir}/usr/share/icons/hicolor/256x256/apps" "${srcdir}/unity-editor-beta-icon.png"
  install -Dm755 -t "${pkgdir}/usr/bin" "${srcdir}/unity-editor-beta"
  install -Dm644 "${srcdir}/EULA" "${pkgdir}/usr/share/licenses/${pkgname}/EULA"
}