diff --git a/assets/dev.nacre.Nacre.desktop b/assets/dev.nacre.Nacre.desktop new file mode 100644 index 0000000..4e57333 --- /dev/null +++ b/assets/dev.nacre.Nacre.desktop @@ -0,0 +1,20 @@ +[Desktop Entry] +Type=Application +Name=Nacre +GenericName=Web Browser +Comment=Browse the web +Exec=nacre %U +Icon=dev.nacre.Nacre +Terminal=false +Categories=Network;WebBrowser; +MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https; +StartupWMClass=dev.nacre.Nacre +Actions=new-window;new-private-window; + +[Desktop Action new-window] +Name=New window +Exec=nacre --new-window + +[Desktop Action new-private-window] +Name=New Incognito window +Exec=nacre --incognito diff --git a/assets/dev.nacre.Nacre.svg b/assets/dev.nacre.Nacre.svg new file mode 100644 index 0000000..f6bad34 --- /dev/null +++ b/assets/dev.nacre.Nacre.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..35e879a --- /dev/null +++ b/install.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Build Nacre from this checkout's last commit as an Arch package and install it with pacman, with every dependency. +# ./install.sh build and install (or update) +# ./install.sh --uninstall remove the package; your data in ~/.config and ~/.local/share stays +# The build runs in a temporary folder that is deleted at the end, and so is target/ (cargo's old build output): only +# the code stays here. +set -euo pipefail +root=$(cd "$(dirname "$0")" && pwd) +case "${1:-}" in + --uninstall) exec sudo pacman -Rs nacre ;; + "") ;; + *) sed -n '2,6s/^# \{0,1\}//p' "$0"; exit 2 ;; +esac +command -v makepkg >/dev/null || { echo "This installer needs Arch Linux (makepkg, base-devel)." >&2; exit 1; } +[ "$(id -u)" != 0 ] || { echo "Run it as your user; it asks for your password when it needs it." >&2; exit 1; } +[ -z "$(git -C "$root" status --porcelain --untracked-files=no)" ] || echo "Note: changes that aren't committed are left out." +work=$(mktemp -d "${XDG_CACHE_HOME:-$HOME/.cache}/nacre-build.XXXXXX") +trap 'rm -rf "$work"' EXIT +export NACRE_SRC="$root" BUILDDIR="$work/build" SRCDEST="$work" PKGDEST="$work" LOGDEST="$work" +cp "$root/packaging/arch/PKGBUILD" "$work/" +cd "$work" +makepkg -si --noconfirm --needed +[ ! -f "$root/target/CACHEDIR.TAG" ] || rm -rf "$root/target" +echo "Installed. Start it with: nacre" diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD new file mode 100644 index 0000000..dd0fc14 --- /dev/null +++ b/packaging/arch/PKGBUILD @@ -0,0 +1,40 @@ +# Arch package of Nacre, built from the last commit of this checkout. Use ../../install.sh, or makepkg -si here. +pkgname=nacre +pkgver=0.4.0 +pkgrel=1 +pkgdesc="A web browser built on WebKitGTK" +arch=(x86_64) +url="https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre" +license=(MPL-2.0) +depends=(webkitgtk-6.0 gtk4 gst-plugins-base gst-plugins-good gst-plugins-bad gst-libav dbus pam glibc libgcc libepoxy libsoup3 gstreamer hicolor-icon-theme xdg-utils) +makedepends=(cargo git pkgconf) +optdepends=('libnotify: desktop notifications' + 'xdg-desktop-portal: file pickers' + 'gnome-keyring: keeps the cookie key' + 'gst-plugin-pipewire: sound through PipeWire' + 'cava: music bars' + 'tor: Tor windows') +options=(!lto !debug) +# install.sh sets NACRE_SRC because it runs a copy of this file (makepkg rewrites pkgver in place). +source=("nacre::git+file://${NACRE_SRC:-$(git -C "${startdir:-.}" rev-parse --show-toplevel)}") +sha256sums=(SKIP) + +pkgver() { + cd nacre + printf '%s.r%s.g%s' "$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +build() { + cd nacre + export CARGO_TARGET_DIR="$srcdir/target" + nice cargo build --release --locked -j "${NACRE_JOBS:-2}" +} + +package() { + cd nacre + install -Dm755 "$srcdir/target/release/nacre" "$pkgdir/usr/bin/nacre" + install -Dm755 "$srcdir/target/release/libnacre_webext.so" "$pkgdir/usr/lib/nacre/libnacre_webext.so" + install -Dm644 -t "$pkgdir/usr/share/nacre/filters" assets/filters/*.txt + install -Dm644 assets/dev.nacre.Nacre.desktop "$pkgdir/usr/share/applications/dev.nacre.Nacre.desktop" + install -Dm644 assets/dev.nacre.Nacre.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/dev.nacre.Nacre.svg" +}