summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9171032402f39e789e6d5b550f57a6ac63bf0393 (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
# Maintainer: txtsd <aur.archlinux@ihavea.quest>
# Maintainer: Atakku <atakkudev@gmail.com>

pkgname=blockbench-git
_pkgname="${pkgname%-git}"
pkgver=4.11.2.r1.g0dc5a949
pkgrel=2
pkgdesc='A low-poly 3D model editor (git version)'
arch=(x86_64 aarch64)
url='https://github.com/JannisX11/blockbench'
license=('GPL-3.0-or-later')
_electron=electron
depends=(
  "${_electron}"
  bash
  giblib
  glibc
  imlib2
  libx11
)
makedepends=(git npm)
provides=("${_pkgname}")
conflicts=("${_pkgname}")
options=(!debug)
source=("${_pkgname}::git+https://github.com/JannisX11/blockbench.git"
        "${_pkgname}.desktop")
sha256sums=('SKIP'
            '5a64727fcf696b3497190d441556322b4d0ffb70f560ba8eba6ef79ac5c36e8c')

pkgver() {
  cd "${_pkgname}"

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

prepare() {
  cd "${_pkgname}"

  npm install
}

build() {
  cd "${_pkgname}"

  _electronDist=/usr/lib/${_electron}
  _electronVersion=$(cat ${_electronDist}/version)

  npm run dist -- --linux --x64 --dir -c.electronDist=${_electronDist} -c.electronVersion="${_electronVersion}"
}

package() {
  _electronDist=/usr/lib/${_electron}
  _electronVersion=$(cat ${_electronDist}/version)
  _electronVersionMajor=${_electronVersion%%.*}
  _electronDir=${_electronDist}${_electronVersionMajor}

  install -d "${pkgdir}/usr/"{bin,share/{pixmaps,applications}}
  install -d "${pkgdir}/${_electronDist}${_electronVersionMajor}/resources"

  echo -e "#!/bin/bash\nexec ${_electron} ${_electronDist}${_electronVersionMajor}/resources/${_pkgname}.asar \"\$@\"" > "${pkgdir}/usr/bin/${_pkgname}"
  chmod 755 "${pkgdir}/usr/bin/${_pkgname}"

  install "${_pkgname}/icon.png" "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
  install "${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
  install "${_pkgname}/dist/linux-unpacked/resources/app.asar" "${pkgdir}${_electronDist}${_electronVersionMajor}/resources/${_pkgname}.asar"

  cp -r "${_pkgname}/dist/linux-unpacked/resources/app.asar.unpacked" "${pkgdir}${_electronDist}${_electronVersionMajor}/resources/${_pkgname}.asar.unpacked"
}