summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0cfb8a98a542a4c3bf8554031e45ce91c3cac8f5 (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
# Maintainer: ml <ml@visu.li>
# Contributor: Jean Lucas <jean@4ray.co>

# TODO cleanup asar, drop as much as possible, remove local references
pkgname=whalebird-desktop
pkgver=4.1.1
pkgrel=1
pkgdesc='Electron-based Mastodon/Pleroma client'
arch=('any')
url='https://whalebird.org'
license=('MIT')
depends=('electron')
makedepends=('git' 'npm')
provides=('whalebird')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/h3poteto/${pkgname}/archive/${pkgver}.tar.gz"
  whalebird.desktop
  whalebird.sh)
sha256sums=('d97ece17bf24f5139017a1fcfb29978968b69a845979c5c6e13118a16fee0df1'
            '8feed931453da872291c4588c981007ed36566155cfcf55ab3ff5d7431d60aef'
            'a0a050952353c78389bdafd8885cae4a402d0819acad07010566657e387c5ce9')

_npmopt=(--no-audit --no-progress --no-fund)
prepare() {
  cd "${pkgname}-${pkgver}"
  #npm "${_npmopt[@]}" --ignore-scripts uninstall electron{,-debug,-devtools-installer} listr cross-env \
  #  cfonts chalk webpack-dev-server stylelint{,-config-standard} ttfinfo prettier-stylelint

  # node-sass 4.14.1 for Node 14 support
  npm "${_npmopt[@]}" --ignore-scripts install electron@"$(</usr/lib/electron/version)" node-sass@4.14.1

  # run install script for node-sass only
  node node_modules/node-sass/scripts/install.js
}

build() {
  cd "${pkgname}-${pkgver}"
  export NODE_ENV=production

  # the same as calling `node .electron-vue/build.js` but doesn't try to display fancy text
  for c in webpack.{main,renderer}.config.js; do
    npx --no-install webpack --mode production --config=.electron-vue/"$c"
  done

  # make cachefiles writable for makepkg -c to work
  chmod -R u+w node_modules/.cache

  npx electron-builder --linux --dir \
    -c.electronDist=/usr/lib/electron \
    -c.electronVersion="$(</usr/lib/electron/version)"
}

package() {
  install -Dm755 whalebird.sh "${pkgdir}/usr/bin/whalebird"
  install -Dm644 -t "${pkgdir}/usr/share/applications" whalebird.desktop

  cd "${pkgname}-${pkgver}"
  install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE.txt

  cd build
  cp -r linux-unpacked/resources "${pkgdir}/usr/share/${pkgname}"

  cd icons/icon.iconset
  for i in 16 32 128 256 512; do
    install -Dm644 "icon_${i}x${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/apps/whalebird.png"
  done
}