Rename package to discord-electron, PKGBUILD refactor

This commit is contained in:
Manuel 2023-04-03 08:32:00 +02:00
parent 0cd9d00e90
commit f277aa9dbd
Signed by: Manuel
GPG key ID: 4085037435E1F07A
6 changed files with 95 additions and 194 deletions

View file

@ -1,20 +0,0 @@
pkgbase = discord-electron-bin
pkgdesc = Discord using system provided electron (v22) for increased security and performance
pkgver = 0.0.26
pkgrel = 1
url = https://discord.com
arch = x86_64
license = custom
makedepends = asar
makedepends = curl
makedepends = python-html2text
depends = electron22
optdepends = libpulse: Pulseaudio support
optdepends = xdg-utils: Open files
provides = discord
conflicts = discord
options = !strip
source = https://dl.discordapp.net/apps/linux/0.0.26/discord-0.0.26.tar.gz
sha512sums = 65477c2c033f30850a699706a6502ff4f4af8838185716d968d641fdab3033555139b04bf91a111a847aca14113e33ba6248d49ba317fd43cbacb099e974117b
pkgname = discord-electron-bin

View file

@ -1,102 +0,0 @@
# Maintainer: 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: 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-electron-bin
_pkgname=discord
_electron=22
pkgver=0.0.26
pkgrel=1
pkgdesc="Discord using system provided electron (v${_electron}) for increased security and performance"
arch=('x86_64')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
url='https://discord.com'
license=('custom')
options=('!strip')
depends=("electron${_electron}")
makedepends=('asar' 'curl' 'python-html2text')
optdepends=(
'libpulse: Pulseaudio support'
'xdg-utils: Open files'
)
source=("https://dl.discordapp.net/apps/linux/${pkgver}/discord-${pkgver}.tar.gz")
sha512sums=('65477c2c033f30850a699706a6502ff4f4af8838185716d968d641fdab3033555139b04bf91a111a847aca14113e33ba6248d49ba317fd43cbacb099e974117b')
_tarname='Discord'
prepare() {
# create launcher script
cat >> "${srcdir}"/discord-launcher.sh <<EOF
#!/bin/sh
if [ "\$XDG_SESSION_TYPE" = wayland ]; then
# 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}|" $_tarname/$_pkgname.desktop
echo 'Path=/usr/bin' >> $_tarname/$_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
# use system electron
asar e $_tarname/resources/app.asar $_tarname/resources/app
rm $_tarname/resources/app.asar
sed -i "s|process.resourcesPath|'/usr/lib/${_pkgname}'|" $_tarname/resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'/usr/share/pixmaps',|" $_tarname/resources/app/app_bootstrap/autoStart/linux.js
asar p $_tarname/resources/app $_tarname/resources/app.asar --unpack-dir '**'
rm -rf $_tarname/resources/app
}
package() {
# create necessary directories
install -d "${pkgdir}"/usr/{lib/$_pkgname,bin}
install -d "${pkgdir}"/usr/share/{pixmaps,applications,licenses/$_pkgname}
# copy relevant data
cp -r $_tarname/resources/* "${pkgdir}"/usr/lib/$_pkgname/
# install the binary
install -Dm 755 discord-launcher.sh "${pkgdir}"/usr/bin/$_pkgname
cp $_tarname/$_pkgname.png \
"${pkgdir}"/usr/share/pixmaps/$_pkgname.png
cp $_tarname/$_pkgname.desktop \
"${pkgdir}"/usr/share/applications/$_pkgname.desktop
# license
install -Dm 644 LICENSE.md "${pkgdir}"/usr/share/licenses/$_pkgname/
install -Dm 644 OSS-LICENSES.md "${pkgdir}"/usr/share/licenses/$_pkgname/
}

View file

@ -1,27 +1,20 @@
pkgbase = discord-electron pkgbase = discord-electron
pkgdesc = All-in-one voice and text chat for gamers that's free and secure. pkgdesc = Discord using system provided electron (v22) for increased security and performance
pkgver = 0.0.15 pkgver = 0.0.26
pkgrel = 1 pkgrel = 1
url = https://discordapp.com url = https://discord.com
arch = x86_64 arch = x86_64
license = custom license = custom
makedepends = asar makedepends = asar
depends = electron makedepends = curl
depends = libnotify makedepends = python-html2text
depends = libxss depends = electron22
depends = nspr
depends = nss
depends = gtk3
optdepends = libpulse: Pulseaudio support optdepends = libpulse: Pulseaudio support
optdepends = xdg-utils: Open files optdepends = xdg-utils: Open files
provides = discord
conflicts = discord conflicts = discord
source = https://dl.discordapp.net/apps/linux/0.0.15/discord-0.0.15.tar.gz options = !strip
source = discord.sh source = https://dl.discordapp.net/apps/linux/0.0.26/discord-0.0.26.tar.gz
source = LICENSE.html::https://discordapp.com/terms sha512sums = 65477c2c033f30850a699706a6502ff4f4af8838185716d968d641fdab3033555139b04bf91a111a847aca14113e33ba6248d49ba317fd43cbacb099e974117b
source = OSS-LICENSES.html::https://discordapp.com/licenses
sha512sums = 4f220ecd0e0c9fcd793ed065055479391506d9401b75ca541cde4136d0290f2720fccca87139091faf269fdb2c020adb5b7333710a31ca603ce8552f3dd4841b
sha512sums = b5fe7bfd31ae1867f3392605bd52ac155c6c02c4a2a132419d9806c08e61715461818919c2e480ba8e7f14b51aefcd588dcaa247f15d24286e177e45f43e17f9
sha512sums = 6a2ebf7aadf06ba804c1c6f10677a014b2b9eb17a2bb34538426bf4c76686c4c11976bd682610965535f7a5d4a2f6b36dfa5aa875578defef1213ed866acb530
sha512sums = f6d46b7a2dd6c8475625a988f36419788ab90149317c9a4e5e8ffea8613f27d0746c1557467332770c033349abd370bf721990ecadc383b4aee63cb8b74a280c
pkgname = discord-electron pkgname = discord-electron

View file

@ -1,6 +0,0 @@
pkg
src
*.tar.gz
*.pkg.tar.zst
LICENSE.html
OSS-LICENSES.html

View file

@ -1,65 +1,103 @@
# Maintainer: Dušan Simić <dusan.simic1810@gmail.com> # Maintainer: 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: 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)
_electron=electron
pkgname=discord-electron pkgname=discord-electron
_pkgname=discord _pkgname=discord
_Pkgname=Discord _electron=22
pkgver=0.0.15 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=("$_electron" 'libnotify' 'libxss' 'nspr' 'nss' 'gtk3') options=('!strip')
makedepends=('asar') depends=("electron${_electron}")
optdepends=('libpulse: Pulseaudio support' makedepends=('asar' 'curl' 'python-html2text')
'xdg-utils: Open files') optdepends=(
conflicts=(discord) 'libpulse: Pulseaudio support'
source=("https://dl.discordapp.net/apps/linux/$pkgver/$_pkgname-$pkgver.tar.gz" 'xdg-utils: Open files'
'discord.sh' )
'LICENSE.html::https://discordapp.com/terms' source=("https://dl.discordapp.net/apps/linux/${pkgver}/discord-${pkgver}.tar.gz")
'OSS-LICENSES.html::https://discordapp.com/licenses') sha512sums=('65477c2c033f30850a699706a6502ff4f4af8838185716d968d641fdab3033555139b04bf91a111a847aca14113e33ba6248d49ba317fd43cbacb099e974117b')
sha512sums=('4f220ecd0e0c9fcd793ed065055479391506d9401b75ca541cde4136d0290f2720fccca87139091faf269fdb2c020adb5b7333710a31ca603ce8552f3dd4841b'
'b5fe7bfd31ae1867f3392605bd52ac155c6c02c4a2a132419d9806c08e61715461818919c2e480ba8e7f14b51aefcd588dcaa247f15d24286e177e45f43e17f9'
'6a2ebf7aadf06ba804c1c6f10677a014b2b9eb17a2bb34538426bf4c76686c4c11976bd682610965535f7a5d4a2f6b36dfa5aa875578defef1213ed866acb530'
'f6d46b7a2dd6c8475625a988f36419788ab90149317c9a4e5e8ffea8613f27d0746c1557467332770c033349abd370bf721990ecadc383b4aee63cb8b74a280c')
prepare() { prepare() {
cd "$_Pkgname" # create launcher script
cat >> "${srcdir}"/discord-launcher.sh <<EOF
#!/bin/sh
# Change exec entry for desktop file if [ "\$XDG_SESSION_TYPE" = wayland ]; then
sed -i "s|Exec=.*|Exec=/usr/bin/$_pkgname|" "$_pkgname.desktop" # Using wayland
sed -i "s|Icon=.*|Icon=$pkgname|" "$_pkgname.desktop" exec electron${_electron} \\
echo 'Path=/usr/bin' >> "$_pkgname.desktop" --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
# Change resource path in asar archive # fix the .desktop file
asar extract resources/app.asar resources/app.asar.dest sed -i "s|Exec=.*|Exec=/usr/bin/${_pkgname}|" Discord/$_pkgname.desktop
sed -i "s|process\.resourcesPath|'/', 'opt', '$pkgname'|" resources/app.asar.dest/app_bootstrap/buildInfo.js echo 'Path=/usr/bin' >> Discord/$_pkgname.desktop
asar pack resources/app.asar.dest resources/app.asar
# Cleanup unpacked files
rm -r resources/app.asar.dest
cd "$srcdir" # create the license files
curl https://discord.com/terms | html2text >"${srcdir}"/LICENSE.md
# Set electron version in startup script curl https://discord.com/licenses | html2text >"${srcdir}"/OSS-LICENSES.md
sed -i "s|@ELECTRON@|$_electron|" "$_pkgname.sh"
} }
package() { package() {
# Install the app # create necessary directories
install -d "$pkgdir/opt/$pkgname" install -d "${pkgdir}"/usr/{lib/$_pkgname,bin}
cp -a "$_Pkgname/resources/." "$pkgdir/opt/$pkgname" install -d "${pkgdir}"/usr/share/{pixmaps,applications,licenses/$_pkgname}
# Install startup script cd "${srcdir}/Discord"
install -Dm755 "$_pkgname.sh" "$pkgdir/usr/bin/$pkgname"
ln -s "/usr/bin/$pkgname" "$pkgdir/usr/bin/$_pkgname"
# Install icon and desktop file # use system electron
install -Dm644 "$_Pkgname/$_pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png" asar e resources/app.asar resources/app
install -Dm644 "$_Pkgname/$_pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop" 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
# Licenses # copy relevant data
install -Dm644 LICENSE.html "$pkgdir/usr/share/licenses/$pkgname/LICENSE.html" cp -r resources/* "${pkgdir}"/usr/lib/$_pkgname/
install -Dm644 OSS-LICENSES.html "$pkgdir/usr/share/licenses/$pkgname/OSS-LICENSES.html" cp $_pkgname.png \
"${pkgdir}"/usr/share/pixmaps/$_pkgname.png
cp $_pkgname.desktop \
"${pkgdir}"/usr/share/applications/$_pkgname.desktop
cd "${srcdir}"
# install the launch script
install -Dm 755 discord-launcher.sh "${pkgdir}"/usr/bin/$_pkgname
# install licenses
install -Dm 644 LICENSE.md "${pkgdir}"/usr/share/licenses/$_pkgname/
install -Dm 644 OSS-LICENSES.md "${pkgdir}"/usr/share/licenses/$_pkgname/
} }

View file

@ -1,2 +0,0 @@
#!/bin/sh
exec @ELECTRON@ /opt/discord-electron/app.asar --disable-dev-mode "$@"