Rebase package on discord-electron
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
0b7eeace63
commit
536954dbcc
1 changed files with 84 additions and 29 deletions
113
PKGBUILD
113
PKGBUILD
|
@ -1,49 +1,104 @@
|
||||||
# Maintainer: Knut Ahlers <knut at ahlers dot me>
|
# Maintainer: Knut Ahlers <knut at ahlers dot me>
|
||||||
|
# Contributor: Manuel Hüsers <aur@huesers.de>
|
||||||
|
# Contributor: Stick <stick@stma.is>
|
||||||
|
# Contributor: johnnyapol <arch@johnnyapol.me>
|
||||||
|
# Contributor: huyizheng <huyizheng@hotmail.com>
|
||||||
# Contributor: Filipe Laíns (FFY00) <lains@archlinux.org>
|
# Contributor: Filipe Laíns (FFY00) <lains@archlinux.org>
|
||||||
|
# Contributor: Morgan <morganamilo@archlinux.org>
|
||||||
|
|
||||||
|
# Based off the discord_arch_electron_wayland PKGBUILD from Stick
|
||||||
|
# Based off the discord_arch_electron PKGBUILD from johnnyapol and huyizheng
|
||||||
|
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00)
|
||||||
|
|
||||||
pkgname=discord
|
pkgname=discord
|
||||||
_pkgname=Discord
|
_pkgname=discord
|
||||||
|
_electron=22
|
||||||
pkgver=0.0.26
|
pkgver=0.0.26
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="All-in-one voice and text chat for gamers that's free and secure."
|
pkgdesc="Discord using system provided electron (v${_electron}) for increased security and performance"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
url='https://discordapp.com'
|
provides=("${_pkgname}")
|
||||||
|
conflicts=("${_pkgname}")
|
||||||
|
url='https://discord.com'
|
||||||
license=('custom')
|
license=('custom')
|
||||||
depends=('libnotify' 'libxss' 'nspr' 'nss' 'gtk3')
|
options=('!strip')
|
||||||
optdepends=('libpulse: Pulseaudio support'
|
depends=("electron${_electron}" 'libnotify' 'libxss' 'nspr' 'nss' 'gtk3')
|
||||||
'xdg-utils: Open files')
|
makedepends=('asar' 'curl' 'python-html2text')
|
||||||
source=("https://dl.discordapp.net/apps/linux/$pkgver/$pkgname-$pkgver.tar.gz"
|
optdepends=(
|
||||||
'LICENSE.html::https://discordapp.com/terms'
|
'libpulse: Pulseaudio support'
|
||||||
'OSS-LICENSES.html::https://discordapp.com/licenses')
|
'xdg-utils: Open files'
|
||||||
sha512sums=('65477c2c033f30850a699706a6502ff4f4af8838185716d968d641fdab3033555139b04bf91a111a847aca14113e33ba6248d49ba317fd43cbacb099e974117b'
|
)
|
||||||
'SKIP'
|
source=("https://dl.discordapp.net/apps/linux/${pkgver}/discord-${pkgver}.tar.gz")
|
||||||
'SKIP')
|
sha512sums=('65477c2c033f30850a699706a6502ff4f4af8838185716d968d641fdab3033555139b04bf91a111a847aca14113e33ba6248d49ba317fd43cbacb099e974117b')
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
cd $_pkgname
|
# create launcher script
|
||||||
|
cat >>"${srcdir}"/discord-launcher.sh <<EOF
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
sed -i "s|Exec=.*|Exec=/usr/bin/$pkgname|" $pkgname.desktop
|
if [ "\$XDG_SESSION_TYPE" = wayland ]; then
|
||||||
echo 'Path=/usr/bin' >>$pkgname.desktop
|
# Using wayland
|
||||||
|
exec electron${_electron} \\
|
||||||
|
--enable-features=UseOzonePlatform \\
|
||||||
|
--ozone-platform=wayland \\
|
||||||
|
--enable-accelerated-mjpeg-decode \\
|
||||||
|
--enable-accelerated-video \\
|
||||||
|
--ignore-gpu-blacklist \\
|
||||||
|
--enable-native-gpu-memory-buffers \\
|
||||||
|
--enable-gpu-rasterization \\
|
||||||
|
--enable-gpu \\
|
||||||
|
--enable-features=WebRTCPipeWireCapturer \\
|
||||||
|
/usr/lib/discord/app.asar \$@
|
||||||
|
else
|
||||||
|
# Using x11
|
||||||
|
exec electron${_electron} \\
|
||||||
|
--enable-accelerated-mjpeg-decode \\
|
||||||
|
--enable-accelerated-video \\
|
||||||
|
--ignore-gpu-blacklist \\
|
||||||
|
--enable-native-gpu-memory-buffers \\
|
||||||
|
--enable-gpu-rasterization \\
|
||||||
|
--enable-gpu \\
|
||||||
|
/usr/lib/discord/app.asar \$@
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# fix the .desktop file
|
||||||
|
sed -i "s|Exec=.*|Exec=/usr/bin/${_pkgname}|" Discord/$_pkgname.desktop
|
||||||
|
echo 'Path=/usr/bin' >>Discord/$_pkgname.desktop
|
||||||
|
|
||||||
|
# create the license files
|
||||||
|
curl https://discord.com/terms | html2text >"${srcdir}"/LICENSE.md
|
||||||
|
curl https://discord.com/licenses | html2text >"${srcdir}"/OSS-LICENSES.md
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
# Install the app
|
# create necessary directories
|
||||||
install -d "$pkgdir"/opt/$pkgname
|
install -d "${pkgdir}"/usr/{lib/$_pkgname,bin}
|
||||||
cp -a $_pkgname/. "$pkgdir"/opt/$pkgname
|
install -d "${pkgdir}"/usr/share/{pixmaps,applications,licenses/$_pkgname}
|
||||||
|
|
||||||
chmod 755 "$pkgdir"/opt/$pkgname/$_pkgname
|
cd "${srcdir}/Discord"
|
||||||
|
|
||||||
rm "$pkgdir"/opt/$pkgname/postinst.sh
|
# use system electron
|
||||||
|
asar e resources/app.asar resources/app
|
||||||
|
rm resources/app.asar
|
||||||
|
sed -i "s|process.resourcesPath|'/usr/lib/${_pkgname}'|" resources/app/app_bootstrap/buildInfo.js
|
||||||
|
sed -i "s|exeDir,|'/usr/share/pixmaps',|" resources/app/app_bootstrap/autoStart/linux.js
|
||||||
|
asar p resources/app resources/app.asar
|
||||||
|
rm -rf resources/app
|
||||||
|
|
||||||
install -d "$pkgdir"/usr/{bin,share/{pixmaps,applications}}
|
# copy relevant data
|
||||||
ln -s /opt/$pkgname/$_pkgname "$pkgdir"/usr/bin/$pkgname
|
cp -r resources/* "${pkgdir}"/usr/lib/$_pkgname/
|
||||||
ln -s /opt/$pkgname/discord.png "$pkgdir"/usr/share/pixmaps/$pkgname.png
|
cp $_pkgname.png \
|
||||||
ln -s /opt/$pkgname/$pkgname.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop
|
"${pkgdir}"/usr/share/pixmaps/$_pkgname.png
|
||||||
|
cp $_pkgname.desktop \
|
||||||
|
"${pkgdir}"/usr/share/applications/$_pkgname.desktop
|
||||||
|
|
||||||
# setuid on chrome-sandbox
|
cd "${srcdir}"
|
||||||
chmod u+s "$pkgdir"/opt/$pkgname/chrome-sandbox
|
|
||||||
|
|
||||||
# Licenses
|
# install the launch script
|
||||||
install -Dm 644 LICENSE.html "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.html
|
install -Dm 755 discord-launcher.sh "${pkgdir}"/usr/bin/$_pkgname
|
||||||
install -Dm 644 OSS-LICENSES.html "$pkgdir"/usr/share/licenses/$pkgname/OSS-LICENSES.html
|
|
||||||
|
# install licenses
|
||||||
|
install -Dm 644 LICENSE.md "${pkgdir}"/usr/share/licenses/$_pkgname/
|
||||||
|
install -Dm 644 OSS-LICENSES.md "${pkgdir}"/usr/share/licenses/$_pkgname/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue