* 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)
86 lines
3.4 KiB
Bash
86 lines
3.4 KiB
Bash
# 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
|
|
_electronver=29
|
|
_electronname="electron${_electronver}"
|
|
pkgname=${_pkgname}_arch_electron
|
|
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')
|
|
install="$pkgname.install"
|
|
depends=("${_electronname}" 'libxss')
|
|
makedepends=('asar')
|
|
optdepends=('libpulse: Pulseaudio support'
|
|
'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=('ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222'
|
|
'eb5043d09174b3e0dcb899ba5835e863ffdefe5f7e379ce4d01cfb7408a8727e7b0f58e405008f3d35c7675804fb051ee1517aa7ca20efc59610d9b93a664c35'
|
|
'SKIP'
|
|
'SKIP')
|
|
|
|
_krisp_b2sum='c4e49b1a0be64cacd23474c5e474130084755f2de36af01686ce94c6eceea67426b6d6aa81889a418f9d08476476e99d63479b6131d1f7eaef987ecf4d779cf9'
|
|
|
|
prepare() {
|
|
# 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
|
|
|
|
# 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() {
|
|
# create necessary directories
|
|
install -d "${pkgdir}"/usr/share/$_pkgname
|
|
|
|
# copy relevant data
|
|
cp -r ${_pkgname^}/resources "${pkgdir}"/usr/share/$_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 the launch script
|
|
install -Dm 755 discord-launcher.sh "${pkgdir}"/usr/bin/$_pkgname
|
|
|
|
# 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
|
|
}
|