summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 17467d232c3148fa6261f0e1e8a5a2ad65cac85e (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Maintainer:
# Contributor: samsapti <sam at sapti dot me>
# Contributor: lsf
# Contributer: Sam Whited <sam@samwhited.com>

## links
# https://jitsi.org/jitsi-meet/
# https://github.com/jitsi/jitsi-meet-electron

## options
: ${_install_path:=usr/share}

: ${_electron_dist:=/usr/lib/electron}

: ${_cksum:=b74ba8d0a816ea8bf50f2fb6bac4bcbf0295b84e9749c912e40b1fcb16c89c33}

_pkgname="jitsi-meet-desktop"
pkgname="$_pkgname"
pkgver=2025.1.1
pkgrel=1
pkgdesc="Jitsi Meet desktop application"
url="https://github.com/jitsi/jitsi-meet-electron"
license=('Apache-2.0')
arch=('any')

depends=(
  'electron'
)
makedepends=(
  'npm'
)

_pkgsrc="jitsi-meet-electron-$pkgver"
_pkgext="tar.gz"
source=(
  "$_pkgname-$pkgver.$_pkgext"::"$url/archive/v$pkgver.$_pkgext"
  'no_targets.patch'
)
sha256sums=(
  "${_cksum:?}"
  'ed3a4d4c524611ba66c9f0e28d2da77cb2948c6785367d69b86aa4965dd6bb99'
)

prepare() (
  cd "$_pkgsrc"
  local src
  for src in "${source[@]}"; do
    src="${src%%::*}"
    src="${src##*/}"
    src="${src%.zst}"
    if [[ $src == *.patch ]]; then
      printf '\nApplying patch: %s\n' "$src"
      patch -Np1 -F100 -i "${srcdir:?}/$src"
      echo
    fi
  done

  local _electron_version="$(cat $_electron_dist/version)"

  sed -E -e 's#("electron"): "[^"]+",#\1: "'${_electron_version}'",#' \
    -e 's#git+ssh://git@github.com#git+https://github.com#g' \
    -i package-lock.json
)

build() (
  export HOME="$srcdir/tmp_home"
  export XDG_CACHE_HOME="$srcdir/tmp_cache"
  export XDG_CONFIG_HOME="$srcdir/tmp_config"
  export XDG_DATA_HOME="$srcdir/tmp_data"
  export XDG_STATE_HOME="$srcdir/tmp_state"

  export npm_config_cache="$srcdir/npm_cache"
  export NODE_ENV=production

  cd "$_pkgsrc"
  NODE_ENV=development npm install --no-audit --no-fund

  npm exec -c 'webpack --config ./webpack.main.js'
  npm exec -c 'webpack --config ./webpack.renderer.js'
  npm exec -c "electron-builder --linux --dir -c.electronDist=$_electron_dist -c.electronVersion=$(cat $_electron_dist/version)"
)

package() (
  install -Dm644 "$_pkgsrc/dist/linux-unpacked/resources/app.asar" -t "$pkgdir/$_install_path/$_pkgname/"
  install -Dm644 "$_pkgsrc/resources/icon.png" "$pkgdir/usr/share/pixmaps/$_pkgname.png"

  install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/$_pkgname.desktop" << END
[Desktop Entry]
Type=Application
Name=Jitsi Meet
Comment=Jitsi Meet Desktop App
Exec=$_pkgname %U
Icon=$_pkgname
Terminal=false
MimeType=x-scheme-handler/jitsi-meet;
StartupWMClass=Jitsi Meet
Categories=VideoConference;AudioVideo;Audio;Video;Network;
END

  install -Dm755 /dev/stdin "$pkgdir/usr/bin/$_pkgname" << END
#!/usr/bin/env bash

name=$_pkgname
flags_file="\${XDG_CONFIG_HOME:-\$HOME/.config}/\${name}-flags.conf"

lines=()
if [[ -f "\${flags_file}" ]]; then
  mapfile -t lines < "\${flags_file}"
fi

flags=()
for line in "\${lines[@]}"; do
  if [[ ! "\${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "\${line}" ]]; then
    flags+=("\${line}")
  fi
done

: \${ELECTRON_IS_DEV:=0}
export ELECTRON_IS_DEV
: \${ELECTRON_FORCE_IS_PACKAGED:=true}
export ELECTRON_FORCE_IS_PACKAGED

exec electron "/$_install_path/\${name}/app.asar" "\${flags[@]}" "\$@"
END
)