Compare commits

..

10 commits

Author SHA1 Message Date
f1b9162b23
upgpkg: discord 0.0.54-2: refactor, fix autostart, add deps, use wayland
* Slightly refactor PKGBUILD
* Fix autostart desktop file
* Add optional dependency used in official arch package
* Include patch to allow Krisp noise suppression support
* Add install file to inform user about this change
* Use Wayland instead of Xwayland in a Wayland session by setting
  Electron flag `ozone-platform-hint` to auto (default is X11)
2024-05-15 19:42:02 +02:00
Zoddo
2b972808d2
uppkg: discord 0.0.54 2024-05-14 00:36:32 +02:00
Zoddo
9c7aa51866
uppkg: discord 0.0.53 2024-05-06 21:00:48 +02:00
Zoddo
82a5c33606
uppkg: discord 0.0.52 2024-04-29 23:27:44 +02:00
Zoddo
4db4404dbc
uppkg: discord 0.0.51 2024-04-23 18:07:23 +02:00
Zoddo
0ef87eb9f5
uppkg: discord 0.0.50 2024-04-16 20:31:47 +02:00
Zoddo
e39dfd8905
uppkg: discord 0.0.49-2: Revert to electron29 while segfaults with electron30 are being investigated 2024-04-16 19:48:20 +02:00
Zoddo
b8192ddf65
uppkg: discord 0.0.49 2024-04-09 20:36:33 +02:00
Zoddo
2e8c14312e
uppkg: discord 0.0.48 2024-04-08 21:24:01 +02:00
Zoddo
cdaa321746
uppkg: discord 0.0.47 2024-03-25 20:23:23 +01:00
4 changed files with 113 additions and 47 deletions

View file

@ -1,24 +1,27 @@
pkgbase = discord_arch_electron
pkgdesc = Discord (popular voice + video app) using the system provided electron for increased security and performance
pkgver = 0.0.46
pkgrel = 1
pkgdesc = Discord using system provided electron (v29) for increased security and performance
pkgver = 0.0.54
pkgrel = 2
url = https://discord.com
install = discord_arch_electron.install
arch = any
license = custom
makedepends = asar
depends = electron
depends = electron29
depends = libxss
optdepends = libpulse: Pulseaudio support
optdepends = libappindicator-gtk3: Systray indicator support
optdepends = xdg-utils: Open files
optdepends = rizin: Allow patching Krisp support
provides = discord
conflicts = discord
options = !strip
source = https://dl.discordapp.net/apps/linux/0.0.46/discord-0.0.46.tar.gz
source = https://dl.discordapp.net/apps/linux/0.0.54/discord-0.0.54.tar.gz
source = discord-launcher.sh
source = LICENSE.html::https://discord.com/terms
source = OSS-LICENSES.html::https://discord.com/licenses
sha512sums = 7f88a1f5281beb5bcdb9741ae4d984ec71c09931f31c4265e15f63b5710baff0124b38421971e45e217e20d7de14e4b5ab9e0b7da6afc3eb8ff3456643f692e8
sha512sums = d398351b209cd89432d8e9cebe9122f152484236d8ca4dd91e5679d3853fe2f082625d35a9ac3f450f1f08250736bf3a23db9926311e8271730d884b57d12dbc
sha512sums = ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222
sha512sums = eb5043d09174b3e0dcb899ba5835e863ffdefe5f7e379ce4d01cfb7408a8727e7b0f58e405008f3d35c7675804fb051ee1517aa7ca20efc59610d9b93a664c35
sha512sums = SKIP
sha512sums = SKIP

View file

@ -1,60 +1,86 @@
# Maintainer: Zoddo <archlinux+aur@zoddo.fr>
# Contributor: Thaodan <AUR+me@thaodan.de>
# Contributor: Manuel Hüsers <aur@huesers.de>
# Contributor: huyizheng
# Contributor: johnnyapol <arch@johnnyapol.me>
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) <lains@archlinux.org>
_pkgname=discord
_electron=electron
_electronver=29
_electronname="electron${_electronver}"
pkgname=${_pkgname}_arch_electron
pkgver=0.0.46
pkgrel=1
pkgdesc="Discord (popular voice + video app) using the system provided electron for increased security and performance"
pkgver=0.0.54
pkgrel=2
pkgdesc="Discord using system provided electron (v${_electronver}) for increased security and performance"
arch=('any')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
url='https://discord.com'
license=('custom')
options=(!strip)
depends=("${_electron}" 'libxss')
options=('!strip')
install="$pkgname.install"
depends=("${_electronname}" 'libxss')
makedepends=('asar')
optdepends=('libpulse: Pulseaudio support'
'xdg-utils: Open files')
source=("https://dl.discordapp.net/apps/linux/$pkgver/$_pkgname-$pkgver.tar.gz"
'libappindicator-gtk3: Systray indicator support'
'xdg-utils: Open files'
'rizin: Allow patching Krisp support')
source=("https://dl.discordapp.net/apps/linux/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
'discord-launcher.sh'
'LICENSE.html::https://discord.com/terms'
'OSS-LICENSES.html::https://discord.com/licenses')
sha512sums=('7f88a1f5281beb5bcdb9741ae4d984ec71c09931f31c4265e15f63b5710baff0124b38421971e45e217e20d7de14e4b5ab9e0b7da6afc3eb8ff3456643f692e8'
'd398351b209cd89432d8e9cebe9122f152484236d8ca4dd91e5679d3853fe2f082625d35a9ac3f450f1f08250736bf3a23db9926311e8271730d884b57d12dbc'
SKIP
SKIP)
sha512sums=('ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222'
'eb5043d09174b3e0dcb899ba5835e863ffdefe5f7e379ce4d01cfb7408a8727e7b0f58e405008f3d35c7675804fb051ee1517aa7ca20efc59610d9b93a664c35'
'SKIP'
'SKIP')
_krisp_b2sum='c4e49b1a0be64cacd23474c5e474130084755f2de36af01686ce94c6eceea67426b6d6aa81889a418f9d08476476e99d63479b6131d1f7eaef987ecf4d779cf9'
prepare() {
sed -i "s|@PKGNAME@|${_pkgname}|;s|@ELECTRON@|${_electron}|" discord-launcher.sh
sed -i "s|Exec=.*|Exec=/usr/bin/$_pkgname|" Discord/discord.desktop
# prepare launcher script
sed -i -e "s|@PKGNAME@|${_pkgname}|" \
-e "s|@PKGVER@|${pkgver}|" \
-e "s|@ELECTRON@|${_electronname}|" \
-e "s|@KRISPB2@|${_krisp_b2sum}|" \
discord-launcher.sh
# HACKS FOR SYSTEM ELECTRON
asar e Discord/resources/app.asar Discord/resources/app
rm Discord/resources/app.asar
sed -i "s|process.resourcesPath|'/usr/share/${_pkgname}/resources'|" Discord/resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'/usr/share/pixmaps',|" Discord/resources/app/app_bootstrap/autoStart/linux.js
sed -i -E "s|resourcesPath = _path.+;|resourcesPath = '/usr/share/${_pkgname}/resources';|" Discord/resources/app/common/paths.js
asar p Discord/resources/app Discord/resources/app.asar
rm -rf Discord/resources/app
# fix the .desktop file
sed -i -e "s|Exec=.*|Exec=/usr/bin/${_pkgname}|" ${_pkgname^}/$_pkgname.desktop
}
build() {
cd "${srcdir}"/${_pkgname^}
# use system electron
asar e resources/app.asar resources/app
rm resources/app.asar
sed -i -e "s|resourcesPath = _path.*;|resourcesPath = '/usr/share/${_pkgname}/resources';|" resources/app/common/paths.js
sed -i -e "s|process.resourcesPath|'/usr/share/${_pkgname}/resources'|" resources/app/app_bootstrap/buildInfo.js
sed -i -e "/^const appName/d" -e "/^const exePath/d" -e "/^const exeDir/d" -e "/^const iconPath/d" \
-e "s|^Exec=\${exePath}$|Exec=/usr/bin/${_pkgname}|" \
-e "s|^Name=\${appName}$|Name=${_pkgname^}|" \
-e "s|^Icon=\${iconPath}$|Icon=/usr/share/pixmaps/${_pkgname}.png|" \
resources/app/app_bootstrap/autoStart/linux.js
asar p resources/app resources/app.asar
rm -rf resources/app
}
package() {
# Install the app
install -d "${pkgdir}/usr/share/${_pkgname}/resources"
# create necessary directories
install -d "${pkgdir}"/usr/share/$_pkgname
# Copy Relevanat data
cp -r Discord/resources/* "${pkgdir}/usr/share/${_pkgname}/resources/"
# copy relevant data
cp -r ${_pkgname^}/resources "${pkgdir}"/usr/share/$_pkgname/
install -Dm 755 "${srcdir}/discord-launcher.sh" "${pkgdir}/usr/bin/${_pkgname}"
# intall icon and desktop file
install -Dm 644 ${_pkgname^}/$_pkgname.png "${pkgdir}"/usr/share/pixmaps/$_pkgname.png
install -Dm 644 ${_pkgname^}/$_pkgname.desktop "${pkgdir}"/usr/share/applications/$_pkgname.desktop
install -Dm 644 Discord/discord.png "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
install -Dm 644 Discord/discord.desktop "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
# install the launch script
install -Dm 755 discord-launcher.sh "${pkgdir}"/usr/bin/$_pkgname
# Licenses
install -Dm 644 LICENSE.html "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.html
install -Dm 644 OSS-LICENSES.html "$pkgdir"/usr/share/licenses/$pkgname/OSS-LICENSES.html
# install licenses
install -Dm 644 LICENSE.html "${pkgdir}"/usr/share/licenses/$_pkgname/LICENSE.html
install -Dm 644 OSS-LICENSES.html "${pkgdir}"/usr/share/licenses/$_pkgname/OSS-LICENSES.html
}

View file

@ -1,21 +1,39 @@
#!/usr/bin/bash
#!/usr/bin/env bash
set -euo pipefail
name=@PKGNAME@
ver=@PKGVER@
electron=@ELECTRON@
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
krisp_b2=@KRISPB2@
declare -a flags
declare PATCH_KRISP
if [[ -f "${flags_file}" ]]; then
mapfile -t < "${flags_file}"
[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/${name}.conf" ]] && source "${XDG_CONFIG_HOME:-$HOME/.config}/${name}.conf"
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
krisp_bin="${DISCORD_USER_DATA_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/${name}}/${ver}/modules/${name}_krisp/${name}_krisp.node"
if hash rizin &> /dev/null && [[ "${PATCH_KRISP}" == true ]]; then
# Patch Krisp binary to ignore signature check
if [[ -w "${krisp_bin}" && $(b2sum "${krisp_bin}" | head -c 128) == $krisp_b2 ]]; then
addr=$(rz-find -x '4881ec00010000' "${krisp_bin}" | head -n1)
rizin -q -w -c "s $addr + 0x30 ; wao nop" "${krisp_bin}" &> /dev/null
fi
fi
if [[ -r "${flags_file}" ]]; then
mapfile -t < "${flags_file}"
fi
for line in "${MAPFILE[@]}"; do
if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
flags+=("${line}")
fi
if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
flags+=("${line}")
fi
done
exec /usr/bin/${electron} /usr/share/${name}/resources/app.asar "${flags[@]}" "$@"
exec /usr/bin/${electron} \
/usr/share/${name}/resources/app.asar \
--ozone-platform-hint=auto \
"${flags[@]}" "$@"

View file

@ -0,0 +1,19 @@
post_upgrade() {
# return if old package version is greater than or equal to 0.0.54-2...
(( $(vercmp $2 '0.0.54-2') >= 0 )) && return
cat <<EOF
==> In order to patch Krisp noise suppression support set 'PATCH_KRISP=true'
in '~/.config/discord.conf' in addition to having 'rizin' installed.
EOF
}
post_install() {
cat <<EOF
==> For Krisp noise suppression support consider installing 'rizin' and
setting 'PATCH_KRISP=true' in '~/.config/discord.conf'. Restart your
Discord client afterwards to apply the patch.
==> In case of performance problems consider setting additional flags
in '~/.config/discord-flags.conf'.
EOF
}