diff options
author | B. Watson <yalhcru@gmail.com> | 2013-07-06 09:40:41 -0400 |
---|---|---|
committer | Niels Horn <niels.horn@slackbuilds.org> | 2013-07-07 09:10:01 -0300 |
commit | 5339c6bc3120a25cda925327f8ad7ff828a31eaf (patch) | |
tree | 528c4cef0b8020136b88a3c64bfdf5075f91bf5e /network/surf | |
parent | 2fac39d6548219137b1df420bc00518378d1c4ce (diff) | |
download | slackbuilds-5339c6bc3120a25cda925327f8ad7ff828a31eaf.tar.gz |
network/surf: Added (minimalist web browser)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'network/surf')
-rw-r--r-- | network/surf/README | 9 | ||||
-rw-r--r-- | network/surf/doinst.sh | 3 | ||||
-rw-r--r-- | network/surf/options.txt | 38 | ||||
-rw-r--r-- | network/surf/patches.txt | 18 | ||||
-rw-r--r-- | network/surf/patches/homepage.diff | 15 | ||||
-rw-r--r-- | network/surf/patches/searchengines.diff | 69 | ||||
-rw-r--r-- | network/surf/patches/startfullscreen.diff | 70 | ||||
-rw-r--r-- | network/surf/slack-desc | 19 | ||||
-rw-r--r-- | network/surf/surf.SlackBuild | 160 | ||||
-rw-r--r-- | network/surf/surf.desktop | 10 | ||||
-rw-r--r-- | network/surf/surf.info | 10 |
11 files changed, 421 insertions, 0 deletions
diff --git a/network/surf/README b/network/surf/README new file mode 100644 index 0000000000..25ca44dca7 --- /dev/null +++ b/network/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/network/surf/doinst.sh b/network/surf/doinst.sh new file mode 100644 index 0000000000..5fb28930db --- /dev/null +++ b/network/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/network/surf/options.txt b/network/surf/options.txt new file mode 100644 index 0000000000..6069a9ebac --- /dev/null +++ b/network/surf/options.txt @@ -0,0 +1,38 @@ +surf is highly customizable, with many patches available. This build +automates some of the customizations, controlled by the following +environment variables: + +PATCH + Patch the source with patches/*.diff. Currently this includes the + homepage, searchengines, and startfullscreen patches, which are enabled + by default (see patches.txt for details). To build with no patches, + use "PATCH=no". + +TERMINAL + surf runs wget in a terminal when downloading files. This must be a + terminal emulator that supports the -e (execute command) option. Default + is "rxvt". Other candidates: urxvt, xterm, Terminal. + +HOMEPAGE + The URL to start the browser with, if no argument given on the command + line. Default is "https://duckduckgo.com/html/". Has no effect if + PATCH=no. + +WIDTH +HEIGHT + The default window size for surf to use, when it starts. Default values + are WIDTH=800 HEIGHT=600. + +SLACKVER + The version of Slackware you're building for. If not set, the version + from /etc/slackware-version will be used. You only need to set this + if building on Slackware-current (use SLACKVER=current). This is only + used for the searchengines patch, so it does nothing if PATCH=no. + +STRICTSSL + If STRICTSSL=yes, refuse untrusted connections (e.g. invalid/unknown + certificates). Default is no. + +The values of all these variables are stored within the package, in +/usr/doc/surf-$VERSION/buildopts.sh. You can build surf again with the +same options by sourcing buildopts.sh before running surf.SlackBuild. diff --git a/network/surf/patches.txt b/network/surf/patches.txt new file mode 100644 index 0000000000..4b0f9bae03 --- /dev/null +++ b/network/surf/patches.txt @@ -0,0 +1,18 @@ +The following (somewhat modified) patches from +http://surf.suckless.org/patches/ are included: + +searchengines - Allows simple use of various search engines. Each search +engine has a tag. To use, press ctrl+G, then e.g. "g foo bar" to search +google for foo and bar. Supported engines: + + d - duckduckgo.com + g - google.com + dict - search for a word on thefreedictionary.com + sb - search for packages on slackbuilds.org + sw - search for official slackware packages on search.slackware.eu + +homepage - The browser will start at your home page if called with no +arguments (normally it starts with a blank window). + +startfullscreen - Adds -f option to start the browser in fullscreen +mode. Can still use F11 to toggle fullscreen. diff --git a/network/surf/patches/homepage.diff b/network/surf/patches/homepage.diff new file mode 100644 index 0000000000..cd74dc18e9 --- /dev/null +++ b/network/surf/patches/homepage.diff @@ -0,0 +1,15 @@ +diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c +--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.c 2013-07-03 16:48:40.000000000 -0400 +@@ -1218,8 +1218,11 @@ + default: + usage(); + } ARGEND; ++#define HOMEPAGE "@HOMEPAGE@" + if(argc > 0) + arg.v = argv[0]; ++ else ++ arg.v = HOMEPAGE; + + setup(); + newclient(); diff --git a/network/surf/patches/searchengines.diff b/network/surf/patches/searchengines.diff new file mode 100644 index 0000000000..97aa6a4922 --- /dev/null +++ b/network/surf/patches/searchengines.diff @@ -0,0 +1,69 @@ +diff -Naur surf-0.6/config.def.h surf-0.6.patched/config.def.h +--- surf-0.6/config.def.h 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/config.def.h 2013-07-03 16:40:14.000000000 -0400 +@@ -93,3 +93,10 @@ + { MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } }, + }; + ++static SearchEngine searchengines[] = { ++ { "d", "https://duckduckgo.com/html/?q=%s" }, ++ { "g", "https://www.google.com/search?q=%s" }, ++ { "dict", "http://www.thefreedictionary.com/%s" }, ++ { "sb", "http://slackbuilds.org/result/?search=%s&sv=@SLACKVER@" }, ++ { "sw", "http://search.slackware.eu/cgi-bin/search.cgi?rm=search&needle=%s&haystack=2&sver=@SVER@&button-search=Search" }, ++}; +diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c +--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.c 2013-07-03 15:25:44.000000000 -0400 +@@ -76,6 +76,11 @@ + + G_DEFINE_TYPE(CookieJar, cookiejar, SOUP_TYPE_COOKIE_JAR_TEXT) + ++typedef struct { ++ char *token; ++ char *uri; ++} SearchEngine; ++ + static Display *dpy; + static Atom atoms[AtomLast]; + static Client *clients = NULL; +@@ -139,6 +144,7 @@ + static void navigate(Client *c, const Arg *arg); + static Client *newclient(void); + static void newwindow(Client *c, const Arg *arg, gboolean noembed); ++static gchar *parseuri(const gchar *uri); + static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); + static void populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c); + static void popupactivate(GtkMenuItem *menu, Client *); +@@ -627,8 +633,8 @@ + u = g_strdup_printf("file://%s", rp); + free(rp); + } else { +- u = g_strrstr(uri, "://") ? g_strdup(uri) +- : g_strdup_printf("http://%s", uri); ++ u = parseuri(uri); ++ + } + + /* prevents endless loop */ +@@ -893,6 +899,20 @@ + } + } + ++gchar * ++parseuri(const gchar *uri) { ++ guint i; ++ ++ for (i = 0; i < LENGTH(searchengines); i++) { ++ if (searchengines[i].token == NULL || searchengines[i].uri == NULL || *(uri + strlen(searchengines[i].token)) != ' ') ++ continue; ++ if (g_str_has_prefix(uri, searchengines[i].token)) ++ return g_strdup_printf(searchengines[i].uri, uri + strlen(searchengines[i].token) + 1); ++ } ++ ++ return g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri); ++} ++ + static void + pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) { + Arg arg = {.v = text }; diff --git a/network/surf/patches/startfullscreen.diff b/network/surf/patches/startfullscreen.diff new file mode 100644 index 0000000000..45e1f87f53 --- /dev/null +++ b/network/surf/patches/startfullscreen.diff @@ -0,0 +1,70 @@ +diff -Naur surf-0.6/surf.1 surf-0.6.patched/surf.1 +--- surf-0.6/surf.1 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.1 2013-07-03 18:41:35.000000000 -0400 +@@ -50,6 +50,8 @@ + .B \-x + Prints xid to standard output. This can be used to script the browser by using + .BR xprop(1). ++.B \-f ++Start in fullscreen mode. + .SH USAGE + .B Escape + Stops loading current page or stops download. +diff -Naur surf-0.6/surf.c surf-0.6.patched/surf.c +--- surf-0.6/surf.c 2013-02-10 13:40:14.000000000 -0500 ++++ surf-0.6.patched/surf.c 2013-07-03 18:42:07.000000000 -0400 +@@ -81,6 +81,7 @@ + static Client *clients = NULL; + static GdkNativeWindow embed = 0; + static gboolean showxid = FALSE; ++static gboolean startfullscreen = FALSE; + static char winid[64]; + static gboolean usingproxy = 0; + static char togglestat[5]; +@@ -463,7 +464,7 @@ + } else { + gtk_window_fullscreen(GTK_WINDOW(c->win)); + } +- c->fullscreen = !c->fullscreen; ++ startfullscreen = c->fullscreen = !c->fullscreen; + } + + static const char * +@@ -822,6 +823,9 @@ + } + } + ++ if(startfullscreen) { ++ fullscreen(c, NULL); ++ } + return c; + } + +@@ -846,6 +850,8 @@ + cmd[i++] = "-i"; + if(showxid) + cmd[i++] = "-x"; ++ if(startfullscreen) ++ cmd[i++] = "-f"; + cmd[i++] = "--"; + uri = arg->v ? (char *)arg->v : c->linkhover; + if(uri) +@@ -1148,7 +1154,7 @@ + + static void + usage(void) { +- die("usage: %s [-inpsvx] [-c cookiefile] [-e xid] [-r scriptfile]" ++ die("usage: %s [-inpsvxf] [-c cookiefile] [-e xid] [-r scriptfile]" + " [-t stylefile] [-u useragent] [uri]\n", basename(argv0)); + } + +@@ -1215,6 +1221,9 @@ + case 'x': + showxid = TRUE; + break; ++ case 'f': ++ startfullscreen = TRUE; ++ break; + default: + usage(); + } ARGEND; diff --git a/network/surf/slack-desc b/network/surf/slack-desc new file mode 100644 index 0000000000..267b0e8193 --- /dev/null +++ b/network/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/network/surf/surf.SlackBuild b/network/surf/surf.SlackBuild new file mode 100644 index 0000000000..7807dee716 --- /dev/null +++ b/network/surf/surf.SlackBuild @@ -0,0 +1,160 @@ +#!/bin/bash + +# Slackware build script for surf + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +PRGNAM=surf +VERSION=${VERSION:-0.6} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -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 . \ + \( -perm 777 -o -perm 775 -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 {} \; + +# Add a couple of nice patches from upstream, unless disabled. Note that +# upstream expects users to add patches and edit the source to customize it. +# This SlackBuild just semi-automates some of that process. +PATCH=${PATCH:-yes} + +if [ "$PATCH" = "yes" ]; then + for p in $CWD/patches/*.diff; do + patch -p1 < $p + done +fi + +# Customization. + +# Default to rxvt rather than st as the terminal for running wget when +# downloading. This avoids adding st as a required dep. +TERMINAL=${TERMINAL:-rxvt} + +# Default geometry +WIDTH=${WIDTH:-800} +HEIGHT=${HEIGHT:-600} + +# Homepage (if browser called with no arguments). No effect if PATCH=no +HOMEPAGE="${HOMEPAGE:-https://duckduckgo.com/html/}" + +# Shouldn't need to set this unless on -current. No effect if PATCH=no +SLACKVER="${SLACKVER:-$( cut -d' ' -f2 /etc/slackware-version )}" + +# For the paranoid: +STRICTSSL=${STRICTSSL:-no} +if [ "$STRICTSSL" = "yes" ]; then + sed -i '/strictssl/s,FALSE,TRUE,' config.def.h +fi + +# Apply customizations +case "$SLACKVER$LIBDIRSUFFIX" in + 14.0) SVER=19 ;; + 14.064) SVER=20 ;; + current) SVER=13 ;; + current64) SVER=16 ;; +esac + +sed -i \ + -e "s,@HOMEPAGE@,$HOMEPAGE,g" \ + -e "s,\<800\>,$WIDTH," \ + -e "s,\<600\>,$HEIGHT," \ + $PRGNAM.c + +sed -i \ + -e "s,\<st\>,$TERMINAL," \ + -e "s,@SVER@,$SVER,g" \ + -e "s,@64@,$LIBDIRSUFFIX,g" \ + config.def.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?/*.? + +# This doesn't get installed by default +install -m0755 $PRGNAM-open.sh $PKG/usr/bin + +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 +for i in $CWD/*.txt; do + cat $i > $PKG/usr/doc/$PRGNAM-$VERSION/$( basename $i ) +done +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +# So many build options, we'd better save them +cat <<EOF > $PKG/usr/doc/$PRGNAM-$VERSION/buildopts.sh +# Options used when surf.SlackBuild was run. +# You can re-use these options by running 'source buildopts.sh' +# before building surf again. + +PATCH="$PATCH" +TERMINAL="$TERMINAL" +HOMEPAGE="$HOMEPAGE" +WIDTH="$WIDTH" +HEIGHT="$HEIGHT" +SLACKVER="$SLACKVER" +STRICTSSL="$STRICTSSL" + +export PATCH TERMINAL HOMEPAGE WIDTH HEIGHT SLACKVER STRICTSSL +EOF + +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/network/surf/surf.desktop b/network/surf/surf.desktop new file mode 100644 index 0000000000..bc9f59f98f --- /dev/null +++ b/network/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/network/surf/surf.info b/network/surf/surf.info new file mode 100644 index 0000000000..6b1943b3e0 --- /dev/null +++ b/network/surf/surf.info @@ -0,0 +1,10 @@ +PRGNAM="surf" +VERSION="0.6" +HOMEPAGE="http://surf.suckless.org/" +DOWNLOAD="http://dl.suckless.org/surf/surf-0.6.tar.gz" +DOWNLOAD_x86_64="" +MD5SUM="aeeed723b562a30cc6a2b3ea18f6d99a" +MD5SUM_x86_64="" +REQUIRES="webkitgtk dmenu" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" |