diff options
author | xiota | 2024-02-09 17:54:33 -0800 |
---|---|---|
committer | xiota | 2024-02-09 17:55:38 -0800 |
commit | a294ae4776529582408974ffda180255bd155460 (patch) | |
tree | 1d9118c9090305056ea5660042357e1f03b9abc5 | |
parent | 8650f897a24fad93cd1db01321f99c5285ea41f9 (diff) | |
download | aur-a294ae4776529582408974ffda180255bd155460.tar.gz |
add alternate versions
-rw-r--r-- | PKGBUILD | 2 | ||||
-rw-r--r-- | PKGBUILD.avx | 237 | ||||
-rw-r--r-- | PKGBUILD.avx2 | 237 | ||||
-rw-r--r-- | PKGBUILD.sse3 | 237 | ||||
-rw-r--r-- | PKGBUILD.sse4 | 237 |
5 files changed, 949 insertions, 1 deletions
@@ -1,4 +1,4 @@ -# Maintainer: xiota / aur.chaotic.cx +# Maintainer: # Contributor: Alexey Peschany <archlinux at sandboiii dot xyz> # options diff --git a/PKGBUILD.avx b/PKGBUILD.avx new file mode 100644 index 000000000000..2e8686abdcf5 --- /dev/null +++ b/PKGBUILD.avx @@ -0,0 +1,237 @@ +# Maintainer: + +# options +if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then + : ${_autoupdate:=false} +else + : ${_autoupdate:=true} +fi + +: ${_pkgtype:=-bin} + +# basic info +_pkgname="mercury-browser-avx" +pkgname="$_pkgname${_pkgtype:-}" +pkgver=122.0.2 +pkgrel=1 +pkgdesc="Compiler optimized, private Firefox fork" +url="https://github.com/Alex313031/Mercury" +license=('MPL-2.0') +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' + ) + + options=('!emptydirs' '!strip') + + : ${_dl_filename:=${_pkgname%-avx}_${_pkgver:?}_AVX.deb} + : ${_dl_url:=$url/releases/download/v.$_pkgver/$_dl_filename} + + noextract+=("$_dl_filename") + source=("$_dl_filename"::"$_dl_url") + sha256sums=('SKIP') +} + +# common functions +pkgver() { + echo "${_pkgver:?}" +} + +prepare() { + # desktop + install -Dvm644 /dev/stdin "$_pkgname.desktop" <<END +[Desktop Entry] +Version=1.0 +Name=Mercury +Comment=Browse the World Wide Web +GenericName=Web Browser +Keywords=Internet;WWW;Browser;Web;Explorer;Mercury +Exec=$_pkgname %u +StartupWMClass=mercury-default +Terminal=false +X-MultipleArgs=true +Type=Application +Icon=$_pkgname +Categories=GNOME;GTK;Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall; +StartupNotify=true +Actions=NewWindow;NewPrivateWindow;TempUserDir; + +[Desktop Action NewWindow] +Name=New Window +Exec=$_pkgname -new-window + +[Desktop Action NewPrivateWindow] +Name=New Private Window +Exec=$_pkgname -private-window + +[Desktop Action TempUserDir] +Name=Open With Temporary User Profile +Exec=$_pkgname --temp-profile +END + + install -Dvm644 /dev/stdin "$_pkgname.sh" <<END +#!/usr/bin/env bash + +# check microprocessor architecture level +if grep -qE '\bavx\b' /proc/cpuinfo ; then + _message='' + _message+=\$'The fastest Firefox fork on Earth.' +else + _message='' + _message+=\$'Your processor does not support AVX instructions.\n' + _message+=\$'mercury-browser may not work on your computer.' +fi + +# Allow users to override command-line options +XDG_CONFIG_HOME=\${XDG_CONFIG_HOME:-~/.config} +_FLAGFILE="\$XDG_CONFIG_HOME/mercury-flags.conf" +if [[ -f "\$_FLAGFILE" ]]; then + _USER_FLAGS=\$(cat "\$_FLAGFILE") +fi + +# display processor support message +if tty -s ; then + echo "\$_message" +else + [ ! -e "\$HOME/.mercury" ] && notify-send -a "mercury-browser" -t 7500 "\$_message" +fi + +# Launch +exec /opt/$_pkgname/mercury \$_USER_FLAGS "\$@" +END +} + +package() { + provides=("$_pkgname=${pkgver%%.r*}") + conflicts=("$_pkgname") + + depends+=( + 'alsa-lib' + 'dbus-glib' + 'gtk3' + 'libnotify' # notify-send + + ## implicit + #at-spi2-core + #cairo + #dbus + #fontconfig + #freetype2 + #gcc-libs + #gdk-pixbuf2 + #glib2 + #glibc + #libx11 + #libxcb + #libxcomposite + #libxcursor + #libxdamage + #libxext + #libxfixes + #libxi + #libxrandr + #libxrender + #pango + ) + + local _filetype="zip" + if bsdtar -xf "$_dl_filename" -- data.tar.* &> /dev/null ; then + _filetype="deb" + fi + + if [[ "${_filetype::1}" == 'z' ]] ; then + _package_zip + else + _package_deb + fi + + # script + \rm -rf "$pkgdir/usr/bin/mercury-browser" + install -Dm755 "$_pkgname.sh" "$pkgdir/usr/bin/$_pkgname" + + # icon + install -Dm644 "$pkgdir/opt/$_pkgname/browser/chrome/icons/default/default128.png" "$pkgdir/usr/share/pixmaps/$_pkgname.png" + + # .desktop + \rm -rf "$pkgdir/usr/share/applications/mercury-browser.desktop" + install -Dm644 "$_pkgname.desktop" "$pkgdir/usr/share/applications/$_pkgname.desktop" + + # symlink duplicate file + ln -sf "/usr/bin/$_pkgname" "$pkgdir/opt/$_pkgname/mercury-bin" + + # remove unnecessary folders + \rm -rf "$pkgdir/usr/lib/" + \rm -rf "$pkgdir/usr/share/doc/" + \rm -rf "$pkgdir/usr/share/icons" + \rm -rf "$pkgdir/usr/share/lintian/" + \rm -rf "$pkgdir/usr/share/man/" + + # fix permissions + chmod -R u+rwX,go+rX,go-w "$pkgdir/" +} + +_package_deb() { + # extract archive + bsdtar -xf "$_dl_filename" data.tar.* + bsdtar -xf data.tar.gz -C "$pkgdir/" + rm data.tar.gz + + # move files from /lib to /opt + install -dm755 "$pkgdir/opt/$_pkgname" + mv "$pkgdir/usr/lib/mercury"/* "$pkgdir/opt/$_pkgname/" +} + +_package_zip() { + local _depth=$( + bsdtar -tf "$_dl_filename" -- */mercury/mercury$ \ + | tr -cd '/' | wc -c + ) + + # extract archive + install -dm755 "$pkgdir/opt/$_pkgname" + bsdtar --strip-components="$_depth" -C "$pkgdir/opt/$_pkgname/" -xf "$_dl_filename" '*/mercury/*' +} + +# update version +_update_version() { + : ${_pkgver:=${pkgver%%.r*}} + + if [[ "${_autoupdate::1}" != "t" ]] ; then + return + fi + + local _blacklist _response _tags _tag _pkgver_new + + _blacklist=( + "v.121.0.2" # windows only + ) + _response=$(curl -Ssf "$url/releases.atom") + _tags=$( + printf '%s' "$_response" \ + | grep '/releases/tag/' \ + | sed -E 's@^.*/releases/tag/(.*)".*$@\1@' \ + | grep -Ev '[a-z]{2}' + ) + for i in "${_blacklist[@]}" ; do + _tags=${_tags/$i} + done + _tag=$(printf '%s' "$_tags" | sort -rV | head -1) + _pkgver_new="${_tag#v.}" + + # update _pkgver + if [ "$_pkgver" != "${_pkgver_new:?}" ] ; then + _pkgver="${_pkgver_new:?}" + fi +} + +# execute +_main_package diff --git a/PKGBUILD.avx2 b/PKGBUILD.avx2 new file mode 100644 index 000000000000..be2a8b969739 --- /dev/null +++ b/PKGBUILD.avx2 @@ -0,0 +1,237 @@ +# Maintainer: + +# options +if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then + : ${_autoupdate:=false} +else + : ${_autoupdate:=true} +fi + +: ${_pkgtype:=-bin} + +# basic info +_pkgname="mercury-browser-avx2" +pkgname="$_pkgname${_pkgtype:-}" +pkgver=122.0.2 +pkgrel=1 +pkgdesc="Compiler optimized, private Firefox fork" +url="https://github.com/Alex313031/Mercury" +license=('MPL-2.0') +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' + ) + + options=('!emptydirs' '!strip') + + : ${_dl_filename:=${_pkgname%-avx2}_${_pkgver:?}_AVX2.deb} + : ${_dl_url:=$url/releases/download/v.$_pkgver/$_dl_filename} + + noextract+=("$_dl_filename") + source=("$_dl_filename"::"$_dl_url") + sha256sums=('SKIP') +} + +# common functions +pkgver() { + echo "${_pkgver:?}" +} + +prepare() { + # desktop + install -Dvm644 /dev/stdin "$_pkgname.desktop" <<END +[Desktop Entry] +Version=1.0 +Name=Mercury +Comment=Browse the World Wide Web +GenericName=Web Browser +Keywords=Internet;WWW;Browser;Web;Explorer;Mercury +Exec=$_pkgname %u +StartupWMClass=mercury-default +Terminal=false +X-MultipleArgs=true +Type=Application +Icon=$_pkgname +Categories=GNOME;GTK;Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall; +StartupNotify=true +Actions=NewWindow;NewPrivateWindow;TempUserDir; + +[Desktop Action NewWindow] +Name=New Window +Exec=$_pkgname -new-window + +[Desktop Action NewPrivateWindow] +Name=New Private Window +Exec=$_pkgname -private-window + +[Desktop Action TempUserDir] +Name=Open With Temporary User Profile +Exec=$_pkgname --temp-profile +END + + install -Dvm644 /dev/stdin "$_pkgname.sh" <<END +#!/usr/bin/env bash + +# check microprocessor architecture level +if grep -qE '\bavx2\b' /proc/cpuinfo ; then + _message='' + _message+=\$'The fastest Firefox fork on Earth.' +else + _message='' + _message+=\$'Your processor does not support AVX2 instructions.\n' + _message+=\$'mercury-browser may not work on your computer.' +fi + +# Allow users to override command-line options +XDG_CONFIG_HOME=\${XDG_CONFIG_HOME:-~/.config} +_FLAGFILE="\$XDG_CONFIG_HOME/mercury-flags.conf" +if [[ -f "\$_FLAGFILE" ]]; then + _USER_FLAGS=\$(cat "\$_FLAGFILE") +fi + +# display processor support message +if tty -s ; then + echo "\$_message" +else + [ ! -e "\$HOME/.mercury" ] && notify-send -a "mercury-browser" -t 7500 "\$_message" +fi + +# Launch +exec /opt/$_pkgname/mercury \$_USER_FLAGS "\$@" +END +} + +package() { + provides=("$_pkgname=${pkgver%%.r*}") + conflicts=("$_pkgname") + + depends+=( + 'alsa-lib' + 'dbus-glib' + 'gtk3' + 'libnotify' # notify-send + + ## implicit + #at-spi2-core + #cairo + #dbus + #fontconfig + #freetype2 + #gcc-libs + #gdk-pixbuf2 + #glib2 + #glibc + #libx11 + #libxcb + #libxcomposite + #libxcursor + #libxdamage + #libxext + #libxfixes + #libxi + #libxrandr + #libxrender + #pango + ) + + local _filetype="zip" + if bsdtar -xf "$_dl_filename" -- data.tar.* &> /dev/null ; then + _filetype="deb" + fi + + if [[ "${_filetype::1}" == 'z' ]] ; then + _package_zip + else + _package_deb + fi + + # script + \rm -rf "$pkgdir/usr/bin/mercury-browser" + install -Dm755 "$_pkgname.sh" "$pkgdir/usr/bin/$_pkgname" + + # icon + install -Dm644 "$pkgdir/opt/$_pkgname/browser/chrome/icons/default/default128.png" "$pkgdir/usr/share/pixmaps/$_pkgname.png" + + # .desktop + \rm -rf "$pkgdir/usr/share/applications/mercury-browser.desktop" + install -Dm644 "$_pkgname.desktop" "$pkgdir/usr/share/applications/$_pkgname.desktop" + + # symlink duplicate file + ln -sf "/usr/bin/$_pkgname" "$pkgdir/opt/$_pkgname/mercury-bin" + + # remove unnecessary folders + \rm -rf "$pkgdir/usr/lib/" + \rm -rf "$pkgdir/usr/share/doc/" + \rm -rf "$pkgdir/usr/share/icons" + \rm -rf "$pkgdir/usr/share/lintian/" + \rm -rf "$pkgdir/usr/share/man/" + + # fix permissions + chmod -R u+rwX,go+rX,go-w "$pkgdir/" +} + +_package_deb() { + # extract archive + bsdtar -xf "$_dl_filename" data.tar.* + bsdtar -xf data.tar.gz -C "$pkgdir/" + rm data.tar.gz + + # move files from /lib to /opt + install -dm755 "$pkgdir/opt/$_pkgname" + mv "$pkgdir/usr/lib/mercury"/* "$pkgdir/opt/$_pkgname/" +} + +_package_zip() { + local _depth=$( + bsdtar -tf "$_dl_filename" -- */mercury/mercury$ \ + | tr -cd '/' | wc -c + ) + + # extract archive + install -dm755 "$pkgdir/opt/$_pkgname" + bsdtar --strip-components="$_depth" -C "$pkgdir/opt/$_pkgname/" -xf "$_dl_filename" '*/mercury/*' +} + +# update version +_update_version() { + : ${_pkgver:=${pkgver%%.r*}} + + if [[ "${_autoupdate::1}" != "t" ]] ; then + return + fi + + local _blacklist _response _tags _tag _pkgver_new + + _blacklist=( + "v.121.0.2" # windows only + ) + _response=$(curl -Ssf "$url/releases.atom") + _tags=$( + printf '%s' "$_response" \ + | grep '/releases/tag/' \ + | sed -E 's@^.*/releases/tag/(.*)".*$@\1@' \ + | grep -Ev '[a-z]{2}' + ) + for i in "${_blacklist[@]}" ; do + _tags=${_tags/$i} + done + _tag=$(printf '%s' "$_tags" | sort -rV | head -1) + _pkgver_new="${_tag#v.}" + + # update _pkgver + if [ "$_pkgver" != "${_pkgver_new:?}" ] ; then + _pkgver="${_pkgver_new:?}" + fi +} + +# execute +_main_package diff --git a/PKGBUILD.sse3 b/PKGBUILD.sse3 new file mode 100644 index 000000000000..44125f99c583 --- /dev/null +++ b/PKGBUILD.sse3 @@ -0,0 +1,237 @@ +# Maintainer: + +# options +if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then + : ${_autoupdate:=false} +else + : ${_autoupdate:=true} +fi + +: ${_pkgtype:=-bin} + +# basic info +_pkgname="mercury-browser-sse3" +pkgname="$_pkgname${_pkgtype:-}" +pkgver=122.0.2 +pkgrel=1 +pkgdesc="Compiler optimized, private Firefox fork" +url="https://github.com/Alex313031/Mercury" +license=('MPL-2.0') +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' + ) + + options=('!emptydirs' '!strip') + + : ${_dl_filename:=${_pkgname%-sse3}_${_pkgver:?}_SSE3.deb} + : ${_dl_url:=$url/releases/download/v.$_pkgver/$_dl_filename} + + noextract+=("$_dl_filename") + source=("$_dl_filename"::"$_dl_url") + sha256sums=('SKIP') +} + +# common functions +pkgver() { + echo "${_pkgver:?}" +} + +prepare() { + # desktop + install -Dvm644 /dev/stdin "$_pkgname.desktop" <<END +[Desktop Entry] +Version=1.0 +Name=Mercury +Comment=Browse the World Wide Web +GenericName=Web Browser +Keywords=Internet;WWW;Browser;Web;Explorer;Mercury +Exec=$_pkgname %u +StartupWMClass=mercury-default +Terminal=false +X-MultipleArgs=true +Type=Application +Icon=$_pkgname +Categories=GNOME;GTK;Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall; +StartupNotify=true +Actions=NewWindow;NewPrivateWindow;TempUserDir; + +[Desktop Action NewWindow] +Name=New Window +Exec=$_pkgname -new-window + +[Desktop Action NewPrivateWindow] +Name=New Private Window +Exec=$_pkgname -private-window + +[Desktop Action TempUserDir] +Name=Open With Temporary User Profile +Exec=$_pkgname --temp-profile +END + + install -Dvm644 /dev/stdin "$_pkgname.sh" <<END +#!/usr/bin/env bash + +# check microprocessor architecture level +if grep -qE '\bpni\b' /proc/cpuinfo ; then + _message='' + _message+=\$'The fastest Firefox fork on Earth.' +else + _message='' + _message+=\$'Your processor does not support SSE3 instructions.\n' + _message+=\$'mercury-browser may not work on your computer.' +fi + +# Allow users to override command-line options +XDG_CONFIG_HOME=\${XDG_CONFIG_HOME:-~/.config} +_FLAGFILE="\$XDG_CONFIG_HOME/mercury-flags.conf" +if [[ -f "\$_FLAGFILE" ]]; then + _USER_FLAGS=\$(cat "\$_FLAGFILE") +fi + +# display processor support message +if tty -s ; then + echo "\$_message" +else + [ ! -e "\$HOME/.mercury" ] && notify-send -a "mercury-browser" -t 7500 "\$_message" +fi + +# Launch +exec /opt/$_pkgname/mercury \$_USER_FLAGS "\$@" +END +} + +package() { + provides=("$_pkgname=${pkgver%%.r*}") + conflicts=("$_pkgname") + + depends+=( + 'alsa-lib' + 'dbus-glib' + 'gtk3' + 'libnotify' # notify-send + + ## implicit + #at-spi2-core + #cairo + #dbus + #fontconfig + #freetype2 + #gcc-libs + #gdk-pixbuf2 + #glib2 + #glibc + #libx11 + #libxcb + #libxcomposite + #libxcursor + #libxdamage + #libxext + #libxfixes + #libxi + #libxrandr + #libxrender + #pango + ) + + local _filetype="zip" + if bsdtar -xf "$_dl_filename" -- data.tar.* &> /dev/null ; then + _filetype="deb" + fi + + if [[ "${_filetype::1}" == 'z' ]] ; then + _package_zip + else + _package_deb + fi + + # script + \rm -rf "$pkgdir/usr/bin/mercury-browser" + install -Dm755 "$_pkgname.sh" "$pkgdir/usr/bin/$_pkgname" + + # icon + install -Dm644 "$pkgdir/opt/$_pkgname/browser/chrome/icons/default/default128.png" "$pkgdir/usr/share/pixmaps/$_pkgname.png" + + # .desktop + \rm -rf "$pkgdir/usr/share/applications/mercury-browser.desktop" + install -Dm644 "$_pkgname.desktop" "$pkgdir/usr/share/applications/$_pkgname.desktop" + + # symlink duplicate file + ln -sf "/usr/bin/$_pkgname" "$pkgdir/opt/$_pkgname/mercury-bin" + + # remove unnecessary folders + \rm -rf "$pkgdir/usr/lib/" + \rm -rf "$pkgdir/usr/share/doc/" + \rm -rf "$pkgdir/usr/share/icons" + \rm -rf "$pkgdir/usr/share/lintian/" + \rm -rf "$pkgdir/usr/share/man/" + + # fix permissions + chmod -R u+rwX,go+rX,go-w "$pkgdir/" +} + +_package_deb() { + # extract archive + bsdtar -xf "$_dl_filename" data.tar.* + bsdtar -xf data.tar.gz -C "$pkgdir/" + rm data.tar.gz + + # move files from /lib to /opt + install -dm755 "$pkgdir/opt/$_pkgname" + mv "$pkgdir/usr/lib/mercury"/* "$pkgdir/opt/$_pkgname/" +} + +_package_zip() { + local _depth=$( + bsdtar -tf "$_dl_filename" -- */mercury/mercury$ \ + | tr -cd '/' | wc -c + ) + + # extract archive + install -dm755 "$pkgdir/opt/$_pkgname" + bsdtar --strip-components="$_depth" -C "$pkgdir/opt/$_pkgname/" -xf "$_dl_filename" '*/mercury/*' +} + +# update version +_update_version() { + : ${_pkgver:=${pkgver%%.r*}} + + if [[ "${_autoupdate::1}" != "t" ]] ; then + return + fi + + local _blacklist _response _tags _tag _pkgver_new + + _blacklist=( + "v.121.0.2" # windows only + ) + _response=$(curl -Ssf "$url/releases.atom") + _tags=$( + printf '%s' "$_response" \ + | grep '/releases/tag/' \ + | sed -E 's@^.*/releases/tag/(.*)".*$@\1@' \ + | grep -Ev '[a-z]{2}' + ) + for i in "${_blacklist[@]}" ; do + _tags=${_tags/$i} + done + _tag=$(printf '%s' "$_tags" | sort -rV | head -1) + _pkgver_new="${_tag#v.}" + + # update _pkgver + if [ "$_pkgver" != "${_pkgver_new:?}" ] ; then + _pkgver="${_pkgver_new:?}" + fi +} + +# execute +_main_package diff --git a/PKGBUILD.sse4 b/PKGBUILD.sse4 new file mode 100644 index 000000000000..bb486cc0b31b --- /dev/null +++ b/PKGBUILD.sse4 @@ -0,0 +1,237 @@ +# Maintainer: + +# options +if [ -n "$_srcinfo" ] || [ -n "$_pkgver" ] ; then + : ${_autoupdate:=false} +else + : ${_autoupdate:=true} +fi + +: ${_pkgtype:=-bin} + +# basic info +_pkgname="mercury-browser-sse4" +pkgname="$_pkgname${_pkgtype:-}" +pkgver=122.0.2 +pkgrel=1 +pkgdesc="Compiler optimized, private Firefox fork" +url="https://github.com/Alex313031/Mercury" +license=('MPL-2.0') +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' + ) + + options=('!emptydirs' '!strip') + + : ${_dl_filename:=${_pkgname%-sse4}_${_pkgver:?}_SSE4.deb} + : ${_dl_url:=$url/releases/download/v.$_pkgver/$_dl_filename} + + noextract+=("$_dl_filename") + source=("$_dl_filename"::"$_dl_url") + sha256sums=('SKIP') +} + +# common functions +pkgver() { + echo "${_pkgver:?}" +} + +prepare() { + # desktop + install -Dvm644 /dev/stdin "$_pkgname.desktop" <<END +[Desktop Entry] +Version=1.0 +Name=Mercury +Comment=Browse the World Wide Web +GenericName=Web Browser +Keywords=Internet;WWW;Browser;Web;Explorer;Mercury +Exec=$_pkgname %u +StartupWMClass=mercury-default +Terminal=false +X-MultipleArgs=true +Type=Application +Icon=$_pkgname +Categories=GNOME;GTK;Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall; +StartupNotify=true +Actions=NewWindow;NewPrivateWindow;TempUserDir; + +[Desktop Action NewWindow] +Name=New Window +Exec=$_pkgname -new-window + +[Desktop Action NewPrivateWindow] +Name=New Private Window +Exec=$_pkgname -private-window + +[Desktop Action TempUserDir] +Name=Open With Temporary User Profile +Exec=$_pkgname --temp-profile +END + + install -Dvm644 /dev/stdin "$_pkgname.sh" <<END +#!/usr/bin/env bash + +# check microprocessor architecture level +if grep -qE '\bsse4_[0-9]\b' /proc/cpuinfo ; then + _message='' + _message+=\$'The fastest Firefox fork on Earth.' +else + _message='' + _message+=\$'Your processor does not support SSE4 instructions.\n' + _message+=\$'mercury-browser may not work on your computer.' +fi + +# Allow users to override command-line options +XDG_CONFIG_HOME=\${XDG_CONFIG_HOME:-~/.config} +_FLAGFILE="\$XDG_CONFIG_HOME/mercury-flags.conf" +if [[ -f "\$_FLAGFILE" ]]; then + _USER_FLAGS=\$(cat "\$_FLAGFILE") +fi + +# display processor support message +if tty -s ; then + echo "\$_message" +else + [ ! -e "\$HOME/.mercury" ] && notify-send -a "mercury-browser" -t 7500 "\$_message" +fi + +# Launch +exec /opt/$_pkgname/mercury \$_USER_FLAGS "\$@" +END +} + +package() { + provides=("$_pkgname=${pkgver%%.r*}") + conflicts=("$_pkgname") + + depends+=( + 'alsa-lib' + 'dbus-glib' + 'gtk3' + 'libnotify' # notify-send + + ## implicit + #at-spi2-core + #cairo + #dbus + #fontconfig + #freetype2 + #gcc-libs + #gdk-pixbuf2 + #glib2 + #glibc + #libx11 + #libxcb + #libxcomposite + #libxcursor + #libxdamage + #libxext + #libxfixes + #libxi + #libxrandr + #libxrender + #pango + ) + + local _filetype="zip" + if bsdtar -xf "$_dl_filename" -- data.tar.* &> /dev/null ; then + _filetype="deb" + fi + + if [[ "${_filetype::1}" == 'z' ]] ; then + _package_zip + else + _package_deb + fi + + # script + \rm -rf "$pkgdir/usr/bin/mercury-browser" + install -Dm755 "$_pkgname.sh" "$pkgdir/usr/bin/$_pkgname" + + # icon + install -Dm644 "$pkgdir/opt/$_pkgname/browser/chrome/icons/default/default128.png" "$pkgdir/usr/share/pixmaps/$_pkgname.png" + + # .desktop + \rm -rf "$pkgdir/usr/share/applications/mercury-browser.desktop" + install -Dm644 "$_pkgname.desktop" "$pkgdir/usr/share/applications/$_pkgname.desktop" + + # symlink duplicate file + ln -sf "/usr/bin/$_pkgname" "$pkgdir/opt/$_pkgname/mercury-bin" + + # remove unnecessary folders + \rm -rf "$pkgdir/usr/lib/" + \rm -rf "$pkgdir/usr/share/doc/" + \rm -rf "$pkgdir/usr/share/icons" + \rm -rf "$pkgdir/usr/share/lintian/" + \rm -rf "$pkgdir/usr/share/man/" + + # fix permissions + chmod -R u+rwX,go+rX,go-w "$pkgdir/" +} + +_package_deb() { + # extract archive + bsdtar -xf "$_dl_filename" data.tar.* + bsdtar -xf data.tar.gz -C "$pkgdir/" + rm data.tar.gz + + # move files from /lib to /opt + install -dm755 "$pkgdir/opt/$_pkgname" + mv "$pkgdir/usr/lib/mercury"/* "$pkgdir/opt/$_pkgname/" +} + +_package_zip() { + local _depth=$( + bsdtar -tf "$_dl_filename" -- */mercury/mercury$ \ + | tr -cd '/' | wc -c + ) + + # extract archive + install -dm755 "$pkgdir/opt/$_pkgname" + bsdtar --strip-components="$_depth" -C "$pkgdir/opt/$_pkgname/" -xf "$_dl_filename" '*/mercury/*' +} + +# update version +_update_version() { + : ${_pkgver:=${pkgver%%.r*}} + + if [[ "${_autoupdate::1}" != "t" ]] ; then + return + fi + + local _blacklist _response _tags _tag _pkgver_new + + _blacklist=( + "v.121.0.2" # windows only + ) + _response=$(curl -Ssf "$url/releases.atom") + _tags=$( + printf '%s' "$_response" \ + | grep '/releases/tag/' \ + | sed -E 's@^.*/releases/tag/(.*)".*$@\1@' \ + | grep -Ev '[a-z]{2}' + ) + for i in "${_blacklist[@]}" ; do + _tags=${_tags/$i} + done + _tag=$(printf '%s' "$_tags" | sort -rV | head -1) + _pkgver_new="${_tag#v.}" + + # update _pkgver + if [ "$_pkgver" != "${_pkgver_new:?}" ] ; then + _pkgver="${_pkgver_new:?}" + fi +} + +# execute +_main_package |