network/elinks: Add multiple build options and contributed code.

This commit is contained in:
David Woodfall 2018-09-27 20:23:54 +01:00 committed by Willy Sudiarto Raharjo
parent e464e4b03a
commit dee9579267
No known key found for this signature in database
GPG key ID: 887B8374D7333381
10 changed files with 223 additions and 62 deletions

View file

@ -1,34 +1,65 @@
elinks (ELinks - Full-Featured Text WWW Browser)
ELinks is an advanced and well-established feature-rich text mode
web (HTTP/FTP/..) browser. ELinks can render both frames and tables,
is highly customizable, and can be extended via Lua or Guile scripts.
It is very portable and runs on a variety of platforms. It also uses
Spider Monkey's javascript support.
ELinks is an advanced and well-established feature-rich text mode web
(HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly
customizable, and can be extended via Lua or Guile scripts. It is very portable
and runs on a variety of platforms. It also uses SpiderMonkey javascript
support.
ELinks also supports the gopher protocol.
There are a number of options that can be used to add support for other
protocols etc. To enable or disable an option use the following method:
Various support options added into this SlackBuild:
MOUSE=no ./elinks.SlackBuild
Guile, CGI, NNTP, HTML-highlight, finger, bittorrent, gopher,
exmode, 88 colours, 256 colours, true colour.
Several options can be combined together.
If you experience problems with corrupt graphics etc. it may be worth
experiementing with various $TERM variables, as well as look into the
settings for terminal options. EG:
OPTIONS
TERM=rxvt-unicode elinks <URL>
Category Description Default Value
To disable the X windows mouse use the flag NOMOUSE=1
To disable the gpm mouse use the flag NOGPM=1
or combine them:
System:
NOMOUSE=1 NOGPM=1 ./elinks.SlackBuild
FASTMEM Direct use of system alloc no
CGI Local CGI support no
CCOMBINING Unicode combining characters no
UTF8 UTF-8 support yes
IPV6 IPv6 support yes
HTMLHL HTML highlighting using DOM engine no
LZMA LZMA encoding support no
This version is patched to fix the following issues:
UI:
Fix gopher URL: html links.
Fix gopher index queries.
Fix gopher directory links.
Make elinks verify ssl hostnames.
Fix a few more issues with gopher links.
MOUSE Mouse support yes
GPM GPM (mouse) support yes
EXMODE Exmode (CLI) interface no
Colours:
COLS88 88 Colours no
COLS256 256 Colours no
COLSTRUE True Colours no
Scripting:
GUILE no
PERL no
PYTHON no
LUA yes
ECMA (SpiderMonkey Javascript Engine) yes
Protocols:
BITTORRENT no
DATA yes
FSP no
FTP yes
FINGER no
GOPHER no
NNTP no
SMB no
Note that Unicode combining characters is marked as experimental.
Optional Dependencies:
tre: for regex search support

112
network/elinks/elinks.SlackBuild Normal file → Executable file
View file

@ -4,9 +4,6 @@
# Copyright 2014 David Woodfall <dave@dawoodfall.net>
# All rights reserved.
#
# Brian Muramatsu's (btmura@gmail.com) original slackbuild rewritten
# from scratch.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
@ -26,7 +23,7 @@
PRGNAM=elinks
VERSION=${VERSION:-git20131231}
BUILD=${BUILD:-9}
BUILD=${BUILD:-10}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -42,17 +39,22 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
# Added -fno-strict-aliasing -Wno-pointer-sign for a much more peaceful build
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-g0 -O0 -march=i486 -mtune=i686 -fno-strict-aliasing -Wno-pointer-sign"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-g0 -O0 -march=i586 -mtune=i686 -fno-strict-aliasing -Wno-pointer-sign"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
SLKCFLAGS="-g0 -O0 -march=i686 -mtune=i686 -fno-strict-aliasing -Wno-pointer-sign"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
SLKCFLAGS="-g0 -O0 -fPIC -fno-strict-aliasing -Wno-pointer-sign"
SLKLDFLAGS="-m64"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
SLKCFLAGS="-go -O0"
LIBDIRSUFFIX=""
fi
@ -71,50 +73,83 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Next patch fixes URL: html links
patch --verbose -p1 < $CWD/0001-gopher_html_links.patch
for patch in $CWD/patches/*
do
patch --verbose -p1 < $patch
done
# Next patch fixes index queries
patch --verbose -p1 < $CWD/0002-gopher_index_queries.patch
# System
[ "${FASTMEM:-no}" = "yes" ] && fastmem="--enable-fastmem"
[ "${CGI:-no}" = "yes" ] && cgi="--enable-cgi"
[ "${CCOMBINING:-no}" = "yes" ] && combinging="--enable-combining"
[ "${UTF8:-yes}" = "no" ] && utf8="--disable-utf-8"
[ "${IPV6:-yes}" = "no" ] && ipv6="--disable-ipv6"
[ "${HTMLHL:-no}" = "yes" ] && htmlhl="--enable-html-highlight"
[ "${LZMA:-no}" = "yes" ] && lzma="--with-lzma"
# Next patch fixes remote directory links
patch --verbose -p1 < $CWD/0003-gopher_directory_links.patch
# UI
[ "${MOUSE:-yes}" = "no" ] && mouse="--disable-mouse"
[ "${GPM:-yes}" = "no" ] && gpm="--without-gpm"
[ "${EXMODE:-no}" = "yes" ] && exmode="--enable-exmode"
# Next patch makes elinks verify ssl hostnames
patch --verbose -p1 < $CWD/0004-ssl_cert_verify.patch
# Colours
[ "${COLS88:-no}" = "yes" ] && cols88="--enable-88-colors"
[ "${COLS256:-no}" = "yes" ] && cols256="--enable-256-colors"
[ "${COLSTRUE:-no}" = "yes" ] && colstrue="--enable-true-colors"
# Next patch fixes several problems for gopher links
patch --verbose -p1 < $CWD/0005-gopher_newlines_tabs_entity.patch
# Scripting
[ "${GUILE:-no}" = "yes" ] && guile="--with-guile"
[ "${PERL:-no}" = "yes" ] && perl="--with-perl"
[ "${PYTHON:-no}" = "yes" ] && python="--with-python"
[ "${LUA:-yes}" = "no" ] && lua="--without-lua"
[ "${ECMA:-yes}" = "no" ] && ecma="--disable-sm-scripting"
[ -n "$NOMOUSE" ] && mouse="--disable-mouse"
[ -n "$NOGPM" ] && gpm="--without-gpm"
# Protocols
[ "${BITTORRENT:-no}" = "yes" ] && bittorrent="--enable-bittorrent"
[ "${DATA:-yes}" = "no" ] && data="--disable-data"
[ "${FSP:-no}" = "yes" ] && fsp="--enable-fsp"
[ "${FTP:-yes}" = "no" ] && ftp="--disable-ftp"
[ "${FINGER:-no}" = "yes" ] && finger="--enable-finger"
[ "${GOPHER:-no}" = "yes" ] && gopher="--enable-gopher"
[ "${NNTP:-no}" = "yes" ] && nntp="--enable-nntp"
[ "${SMB:-no}" = "yes" ] && smb="--enable-smb"
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
autoreconf
CFLAGS="$SLKCFLAGS -L/usr/lib64" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--libdir=/usr/lib$LIBDIRSUFFIX \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--with-guile \
--enable-cgi \
--enable-finger \
--enable-fsp \
--enable-gopher \
--enable-nntp \
--enable-smb \
--enable-88-colors \
--enable-256-colors \
--enable-true-color \
--enable-exmode \
--enable-html-highlight \
--enable-bittorrent \
--enable-fastmem \
$fastmem \
$cgi \
$combining \
$utf8 \
$ipv6 \
$htmlhl \
$lzma \
$mouse \
$gpm \
$exmode \
$cols88 \
$cols256 \
$colstrue \
$guile \
$perl \
$python \
$lua \
$ecma \
$bittorrent \
$data \
$fsp \
$ftp \
$finger \
$gopher \
$nntp \
$smb \
--build=$ARCH-slackware-linux
make
@ -129,6 +164,7 @@ for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; r
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/html doc/*txt \
contrib \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

View file

@ -3,6 +3,7 @@
# aren't being followed. This fixes that issue and also chtml.
# Normally those kind of links go to a redirect page that the
# server generates, which then sends you on your way.
# dave@dawoodfall.net
###############################################################
diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2013-12-18 15:38:57.000000000 +0000

View file

@ -4,6 +4,7 @@
# served results page and instead generated another search page after
# you had entered the first. This patch fixes that and in my tests it
# seems to work so far.
# dave@dawoodfall.net
#######################################################################
diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2017-11-24 19:12:52.495714437 +0000

View file

@ -2,6 +2,7 @@
# elinks does not follow links to directories on other servers
# properly. This adds a '/' before the '1' at the start of a link and
# removes any trailing 1.
# dave@dawoodfall.net
#######################################################################
diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2017-12-17 01:54:27.941645180 +0000

View file

@ -3,7 +3,7 @@
# This is a modifed version of the patch here that fixes that issue:
# http://lists.linuxfromscratch.org/pipermail/elinks-dev/2015-June/002099.html
# This patch turns on verification by default, and differentiates
# between host verification fail and noral SSL errors.
# between host verification fail and normal SSL errors.
# dave@dawoodfall.net
##############################################################################
--- a/configure.in 2017-12-21 15:58:12.470247050 +0000

View file

@ -0,0 +1,62 @@
#######################################################################
# Fixes index listings with only LF and no CRs.
# dave@dawoodfall.net
#######################################################################
diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2017-12-29 17:14:24.247093626 +0000
+++ b/src/protocol/gopher/gopher.c 2017-12-29 17:12:08.496272595 +0000
@@ -638,15 +638,16 @@
static unsigned char *
get_gopher_line_end(unsigned char *data, int datalen)
{
- for (; datalen > 1; data++, datalen--)
- if (data[0] == ASCII_CR && data[1] == ASCII_LF)
+ for (; datalen > 1; data++, datalen--) {
+ if (data[0] == ASCII_CR && data[1] == ASCII_LF)
return data + 2;
else
if(data[0] == ASCII_CR)
- return data + 2;
- else
- if(data[0] == ASCII_LF)
- return data + 2;
+ return data + 1;
+ else
+ if(data[0] == ASCII_LF)
+ return data + 1;
+ }
return NULL;
}
@@ -796,9 +797,21 @@
/* Now read the data from the socket */
switch (gopher->entity->type) {
+ case GOPHER_INDEX:
+ /* Lines with no carriage returns */
+ if (strchr(rb->data, ASCII_CR) == NULL) {
+ unsigned char *tmp;
+ tmp = malloc(rb->length + 3);
+ memcpy(tmp, "i", 1);
+ memcpy(tmp+1, rb->data, rb->length);
+ tmp[rb->length]= '\r';
+ tmp[rb->length+1]= '\n';
+ rb->length+=3;
+ memcpy(rb->data, tmp, rb->length);
+ free(tmp);
+ }
+
case GOPHER_DIRECTORY:
-/* Don't do directory list for cgi output (7)
- case GOPHER_INDEX: */
state = read_gopher_directory_data(conn, rb);
break;
@@ -810,7 +823,6 @@
state = connection_state(S_GOPHER_CSO_ERROR);
break;
- case GOPHER_INDEX:
case GOPHER_SOUND:
case GOPHER_PLUS_SOUND:
case GOPHER_PLUS_MOVIE:

View file

@ -0,0 +1,16 @@
###################################################################
# Move the added null terminator one char forwards
# dave@dawoodfall.net
###################################################################
diff --exclude .git -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2017-12-29 17:15:39.521209968 +0000
+++ b/src/protocol/gopher/gopher.c 2018-01-17 05:46:45.660258482 +0000
@@ -658,7 +658,7 @@
assert(line < end);
/* Just to be safe NUL terminate the line */
- end[-2] = 0;
+ end[-1] = 0;
return line[0] == '.' && !line[1] ? NULL : line;
}

View file

@ -0,0 +1,13 @@
diff -Naur a/configure.in b/configure.in
--- a/configure.in 2013-12-18 15:38:57.000000000 +0000
+++ b/configure.in 2018-09-18 02:42:58.996249845 +0100
@@ -427,9 +427,6 @@
CFLAGS="$CFLAGS -I$withval"
CPPFLAGS="$CPPFLAGS -I$withval"
fi
- if test -d "$withval/lib"; then
- LDFLAGS="$LDFLAGS -L$withval/lib"
- fi
fi
AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])