slackbuilds

Personal Slackbuilds in the style of slackbuilds.org
git clone git://git.danielmoch.com/slackbuilds.git
Log | Files | Refs

commit 389dc337610e79775708beefacd1b141c4a386d0
parent 880444bddbcc621c2a8d467c92adda7fcff3cd08
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Mon, 27 Jan 2020 06:16:08 -0500

Add surf

Diffstat:
Asurf/README | 9+++++++++
Asurf/config.h | 201+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asurf/doinst.sh | 3+++
Asurf/slack-desc | 19+++++++++++++++++++
Asurf/surf.SlackBuild | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asurf/surf.desktop | 10++++++++++
Asurf/surf.info | 10++++++++++
7 files changed, 355 insertions(+), 0 deletions(-)

diff --git a/surf/README b/surf/README @@ -0,0 +1,9 @@ +surf (minimalist web browser) + +surf is a simple web browser based on WebKit/GTK+. It is able to display +websites and follow links. It supports the XEmbed protocol which makes +it possible to embed it in another application. Furthermore, one can +point surf to another URI by setting its XProperties. + +This build has many options controlled by environment variables. See +options.txt for full details. diff --git a/surf/config.h b/surf/config.h @@ -0,0 +1,201 @@ +/* modifier 0 means no modifier */ +static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */ +static char *fulluseragent = ""; /* Or override the whole user agent string */ +static char *scriptfile = "~/etc/surf/script.js"; +static char *styledir = "~/etc/surf/styles/"; +static char *cachedir = "~/etc/surf/cache/"; +static char *cookiefile = "~/etc/surf/cookies.txt"; + +/* Webkit default features */ +static Parameter defconfig[ParameterLast] = { + SETB(AcceleratedCanvas, 1), + SETB(CaretBrowsing, 0), + SETV(CookiePolicies, "@Aa"), + SETB(DiskCache, 1), + SETB(DNSPrefetch, 0), + SETI(FontSize, 14), + SETB(FrameFlattening, 0), + SETB(Geolocation, 0), + SETB(HideBackground, 0), + SETB(Inspector, 0), + SETB(JavaScript, 0), + SETB(KioskMode, 0), + SETB(LoadImages, 1), + SETB(MediaManualPlay, 0), + SETB(Plugins, 1), + SETV(PreferredLanguages, ((char *[]){ NULL })), + SETB(RunInFullscreen, 0), + SETB(ScrollBars, 1), + SETB(ShowIndicators, 1), + SETB(SiteQuirks, 1), + SETB(SpellChecking, 0), + SETV(SpellLanguages, ((char *[]){ "en_US", NULL })), + SETB(StrictSSL, 0), + SETB(Style, 1), + SETF(ZoomLevel, 1.9), +}; + +static UriParameters uriparams[] = { + { "(://|\\.)archlinux\\.org(/|$)", { FSETB(JavaScript, 1), }, }, + { "(://|\\.)djmoch\\.org(/|$)", { FSETB(JavaScript, 1), }, }, + { "(://|\\.)danielmoch\\.com(/|$)", { FSETB(JavaScript, 1), }, }, + { "(://|\\.)twitter\\.com(/|$)", { FSETB(JavaScript, 1), }, }, + { "(://|\\.)github\\.com(/|$)", { FSETB(JavaScript, 1), }, }, + { ".*", { FSETB(JavaScript, 0), }, }, +}; + +static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE | + WEBKIT_FIND_OPTIONS_WRAP_AROUND; + +#define SETPROP(p, q) { \ + .v = (const char *[]){ "/bin/sh", "-c", \ + "prop=\"`xprop -id $2 $0 " \ + "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \ + "| xargs -0 printf %b | dmenu -fn \"sans:size=9\" -nb \"#3A3A3A\" " \ + "-nf \"#FFFFFF\" -sb \"#BCBCBC\" -sf \"#000000\"`\" &&" \ + "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \ + p, q, winid, NULL \ + } \ +} + +#define SEARCH(p, q) { \ + .v = (const char *[]){ "/bin/sh", "-c", \ + "prop=\"https://duckduckgo.com/html?q=`dmenu -p \"Search DuckDuckGo\" " \ + "-fn \"sans:size=9\" -nb \"#3A3A3A\" " \ + "-nf \"#FFFFFF\" -sb \"#BCBCBC\" -sf \"#000000\"`\" &&" \ + "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \ + p, q, winid, NULL \ + } \ +} + +#define BMARK(p, q) { \ + .v = (const char *[]){ "/bin/sh", "-c", \ + "prop=\"`cat ~/etc/surf/bookmarks " \ + "| dmenu -fn \"sans:size=9\" -nb \"#3A3A3A\" " \ + "-nf \"#FFFFFF\" -sb \"#BCBCBC\" -sf \"#000000\"`\" &&" \ + "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \ + p, q, winid, NULL \ + } \ +} + +#define BMARKSAVE(p, q) { \ + .v = (const char *[]){ "/bin/sh", "-c", \ + "prop=\"`xprop -id $2 $0 " \ + "| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \ + "| xargs printf %b\n`\" && echo \"$prop\" >> ~/etc/surf/bookmarks", \ + p, q, winid, NULL \ + } \ +} + +/* DOWNLOAD(URI, referer) */ +#define DOWNLOAD(d, r) { \ + .v = (const char *[]){ "/bin/sh", "-c", \ + "my term -e /bin/sh -c \"cd ~/dl; curl -g -L -J -O " \ + "--user-agent '$1' --referer '$2' -b $3 -c $3 '$0';" \ + " sleep 5;\"", \ + d, useragent, r, cookiefile, NULL \ + } \ +} + +/* PLUMB(URI) */ +/* This called when some URI which does not begin with "about:", + * "http://" or "https://" should be opened. + */ +#define PLUMB(u) {\ + .v = (const char *[]){ "/bin/sh", "-c", \ + "xdg-open \"$0\"", u, NULL \ + } \ +} + +/* VIDEOPLAY(URI) */ +#define VIDEOPLAY(u) {\ + .v = (const char *[]){ "/bin/sh", "-c", \ + "mplayer --really-quiet \"$0\"", u, NULL \ + } \ +} + +/* styles */ +/* + * The iteration will stop at the first match, beginning at the beginning of + * the list. + */ +static SiteStyle styles[] = { + /* regexp file in $styledir */ + { ".*", "default.css" }, +}; + +#define MODKEY GDK_CONTROL_MASK + +/* hotkeys */ +/* + * If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to + * edit the CLEANMASK() macro. + */ +static Key keys[] = { + /* modifier keyval function arg */ + { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") }, + { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") }, + { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") }, + { MODKEY, GDK_KEY_s, spawn, SEARCH("_SURF_URI", "_SURF_GO") }, + { MODKEY, GDK_KEY_d, spawn, BMARK("_SURF_URI", "_SURF_GO") }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_d, spawn, BMARKSAVE("_SURF_URI", "_SURF_GO") }, + + { 0, GDK_KEY_Escape, stop, { 0 } }, + { MODKEY, GDK_KEY_c, stop, { 0 } }, + + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .b = 1 } }, + { MODKEY, GDK_KEY_r, reload, { .b = 0 } }, + + { MODKEY, GDK_KEY_l, navigate, { .i = +1 } }, + { MODKEY, GDK_KEY_h, navigate, { .i = -1 } }, + + /* Currently we have to use scrolling steps that WebKit2GTK+ gives us + * d: step down, u: step up, r: step right, l:step left + * D: page down, U: page up */ + { MODKEY, GDK_KEY_j, scroll, { .i = 'd' } }, + { MODKEY, GDK_KEY_k, scroll, { .i = 'u' } }, + { MODKEY, GDK_KEY_b, scroll, { .i = 'U' } }, + { MODKEY, GDK_KEY_space, scroll, { .i = 'D' } }, + { MODKEY, GDK_KEY_i, scroll, { .i = 'r' } }, + { MODKEY, GDK_KEY_u, scroll, { .i = 'l' } }, + + + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } }, + { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } }, + { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } }, + + { MODKEY, GDK_KEY_p, clipboard, { .b = 1 } }, + { MODKEY, GDK_KEY_y, clipboard, { .b = 0 } }, + + { MODKEY, GDK_KEY_n, find, { .i = +1 } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } }, + + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } }, + + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } }, + { 0, GDK_KEY_F11, togglefullscreen, { 0 } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } }, + + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } }, + { MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } }, +}; + +/* button definitions */ +/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */ +static Button buttons[] = { + /* target event mask button function argument stop event */ + { OnLink, 0, 2, clicknewwindow, { .b = 0 }, 1 }, + { OnLink, MODKEY, 2, clicknewwindow, { .b = 1 }, 1 }, + { OnLink, MODKEY, 1, clicknewwindow, { .b = 1 }, 1 }, + { OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 }, + { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 }, + { OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 }, +}; diff --git a/surf/doinst.sh b/surf/doinst.sh @@ -0,0 +1,3 @@ +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi diff --git a/surf/slack-desc b/surf/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +surf: surf (minimalist web browser) +surf: +surf: surf is a simple web browser based on WebKit/GTK+. It is +surf: able to display websites and follow links. It supports the +surf: XEmbed protocol which makes it possible to embed it in another +surf: application. Furthermore, one can point surf to another URI by setting +surf: its XProperties. +surf: +surf: +surf: +surf: diff --git a/surf/surf.SlackBuild b/surf/surf.SlackBuild @@ -0,0 +1,103 @@ +#!/bin/sh + +# Slackware build script for surf + +# Written by B. Watson (yalhcru@gmail.com) +# Modified by Daniel Moch <daniel@danielmoch.com> + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# 20170625 bkw: +# - updated for v2.0 (webkit2gtk now required). +# - re-work searchengines.diff and homepage.diff for v2.0. +# - remove "sw" search from searchengines.diff, since packages.slackware.eu +# no longer exists. Before you ask, no, I can't replace it with the official +# search at packages.slackware.com, because searchengines.diff only does +# HTTP GET requests. Find me a working Slackware package search that doesn't +# require a POST request, and I'll add it to searchengines.diff. + +# 20170121 bkw: +# - updated for v0.7. +# - remove patches/startfullscreen.diff as it's integrated into 0.7 +# - update homepage.diff and searchengines.diff for 0.7 + +PRGNAM=surf +VERSION=${VERSION:-2.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_djmoch} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/djmoch} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Customization. + +cp $CWD/config.h . + +sed -i \ + -e 's,/usr/local,/usr,g' \ + -e "s,\<lib\>,lib$LIBDIRSUFFIX,g" \ + -e 's,share/man,man,g' \ + -e "s,-Os,$SLKCFLAGS," \ + config.mk + +make +strip $PRGNAM +make install DESTDIR=$PKG +gzip -9 $PKG/usr/man/man?/*.? + +mkdir -p $PKG/usr/share/pixmaps +cat $PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png + +# .desktop written for this SlackBuild +mkdir -p $PKG/usr/share/applications +cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE README TODO.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/surf/surf.desktop b/surf/surf.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Surf +Comment=A minimalistic web browser +Exec=surf +Terminal=false +Icon=surf +Categories=Network; +MimeType=text/html; diff --git a/surf/surf.info b/surf/surf.info @@ -0,0 +1,10 @@ +PRGNAM="surf" +VERSION="2.0" +HOMEPAGE="https://surf.suckless.org/" +DOWNLOAD="https://dl.suckless.org/surf/surf-2.0.tar.gz" +MD5SUM="11713901fa83c536f3ddfacfc28c3acc" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="webkit2gtk dmenu" +MAINTAINER="Daniel Moch" +EMAIL="daniel@danielmoch.com"