summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 555cb4061c008f31908585074e366171035d975b (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
# Maintainer: Marius Glo <marius@mgl.dev>
# Contributor: Oscar Morante <oscar@mooistudios.com>

pkgname=unityhub
pkgver=2.4.3
pkgrel=3
pkgdesc="The Unity Hub is a standalone application that streamlines the way you find, download, and manage your Unity Projects and installations."
url="https://unity.com/"
arch=('x86_64')
license=('custom')
depends=('gtk2' 'nss' 'p7zip' 'gconf' 'cpio' 'zip' 'libxss' 'libxtst')
source=("${pkgname}-${pkgver}.AppImage::https://public-cdn.cloud.unity3d.com/hub/prod/UnityHub.AppImage")
PKGEXT='.pkg.tar'
sha256sums=('SKIP')

build() {
  # Extract AppImage
  chmod +x "${pkgname}-${pkgver}.AppImage"
  "./${pkgname}-${pkgver}.AppImage" --appimage-extract

  # Patch desktop file
  _df="${srcdir}/squashfs-root/unityhub.desktop"
  sed -i "/^Exec=/cExec=unityhub" "${_df}"
  sed -i "s/^X-AppImage-Version=/Version=/" "${_df}"
  sed -i "/^X-AppImage/d" "${_df}"
  sed -i 's:# !/usr/bin/env:#!/usr/bin/env:' "${srcdir}/squashfs-root/unityhub"
}

package() {
  # Install
  _df="${srcdir}/squashfs-root/unityhub.desktop"
  install -d "${pkgdir}/usr/share"
  install -D ${_df} "${pkgdir}/usr/share/applications/unityhub.desktop"
  install -D "${srcdir}/squashfs-root/usr/share/icons/hicolor/48x48/apps/unityhub.png" \
             "${pkgdir}/usr/share/pixmaps/unityhub.png"

  install -d "${pkgdir}/usr/share/licenses/${pkgname}"
  cp --no-preserve=all \
    "${srcdir}"/squashfs-root/LICENSE* \
    "${pkgdir}/usr/share/licenses/${pkgname}"

  rm -r "${srcdir}/squashfs-root/AppRun" \
        "${srcdir}/squashfs-root/unityhub.desktop" \
        "${srcdir}/squashfs-root/usr/share" \
        "${srcdir}"/squashfs-root/LICENSE*

  install -d "${pkgdir}/opt/${pkgname}"
  sed -i 's/^SCRIPT_DIR.*$/SCRIPT_DIR=\/opt\/unityhub/g' ${srcdir}/squashfs-root/unityhub
  cp -r --no-preserve=all ${srcdir}/squashfs-root/* ${pkgdir}/opt/${pkgname}

  install -d "${pkgdir}/usr/bin"
  ln -s "/opt/${pkgname}/unityhub" "${pkgdir}/usr/bin/unityhub"
  chmod +x "${pkgdir}/opt/${pkgname}/unityhub" "${pkgdir}/opt/${pkgname}/unityhub-bin"
  # Fix 7z permissions
  chmod +x "${pkgdir}/opt/${pkgname}/resources" \
           "${pkgdir}/opt/${pkgname}/resources/app.asar.unpacked" \
           "${pkgdir}/opt/${pkgname}/resources/app.asar.unpacked/lib/linux" \
           "${pkgdir}/opt/${pkgname}/resources/app.asar.unpacked/lib/linux/7z" \
           "${pkgdir}/opt/${pkgname}/resources/app.asar.unpacked/lib/linux/7z/linux64" \
           "${pkgdir}/opt/${pkgname}/resources/app.asar.unpacked/lib/linux/7z/linux64/7z"
}