From c21344130c8ef20c7a887d2de99d384305aab091 Mon Sep 17 00:00:00 2001 From: Manuel Date: Sat, 27 May 2023 19:58:24 +0200 Subject: [PATCH 1/3] Update chroot setup script and add makepkg.conf --- makepkg.conf | 166 ++++++++++++++++++++++++++++++++++++++++++++++ prepare-chroot.sh | 5 +- 2 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 makepkg.conf diff --git a/makepkg.conf b/makepkg.conf new file mode 100644 index 0000000..28fd9ed --- /dev/null +++ b/makepkg.conf @@ -0,0 +1,166 @@ +#!/hint/bash +# shellcheck disable=2034 + +# +# /etc/makepkg.conf +# + +######################################################################### +# SOURCE ACQUISITION +######################################################################### +# +#-- The download utilities that makepkg should use to acquire sources +# Format: 'protocol::agent' +DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u' + 'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u' + 'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' + 'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u' + 'rsync::/usr/bin/rsync --no-motd -z %u %o' + 'scp::/usr/bin/scp -C %u %o') + +# Other common tools: +# /usr/bin/snarf +# /usr/bin/lftpget -c +# /usr/bin/wget + +#-- The package required by makepkg to download VCS sources +# Format: 'protocol::package' +VCSCLIENTS=('bzr::bzr' + 'fossil::fossil' + 'git::git' + 'hg::mercurial' + 'svn::subversion') + +######################################################################### +# ARCHITECTURE, COMPILE FLAGS +######################################################################### +# +CARCH="x86_64" +CHOST="x86_64-pc-linux-gnu" + +#-- Compiler and Linker Flags +#CPPFLAGS="" +CFLAGS="-march=x86-64-v3 -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -mpclmul" +CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS" +LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" +LTOFLAGS="-flto=auto -falign-functions=32" + +RUSTFLAGS="-Copt-level=3 -Ctarget-cpu=x86-64-v3 -Ccodegen-units=1" +#-- Make Flags: change this for DistCC/SMP systems + +MAKEFLAGS="-j $(nproc)" +#-- Debugging flags +DEBUG_CFLAGS="-g" +DEBUG_CXXFLAGS="$DEBUG_CFLAGS" +DEBUG_RUSTFLAGS="-C debuginfo=2" + +######################################################################### +# BUILD ENVIRONMENT +######################################################################### +# +# Makepkg defaults: BUILDENV=(!distcc !color !ccache check !sign) +# A negated environment option will do the opposite of the comments below. +# +#-- distcc: Use the Distributed C/C++/ObjC compiler +#-- color: Colorize output messages +#-- ccache: Use ccache to cache compilation +#-- check: Run the check() function if present in the PKGBUILD +#-- sign: Generate PGP signature file +# +BUILDENV=(!distcc color !ccache check !sign) +# +#-- If using DistCC, your MAKEFLAGS will also need modification. In addition, +#-- specify a space-delimited list of hosts running in the DistCC cluster. +#DISTCC_HOSTS="" +# +#-- Specify a directory for package building. +#BUILDDIR=/tmp/makepkg + +######################################################################### +# GLOBAL PACKAGE OPTIONS +# These are default values for the options=() settings +######################################################################### +# +# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto) +# A negated option will do the opposite of the comments below. +# +#-- strip: Strip symbols from binaries/libraries +#-- docs: Save doc directories specified by DOC_DIRS +#-- libtool: Leave libtool (.la) files in packages +#-- staticlibs: Leave static library (.a) files in packages +#-- emptydirs: Leave empty directories in packages +#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip +#-- purge: Remove files specified by PURGE_TARGETS +#-- debug: Add debugging flags as specified in DEBUG_* variables +#-- lto: Add compile flags for building with link time optimization +# +OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge debug lto) + +#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2 +INTEGRITY_CHECK=(sha256) +#-- Options to be used when stripping binaries. See `man strip' for details. +STRIP_BINARIES="--strip-all" +#-- Options to be used when stripping shared libraries. See `man strip' for details. +STRIP_SHARED="--strip-unneeded" +#-- Options to be used when stripping static libraries. See `man strip' for details. +STRIP_STATIC="--strip-debug" +#-- Manual (man and info) directories to compress (if zipman is specified) +MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info}) +#-- Doc directories to remove (if !docs is specified) +DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc}) +#-- Files to be removed from all packages (if purge is specified) +PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod) +#-- Directory to store source code in for debug packages +DBGSRCDIR="/usr/src/debug" + +######################################################################### +# PACKAGE OUTPUT +######################################################################### +# +# Default: put built package and cached source in build directory +# +#-- Destination: specify a fixed directory where all packages will be placed +#PKGDEST=/home/packages +#-- Source cache: specify a fixed directory where source files will be cached +#SRCDEST=/home/sources +#-- Source packages: specify a fixed directory where all src packages will be placed +#SRCPKGDEST=/home/srcpackages +#-- Log files: specify a fixed directory where all log files will be placed +#LOGDEST=/home/makepkglogs +#-- Packager: name/email of the person or organization building packages + +PACKAGER="Manuel Hüsers " +#-- Specify a key to use for package signing +#GPGKEY="" + +######################################################################### +# COMPRESSION DEFAULTS +######################################################################### +# +COMPRESSGZ=(gzip -c -f -n) +COMPRESSBZ2=(bzip2 -c -f) +COMPRESSXZ=(xz -c -z -) +COMPRESSZST=(zstd -c -T0 --ultra -20 -) +COMPRESSLRZ=(lrzip -q) +COMPRESSLZO=(lzop -q) +COMPRESSZ=(compress -c -f) +COMPRESSLZ4=(lz4 -q) +COMPRESSLZ=(lzip -c -f) + +######################################################################### +# EXTENSION DEFAULTS +######################################################################### +# +PKGEXT='.pkg.tar' +SRCEXT='.src.tar' + +######################################################################### +# OTHER +######################################################################### +# +#-- Command used to run pacman as root, instead of trying sudo and su +#PACMAN_AUTH=() +# vim: set ft=sh ts=2 sw=2 et: + +export GOAMD64=v3 +export CARGO_PROFILE_RELEASE_LTO=fat diff --git a/prepare-chroot.sh b/prepare-chroot.sh index e38dc6b..b307ece 100755 --- a/prepare-chroot.sh +++ b/prepare-chroot.sh @@ -4,10 +4,11 @@ sudo -v || exit 1 +[ ! -d "$CHROOT/root" ] && sudo mkarchroot -M "$(dirname "$0")"/makepkg.conf "$CHROOT/root" base-devel + arch-nspawn "$CHROOT/root" pacman -Syu mkdir -p -m 0755 "$CHROOT/$USER" -mountpoint -q "$CHROOT/$USER" -[ $? -gt 0 ] && sudo mount -t tmpfs -o defaults,nodev,mode=0755,uid=$(id -u),gid=$(id -g) tmpfs "$CHROOT/$USER" +[ ! $(mountpoint -q "$CHROOT/$USER") ] && sudo mount -t tmpfs -o defaults,nodev,mode=0755,uid=$(id -u),gid=$(id -g) tmpfs "$CHROOT/$USER" exit 0 From b09bd231d5b651f308b8d28aade1fb9f5bd839d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20H=C3=BCsers?= Date: Sat, 27 May 2023 20:10:10 +0200 Subject: [PATCH 2/3] upgpkg: discord-electron 0.0.27-2 Update Discord launcher script (Original by Zoddo) Add libxss as dependency to fix Discord corruption warning Add install script to notify user about discord-flags.conf Remove duplicate Path variable in .desktop file Update contributor list --- discord-electron/.SRCINFO | 6 ++- discord-electron/PKGBUILD | 47 ++++++----------------- discord-electron/discord-electron.install | 18 +++++++++ discord-electron/discord-launcher.sh | 28 ++++++++++++++ 4 files changed, 63 insertions(+), 36 deletions(-) create mode 100644 discord-electron/discord-electron.install create mode 100644 discord-electron/discord-launcher.sh diff --git a/discord-electron/.SRCINFO b/discord-electron/.SRCINFO index 9e5707f..9975a49 100644 --- a/discord-electron/.SRCINFO +++ b/discord-electron/.SRCINFO @@ -1,20 +1,24 @@ pkgbase = discord-electron pkgdesc = Discord using system provided electron (v22) for increased security and performance pkgver = 0.0.27 - pkgrel = 1 + pkgrel = 2 url = https://discord.com + install = discord-electron.install arch = x86_64 license = custom makedepends = asar makedepends = curl makedepends = python-html2text depends = electron22 + depends = libxss optdepends = libpulse: Pulseaudio support optdepends = xdg-utils: Open files provides = discord conflicts = discord options = !strip source = https://dl.discordapp.net/apps/linux/0.0.27/discord-0.0.27.tar.gz + source = discord-launcher.sh sha512sums = 285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f + sha512sums = d8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83 pkgname = discord-electron diff --git a/discord-electron/PKGBUILD b/discord-electron/PKGBUILD index 4dd62cd..7ed6943 100644 --- a/discord-electron/PKGBUILD +++ b/discord-electron/PKGBUILD @@ -1,4 +1,6 @@ # Maintainer: Manuel Hüsers +# Contributor: Zoddo +# Contributor: Thaodan # Contributor: Stick # Contributor: johnnyapol # Contributor: huyizheng @@ -6,14 +8,14 @@ # Contributor: Morgan # 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_arch_electron PKGBUILD from johnnyapol, huyizheng, Thaodan and Zoddo # Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) pkgname=discord-electron _pkgname=discord _electron=22 pkgver=0.0.27 -pkgrel=1 +pkgrel=2 pkgdesc="Discord using system provided electron (v${_electron}) for increased security and performance" arch=('x86_64') provides=("${_pkgname}") @@ -21,49 +23,24 @@ conflicts=("${_pkgname}") url='https://discord.com' license=('custom') options=('!strip') -depends=("electron${_electron}") +install="$pkgname.install" +depends=("electron${_electron}" 'libxss') 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=('285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f') +source=("https://dl.discordapp.net/apps/linux/${pkgver}/discord-${pkgver}.tar.gz" + 'discord-launcher.sh') +sha512sums=('285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f' + 'd8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83') prepare() { - # create launcher script - cat >> "${srcdir}"/discord-launcher.sh <> Discord/$_pkgname.desktop # create the license files curl https://discord.com/terms | html2text >"${srcdir}"/LICENSE.md diff --git a/discord-electron/discord-electron.install b/discord-electron/discord-electron.install new file mode 100644 index 0000000..3947c77 --- /dev/null +++ b/discord-electron/discord-electron.install @@ -0,0 +1,18 @@ +post_upgrade() { + # return if old package version is greater than or equal to 0.0.27-2... + (( $(vercmp $2 '0.0.27-2') >= 0 )) && return + + cat < You can now add or uncomment additional Electron flags in + '~/.config/discord-flags.conf' (if XDG_CONFIG_HOME is not set) + +EOF +} + +post_install() { + cat < In case of performance problems consider adding or uncommenting Electron + flags in '~/.config/discord-flags.conf' (if XDG_CONFIG_HOME is not set) + +EOF +} diff --git a/discord-electron/discord-launcher.sh b/discord-electron/discord-launcher.sh new file mode 100644 index 0000000..398e61d --- /dev/null +++ b/discord-electron/discord-launcher.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@-flags.conf" + +declare -a flags + +if [[ -f "${flags_file}" ]]; then + mapfile -t < "${flags_file}" +else + cat > "${flags_file}" < Date: Sat, 27 May 2023 20:10:31 +0200 Subject: [PATCH 3/3] upgpkg: discord-electron-openasar 0.0.27+809-2 Update to latest OpenAsar commit Update Discord launcher script (Original by Zoddo) Add libxss as dependency to fix Discord corruption warning Add install script to notify user about discord-flags.conf Remove duplicate Path variable in .desktop file Update contributor list --- discord-electron-openasar/.SRCINFO | 10 +++-- discord-electron-openasar/PKGBUILD | 45 +++++-------------- .../discord-electron-openasar.install | 18 ++++++++ discord-electron-openasar/discord-launcher.sh | 28 ++++++++++++ 4 files changed, 63 insertions(+), 38 deletions(-) create mode 100644 discord-electron-openasar/discord-electron-openasar.install create mode 100644 discord-electron-openasar/discord-launcher.sh diff --git a/discord-electron-openasar/.SRCINFO b/discord-electron-openasar/.SRCINFO index 98e27e9..217ad2f 100644 --- a/discord-electron-openasar/.SRCINFO +++ b/discord-electron-openasar/.SRCINFO @@ -1,8 +1,9 @@ pkgbase = discord-electron-openasar pkgdesc = Discord packaged with OpenAsar using system provided electron (v22) for increased security and performance - pkgver = 0.0.27+808 - pkgrel = 1 + pkgver = 0.0.27+809 + pkgrel = 2 url = https://discord.com + install = discord-electron-openasar.install arch = x86_64 license = custom makedepends = git @@ -11,14 +12,17 @@ pkgbase = discord-electron-openasar makedepends = curl makedepends = python-html2text depends = electron22 + depends = libxss optdepends = libpulse: Pulseaudio support optdepends = xdg-utils: Open files provides = discord conflicts = discord options = !strip source = https://dl.discordapp.net/apps/linux/0.0.27/discord-0.0.27.tar.gz - source = git+https://github.com/goosemod/openasar.git#commit=99cd4f53bf910f5f6ce5234905126f261a35fefa + source = discord-launcher.sh + source = git+https://github.com/goosemod/openasar.git#commit=a8b07392808032f95ac3a7c5856e76d2619c91ae sha512sums = 285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f + sha512sums = d8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83 sha512sums = SKIP pkgname = discord-electron-openasar diff --git a/discord-electron-openasar/PKGBUILD b/discord-electron-openasar/PKGBUILD index a62e6b7..4e7d355 100644 --- a/discord-electron-openasar/PKGBUILD +++ b/discord-electron-openasar/PKGBUILD @@ -1,15 +1,15 @@ # Maintainer: Manuel Hüsers # 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_arch_electron PKGBUILD from johnnyapol, huyizheng, Thaodan and Zoddo # Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) pkgname=discord-electron-openasar _pkgname=discord _electron=22 -pkgver=0.0.27+808 +pkgver=0.0.27+809 _pkgver=${pkgver%%+*} -pkgrel=1 +pkgrel=2 pkgdesc="Discord packaged with OpenAsar using system provided electron (v${_electron}) for increased security and performance" arch=('x86_64') provides=("${_pkgname}") @@ -17,15 +17,18 @@ conflicts=("${_pkgname}") url='https://discord.com' license=('custom') options=('!strip') -depends=("electron${_electron}") +install="$pkgname.install" +depends=("electron${_electron}" 'libxss') makedepends=('git' 'asar' 'nodejs' 'curl' 'python-html2text') optdepends=( 'libpulse: Pulseaudio support' 'xdg-utils: Open files' ) source=("https://dl.discordapp.net/apps/linux/${_pkgver}/discord-${_pkgver}.tar.gz" - "git+https://github.com/goosemod/openasar.git#commit=99cd4f53bf910f5f6ce5234905126f261a35fefa") + 'discord-launcher.sh' + "git+https://github.com/goosemod/openasar.git#commit=a8b07392808032f95ac3a7c5856e76d2619c91ae") sha512sums=('285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f' + 'd8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83' 'SKIP') # just in case I get the version wrong @@ -35,39 +38,11 @@ pkgver() { } prepare() { - # create launcher script - cat >> "${srcdir}"/discord-launcher.sh <> Discord/$_pkgname.desktop # create the license files curl https://discord.com/terms | html2text >"${srcdir}"/LICENSE.md diff --git a/discord-electron-openasar/discord-electron-openasar.install b/discord-electron-openasar/discord-electron-openasar.install new file mode 100644 index 0000000..11da629 --- /dev/null +++ b/discord-electron-openasar/discord-electron-openasar.install @@ -0,0 +1,18 @@ +post_upgrade() { + # return if old package version is greater than or equal to 0.0.27+809-2... + (( $(vercmp $2 '0.0.27+809-2') >= 0 )) && return + + cat < You can now add or uncomment additional Electron flags in + '~/.config/discord-flags.conf' (if XDG_CONFIG_HOME is not set) + +EOF +} + +post_install() { + cat < In case of performance problems consider adding or uncommenting Electron + flags in '~/.config/discord-flags.conf' (if XDG_CONFIG_HOME is not set) + +EOF +} diff --git a/discord-electron-openasar/discord-launcher.sh b/discord-electron-openasar/discord-launcher.sh new file mode 100644 index 0000000..398e61d --- /dev/null +++ b/discord-electron-openasar/discord-launcher.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail + +flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@-flags.conf" + +declare -a flags + +if [[ -f "${flags_file}" ]]; then + mapfile -t < "${flags_file}" +else + cat > "${flags_file}" <