summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorxiota2023-11-17 11:03:28 -0800
committerxiota2023-11-17 11:36:15 -0800
commita49b41ac23220f4be379fc975c61db70e2dd3f54 (patch)
treea15e85e424b2a42e2e7ae55a1fe92dce4f4563d4
parentee9c0a48cf84b003210a2880010e95e7240afbf0 (diff)
downloadaur-a49b41ac23220f4be379fc975c61db70e2dd3f54.tar.gz
reorganize and add processor checks
-rw-r--r--.SRCINFO28
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD175
-rw-r--r--mercury-browser.desktop2
-rw-r--r--mercury-browser.install33
-rw-r--r--mercury-browser.sh29
6 files changed, 198 insertions, 73 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 3d2afc25a17d..c4be5879ee7e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,28 +1,32 @@
pkgbase = mercury-browser-bin
- pkgdesc = Firefox fork with compiler optimizations and patches from Librewolf, Waterfox, and GNU IceCat.
+ pkgdesc = Compiler optimized, private Firefox fork
pkgver = 115.4.0
- pkgrel = 3
- url = https://thorium.rocks/mercury
+ pkgrel = 4
+ url = https://github.com/Alex313031/Mercury
+ install = mercury-browser.install
arch = x86_64
license = MPL
license = GPL
license = LGPL
- depends = dbus-glib
- depends = gtk3
- depends = libxt
- depends = nss
optdepends = ffmpeg: H264/AAC/MP3 decoding
optdepends = hunspell: Spell checking
optdepends = hyphen: Hyphenation
- optdepends = libnotify: Notification integration
optdepends = networkmanager: Location detection via available WiFi networks
optdepends = pulseaudio: Sound
optdepends = upower: Battery API
- source = https://github.com/Alex313031/Mercury/releases/download/v.115.4.0/mercury_115.4.0_linux_x64.zip
+ noextract = mercury-browser_115.4.0_amd64.deb
+ options = !emptydirs
+ options = !strip
+ source = mercury-browser_115.4.0_amd64.deb::https://github.com/Alex313031/Mercury/releases/download/v.115.4.0/mercury-browser_115.4.0_amd64.deb
source = mercury-browser.sh
- source = mercury-browser.desktop
sha256sums = SKIP
- sha256sums = 3e70b82d2f477d5d032338a3c66a3ececaaaf5bf606ab5f5d018321a6fb6afab
- sha256sums = 8370ee50614115b06e0f8fa96dfbc2db80e2b9ab41368bf9b4ba42fb8ded9982
+ sha256sums = f76a772f2c377c319c4e8bd737d219891b0c439bd8e07efd96584021c2e74bbb
pkgname = mercury-browser-bin
+ depends = dbus-glib
+ depends = gtk3
+ depends = libnotify
+ depends = libxt
+ depends = nss
+ provides = mercury-browser=115.4.0
+ conflicts = mercury-browser
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..018a3de08144
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*
+!PKGBUILD
+!.SRCINFO
+!.gitignore
diff --git a/PKGBUILD b/PKGBUILD
index 38d2fbe146f1..57dfdc8f083e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,63 +1,124 @@
-# Maintainer: Alexey Peschany <archlinux at sandboiii dot xyz>
+# Maintainer: xiota / aur.chaotic.cx
+# Contributor: Alexey Peschany <archlinux at sandboiii dot xyz>
-_pkgname=mercury-browser
-pkgname=${_pkgname}-bin
+# options
+if [ -z "$_pkgver" ] ; then
+ : ${_autoupdate:=true}
+else
+ : ${_autoupdate:=false}
+fi
+
+: ${_pkgver:=115.4.0}
+
+: ${_pkgtype:=bin}
+
+# basic info
+_pkgname="mercury-browser"
+pkgname="$_pkgname${_pkgtype:+-$_pkgtype}"
pkgver=115.4.0
-pkgrel=3
-pkgdesc="Firefox fork with compiler optimizations and patches from Librewolf, Waterfox, and GNU IceCat."
-arch=('x86_64')
-url="https://thorium.rocks/mercury"
+pkgrel=4
+pkgdesc="Compiler optimized, private Firefox fork"
+url="https://github.com/Alex313031/Mercury"
license=('MPL' 'GPL' 'LGPL')
-depends=('dbus-glib' 'gtk3' 'libxt' 'nss')
-optdepends=('ffmpeg: H264/AAC/MP3 decoding'
- 'hunspell: Spell checking'
- 'hyphen: Hyphenation'
- 'libnotify: Notification integration'
- 'networkmanager: Location detection via available WiFi networks'
- 'pulseaudio: Sound'
- 'upower: Battery API')
-source=("https://github.com/Alex313031/Mercury/releases/download/v.$pkgver/mercury_${pkgver}_linux_x64.zip"
- "$_pkgname.sh"
- "$_pkgname.desktop")
-sha256sums=('SKIP'
- '3e70b82d2f477d5d032338a3c66a3ececaaaf5bf606ab5f5d018321a6fb6afab'
- '8370ee50614115b06e0f8fa96dfbc2db80e2b9ab41368bf9b4ba42fb8ded9982')
+arch=('x86_64')
+
+# main package
+_main_package() {
+ _update_version
+
+ optdepends=(
+ 'ffmpeg: H264/AAC/MP3 decoding'
+ 'hunspell: Spell checking'
+ 'hyphen: Hyphenation'
+ 'networkmanager: Location detection via available WiFi networks'
+ 'pulseaudio: Sound'
+ 'upower: Battery API'
+ )
+
+ options=('!emptydirs' '!strip')
+ install="$_pkgname.install"
+
+ _dl_filename="${_pkgname}_${_pkgver:?}_amd64.deb"
+ noextract+=("$_dl_filename")
+ source=(
+ "$_dl_filename"::"$_dl_url"
+ "$_pkgname.sh"
+ )
+ sha256sums=(
+ 'SKIP'
+ 'f76a772f2c377c319c4e8bd737d219891b0c439bd8e07efd96584021c2e74bbb'
+ )
+}
+
+# common functions
+pkgver() {
+ printf '%s' \
+ "${_pkgver:?}"
+}
package() {
- # Create directories
- mkdir -p "$pkgdir"/usr/bin
- mkdir -p "$pkgdir"/usr/share/applications
- mkdir -p "$pkgdir"/opt
-
- # Install
- cp -r mercury_${pkgver}_linux_x64/mercury_${pkgver}_linux_x64/mercury/ "$pkgdir"/opt/$_pkgname
-
- # Temporal fix
- # Hope next release won't have this problem
- chmod +x "$pkgdir"/opt/$_pkgname/mercury
- chmod +x "$pkgdir"/opt/$_pkgname/mercury-bin
- chmod +x "$pkgdir"/opt/$_pkgname/glxtest
- chmod +x "$pkgdir"/opt/$_pkgname/vaapitest
-
- # Launchers
- install -m755 $_pkgname.sh "$pkgdir"/usr/bin/$_pkgname
- ln -s $_pkgname "$pkgdir"/usr/bin/$pkgname # compatibility
-
- # Desktops
- install -m644 *.desktop "$pkgdir"/usr/share/applications/
-
- # Icons
- for i in 16x16 32x32 48x48 64x64 128x128; do
- install -d "$pkgdir"/usr/share/icons/hicolor/$i/apps/
- ln -s /opt/$_pkgname/browser/chrome/icons/default/default${i/x*}.png \
- "$pkgdir"/usr/share/icons/hicolor/$i/apps/$_pkgname.png
- done
-
- # Use system-provided dictionaries
- #rm -r "$pkgdir"/opt/$_pkgname/dictionaries
- ln -Ts /usr/share/hunspell "$pkgdir"/opt/$_pkgname/dictionaries
- ln -Ts /usr/share/hyphen "$pkgdir"/opt/$_pkgname/hyphenation
-
- # Use system certificates
- ln -sf /usr/lib/libnssckbi.so "$pkgdir"/opt/$_pkgname/libnssckbi.so
+ provides=("$_pkgname=${pkgver%%.r*}")
+ conflicts=("$_pkgname")
+
+ depends+=(
+ 'dbus-glib'
+ 'gtk3'
+ 'libnotify' # notify-send
+ 'libxt'
+ 'nss'
+ )
+
+ # extract archive
+ bsdtar -xf "$_dl_filename" data.tar.gz
+ bsdtar -xf data.tar.gz -C "${pkgdir:?}/"
+ rm data.tar.gz
+
+ # move and copy files into position
+ install -Dm755 "$_pkgname.sh" "${pkgdir:?}/usr/bin/$_pkgname"
+
+ install -dm755 "${pkgdir:?}/opt/$_pkgname"
+ mv "${pkgdir:?}/usr/lib/mercury"/* "${pkgdir:?}/opt/$_pkgname/"
+
+ install -Dm644 "${pkgdir:?}/usr/share/doc/mercury-browser/copyright" "${pkgdir:?}/usr/share/licenses/$pkgname/LICENSE"
+
+ # fix permissions
+ chmod -R u+rwX,go+rX,go-w "${pkgdir:?}/"
+
+ # remove unnecessary folders
+ \rm -rf "${pkgdir:?}/usr/lib/"
+ \rm -rf "${pkgdir:?}/usr/share/doc/"
+ \rm -rf "${pkgdir:?}/usr/share/lintian/"
}
+
+# update version
+_update_version() {
+ if [ x"${_autoupdate::1}" != "xt" ] ; then
+ return
+ fi
+
+ _response=$(curl "https://api.github.com/repos/${url#*.com/}/releases" -s)
+
+ _get() {
+ printf '%s' "$_response" \
+ | awk -F '"' '/"'"$1"'":/{print $4}' \
+ | grep -E '_amd64\.deb' \
+ | head -1 | sed 's/^v//'
+ }
+
+ _dl_url=$(_get browser_download_url)
+
+ _regex='^.*mercury-browser_([0-9\.]+)_.*\.deb.*$'
+ _pkgver_new=$(
+ printf '%s' "$_dl_url" \
+ | grep -E "$_regex" | head -1 | sed -E "s@$_regex@\1@"
+ )
+
+ # update _pkgver
+ if [ x"$_pkgver" != x"${_pkgver_new:?}" ] ; then
+ _pkgver="$_pkgver_new"
+ sed -Ei "s@^(\s*: \\\$\{_pkgver):=.*\}\$@\1:=${_pkgver:?}}@" "$startdir/PKGBUILD"
+ fi
+}
+
+# execute
+_main_package
diff --git a/mercury-browser.desktop b/mercury-browser.desktop
index 4d58aa761f15..184d71cd9e78 100644
--- a/mercury-browser.desktop
+++ b/mercury-browser.desktop
@@ -1,5 +1,4 @@
[Desktop Entry]
-Version=1.0
Name=Mercury Browser
GenericName=Web Browser
Comment=The fastest Firefox fork on Earth
@@ -11,4 +10,3 @@ MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xm
StartupWMClass=Mercury Browser
Categories=Network;WebBrowser;
Keywords=web;browser;internet;
-Actions=new-window;new-private-window;
diff --git a/mercury-browser.install b/mercury-browser.install
new file mode 100644
index 000000000000..5e53179ff2d3
--- /dev/null
+++ b/mercury-browser.install
@@ -0,0 +1,33 @@
+# Colored makepkg-like functions
+msg_blue() {
+ printf "${BLUE}==>${BOLD} $1${ALL_OFF}\n"
+}
+
+note() {
+ printf "${BLUE}==>${YELLOW} NOTE:${BOLD} $1${ALL_OFF}\n"
+}
+
+ALL_OFF="$(tput sgr0)"
+BOLD="${ALL_OFF}$(tput bold)"
+BLACK="${BOLD}$(tput setaf 0)"
+RED="${BOLD}$(tput setaf 1)"
+GREEN="${BOLD}$(tput setaf 2)"
+YELLOW="${BOLD}$(tput setaf 3)"
+BLUE="${BOLD}$(tput setaf 4)"
+MAGENTA="${BOLD}$(tput setaf 5)"
+CYAN="${BOLD}$(tput setaf 6)"
+WHITE="${BOLD}$(tput setaf 7)"
+
+post_install() {
+ if /usr/lib/ld-linux-x86-64.so.2 --help | grep -qsE '^\s+x86-64-v3.*supported.*$' ; then
+ note "Congratulations. Your processor supports x86-64-v3."
+ note "Enjoy the fastest Firefox fork on Earth: mercury-browser"
+ else
+ note "Your processor does not support x86-64-v3."
+ note "mercury-browser will not work on your computer."
+ fi
+}
+
+post_upgrade() {
+ post_install
+}
diff --git a/mercury-browser.sh b/mercury-browser.sh
index 396cc6e98df8..0e89be023298 100644
--- a/mercury-browser.sh
+++ b/mercury-browser.sh
@@ -1,2 +1,27 @@
-#!/bin/sh
-exec /opt/mercury-browser/mercury-bin --class "Mercury Browser" --name "Mercury Browser" "$@"
+#!/usr/bin/env bash
+
+# check microprocessor architecture level
+if /usr/lib/ld-linux-x86-64.so.2 --help | grep -qsE '^\s+x86-64-v3.*supported.*$' ; then
+ XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
+
+ # Allow users to override command-line options
+ if [[ -f $XDG_CONFIG_HOME/mercury-flags.conf ]]; then
+ MERCURY_USER_FLAGS="$(cat $XDG_CONFIG_HOME/mercury-flags.conf)"
+ fi
+
+ # Launch
+ exec /opt/mercury-browser/mercury $MERCURY_USER_FLAGS "$@"
+else
+ _message=''
+ _message+=$'Your processor does not support x86-64-v3.\n'
+ _message+=$'mercury-browser will not work on your computer.'
+fi
+
+# display processor support message
+if tty -s ; then
+ echo "${_message:?}"
+else
+ notify-send -a "mercury-browser" -t 3000 "${_message:?}"
+fi
+
+exit 1