diff options
author | B. Watson <yalhcru@gmail.com> | 2020-11-14 06:26:01 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-11-14 17:16:42 +0700 |
commit | e08afba78d258be4e043be68334fbd5bc6bec9ba (patch) | |
tree | df107dbc1dee52ec6968ec9f06d9ec65f710a569 /system/lv | |
parent | 51bb6caf77583ed35bbd564f5669a51754983bed (diff) |
system/lv: Added (pager, grep, and iconv replacement)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/lv')
-rw-r--r-- | system/lv/README | 17 | ||||
-rw-r--r-- | system/lv/lv.SlackBuild | 115 | ||||
-rw-r--r-- | system/lv/lv.info | 12 | ||||
-rw-r--r-- | system/lv/patches/fix_implicit_decls.diff | 41 | ||||
-rw-r--r-- | system/lv/patches/makefile.diff | 53 | ||||
-rw-r--r-- | system/lv/patches/man_typos.diff | 65 | ||||
-rw-r--r-- | system/lv/patches/no_inline.diff | 19 | ||||
-rw-r--r-- | system/lv/patches/series | 4 | ||||
-rw-r--r-- | system/lv/slack-desc | 19 |
9 files changed, 345 insertions, 0 deletions
diff --git a/system/lv/README b/system/lv/README new file mode 100644 index 0000000000000..41dc4fdfafe32 --- /dev/null +++ b/system/lv/README @@ -0,0 +1,17 @@ +lv (pager, grep, and iconv replacement) + +lv is a powerful file viewer like less. lv can decode and encode +multilingual streams in many encodings, including ISO-8859, ISO-2022, +EUC, SJIS, Big5, HZ, and Unicode. It recognizes multi-byte patterns +in regular expressions, and can be run as "lgrep" to act as a grep +replacement. In addition, lv can recognize ANSI escape sequences for +text decoration (making it suitable for use as MANPAGER). + +lv can also be used as a replacement for iconv(1), by redirecting +its standard output and using the -I and -O options to set the input +and output encodings. Although it doesn't support all the features of +iconv, lv will autodetect the input encoding (which iconv won't). + +lv also has one (possibly) unique feature: It can autodetect and +convert or display multiple character encodings *within the same +document*. diff --git a/system/lv/lv.SlackBuild b/system/lv/lv.SlackBuild new file mode 100644 index 0000000000000..87c7446e955c8 --- /dev/null +++ b/system/lv/lv.SlackBuild @@ -0,0 +1,115 @@ +#!/bin/sh + +# Slackware build script for lv + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# 20201111 bkw: added at v4.51_7. The original upstream for this is +# long gone (dead website), but the maintainer of the Debian package +# continues to develop this. So I'm treating Debian as upstream, and +# the _7 in VERSION is the Debian patchlevel. + +PRGNAM=lv +VERSION=${VERSION:-4.51_7} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +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/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +# Nothing uses LIBDIRSUFFIX, don't bother with it. +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +else + SLKCFLAGS="-O2" +fi + +set -e + +SRCVER=${VERSION%_*} # 1.23_4 => 1.23 +DEBVER=${VERSION#*_} # 1.23_4 => 4 + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$SRCVER.orig +tar xvf $CWD/${PRGNAM}_$SRCVER.orig.tar.?z +cd $PRGNAM-$SRCVER.orig +tar xvf $CWD/${PRGNAM}_$SRCVER-$DEBVER.debian.tar.xz +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# Apply all of debian's patches. +for i in $( cat debian/patches/series ); do + patch -p1 < "debian/patches/$i" +done + +# Local patches (sent upstream, maybe they'll be in the next release). +for i in $( cat $CWD/patches/series ); do + patch -p1 < "$CWD/patches/$i" +done + +# I wish there were --disable-termcap and/or --enable-ncurses options. +# The configure script is hardcoded: if termcap is found, it uses that +# and never looks for ncurses. Since termcap is pretty well deprecated +# here in the 21st century, we'd much rather use ncurses... +sed -i 's,termcap,ncurses,g' src/configure + +# libdir is /usr/share because all that gets installed there is the lv +# help file (which is just a pre-rendered version of the man page). +cd build +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +../src/configure \ + --enable-fastio \ + --prefix=/usr \ + --libdir=/usr/share \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +# binary already stripped +gzip -9 $PKG/usr/man/man1/$PRGNAM.1 +ln -s $PRGNAM.1.gz $PKG/usr/man/man1/lgrep.1.gz + +cd .. +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README* GPL* hello.* debian/changelog $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +# Japanese-language sections in the HTML docs are in some kind of +# non-Unicode encoding. lv autodetects it just fine, but nothing else +# seems to, so use lv itself to convert them to UTF-8. This is helpful +# if you're reading the files locally with a browser: there's no HTTP +# headers to specify the encoding, and UTF-8 is more likely to be +# autodetected or just guessed at. +for i in *.html; do + $PKG/usr/bin/lv -Ou8 $i > $PKG/usr/doc/$PRGNAM-$VERSION/$i +done + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/lv/lv.info b/system/lv/lv.info new file mode 100644 index 0000000000000..3d29aca4a8b86 --- /dev/null +++ b/system/lv/lv.info @@ -0,0 +1,12 @@ +PRGNAM="lv" +VERSION="4.51_7" +HOMEPAGE="https://packages.debian.org/sid/lv" +DOWNLOAD="http://deb.debian.org/debian/pool/main/l/lv/lv_4.51.orig.tar.gz \ + http://deb.debian.org/debian/pool/main/l/lv/lv_4.51-7.debian.tar.xz" +MD5SUM="893084b35a11eaaee4f71827d0092fa5 \ + d6d2d0e27a43480b794615a02235b953" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/system/lv/patches/fix_implicit_decls.diff b/system/lv/patches/fix_implicit_decls.diff new file mode 100644 index 0000000000000..1f9de61b91002 --- /dev/null +++ b/system/lv/patches/fix_implicit_decls.diff @@ -0,0 +1,41 @@ +Description: Remove implicit declaration warnings by adding +appropriate #includes, and fix a typo in a prototype. +Author: B. Watson <yahlcru@gmail.com> + +-- + +diff -Naur lv-4.51.orig/src/file.h lv-4.51.orig.patched/src/file.h +--- lv-4.51.orig/src/file.h 2020-11-12 02:03:33.560002050 -0500 ++++ lv-4.51.orig.patched/src/file.h 2020-11-12 02:04:06.555999050 -0500 +@@ -172,7 +172,7 @@ + public inline int IobufGetc( iobuf_t *iobuf ); + public inline int IobufUngetc( int ch, iobuf_t *iobuf ); + public offset_t IobufFtell( iobuf_t *iobuf ); +-public int IobufFseeko( iobuf_t *iobuf, offset_t off, int mode ); ++public int IobufFseek( iobuf_t *iobuf, offset_t off, int mode ); + public int IobufFeof( iobuf_t *iobuf ); + #endif + #define IobufPutc( a, b ) putc( a, (b)->iop ) +diff -Naur lv-4.51.orig/src/guess.c lv-4.51.orig.patched/src/guess.c +--- lv-4.51.orig/src/guess.c 2003-11-12 22:08:19.000000000 -0500 ++++ lv-4.51.orig.patched/src/guess.c 2020-11-12 02:04:22.621997590 -0500 +@@ -21,6 +21,7 @@ + */ + + #include <stdio.h> ++#include <string.h> + + #include <import.h> + #include <decode.h> +diff -Naur lv-4.51.orig/src/guesslocale.c lv-4.51.orig.patched/src/guesslocale.c +--- lv-4.51.orig/src/guesslocale.c 2004-01-05 03:41:22.000000000 -0500 ++++ lv-4.51.orig.patched/src/guesslocale.c 2020-11-12 02:04:49.294995165 -0500 +@@ -20,6 +20,8 @@ + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + ++#include <ctype.h> ++ + #ifdef HAVE_SETLOCALE + + #include <stdlib.h> diff --git a/system/lv/patches/makefile.diff b/system/lv/patches/makefile.diff new file mode 100644 index 0000000000000..4c55d7c5d2dc3 --- /dev/null +++ b/system/lv/patches/makefile.diff @@ -0,0 +1,53 @@ +Description: "make install": Support DESTDIR, use symlink for +lgrep, use more standard default permissions (and make them +variables). Create bin/man/lib dirs if they don't already exist. +Author: B. Watson <yahlcru@gmail.com> + +-- + +diff -Naur lv-4.51.orig/src/Makefile.in lv-4.51.orig.patched/src/Makefile.in +--- lv-4.51.orig/src/Makefile.in 2004-01-06 02:22:17.000000000 -0500 ++++ lv-4.51.orig.patched/src/Makefile.in 2020-11-12 01:59:50.646022314 -0500 +@@ -18,6 +18,10 @@ + lvlibdir= $(libdir)/lv + distdir = lv$(VERSION) + ++DESTDIR= ++BINPERMS= 0755 ++DOCPERMS= 0644 ++ + PURIFY= @PURIFY@ + CC= @CC@ + CFLAGS= @CFLAGS@ -DLV_HELP_PATH=\"$(lvlibdir)\" -I$(srcdir) @DEFS@ +@@ -64,18 +68,22 @@ + # + + install:: +- $(INSTALL) -s -m 555 lv $(bindir) +- if test -f $(bindir)/lgrep; then \ +- /bin/rm -f $(bindir)/lgrep; \ ++ if test ! -d $(DESTDIR)$(bindir); then \ ++ mkdir -p $(DESTDIR)$(bindir); \ ++ fi ++ $(INSTALL) -s -m $(BINPERMS) lv $(DESTDIR)$(bindir) ++ if test -f $(DESTDIR)$(bindir)/lgrep; then \ ++ /bin/rm -f $(DESTDIR)$(bindir)/lgrep; \ + fi +- (cd $(bindir); ln lv lgrep) +- if test ! -d $(lvlibdir); then \ +- mkdir -p $(lvlibdir); \ ++ (cd $(DESTDIR)$(bindir); ln -s lv lgrep) ++ if test ! -d $(DESTDIR)$(lvlibdir); then \ ++ mkdir -p $(DESTDIR)$(lvlibdir); \ + fi +- $(INSTALL) -m 444 $(srcdir)/../lv.hlp $(lvlibdir) +- if test -d $(mandir) -a -d $(mandir)/man1; then \ +- $(INSTALL) -m 444 $(srcdir)/../lv.1 $(mandir)/man1; \ ++ $(INSTALL) -m $(DOCPERMS) $(srcdir)/../lv.hlp $(DESTDIR)$(lvlibdir) ++ if test ! -d $(DESTDIR)$(mandir)/man1; then \ ++ mkdir -p $(DESTDIR)$(mandir)/man1; \ + fi ++ $(INSTALL) -m $(DOCPERMS) $(srcdir)/../lv.1 $(DESTDIR)$(mandir)/man1; \ + + uninstall:: + for i in $(bindir)/lv $(bindir)/lgrep $(lvlibdir)/lv.hlp $(mandir)/man1/lv.1; do \ diff --git a/system/lv/patches/man_typos.diff b/system/lv/patches/man_typos.diff new file mode 100644 index 0000000000000..be6e2ad63dca2 --- /dev/null +++ b/system/lv/patches/man_typos.diff @@ -0,0 +1,65 @@ +Description: Fix a few typos in the man & help docs. +Author: B. Watson <yahlcru@gmail.com> + +-- + +diff -Naur lv-4.51.orig/lv.1 lv-4.51.orig.patched/lv.1 +--- lv-4.51.orig/lv.1 2020-11-12 01:44:33.656105671 -0500 ++++ lv-4.51.orig.patched/lv.1 2020-11-12 01:45:58.092097996 -0500 +@@ -47,7 +47,7 @@ + but also as a coding-system translation filter + like \fInkf\fP (1) and \fItcs\fP (1). + .IP "\fIMultilingual regular expressions / Multilingual grep\fP" +-lv can recognize multi-bytes patterns as regular expressions, ++lv can recognize multi-byte patterns as regular expressions, + and lv also provides multilingual \fIgrep\fP (1) functionality + by giving it another name, \fIlgrep\fP. + Pattern matching is conducted in the charset level, +@@ -203,7 +203,7 @@ + Allow physical lines of each logical line printed on the screen + to be concatenated for cut and paste after screen refresh + .IP "-s" +-Force old pages to be swept out from the screen Smoothly ++Force old pages to be swept out from the screen smoothly + .IP "-u" + Unify several character sets, eg. JIS X0208 and C6226. + In addition, lv equates ISO 646 variants, +@@ -237,7 +237,7 @@ + Show this help + .SH "CONFIGURATION" + Options can be described in configuration file ``.lv'' (``_lv'' on MSDOS) +-located at you HOME directory. If and only if you use MSDOS, you can locate ++located in your HOME directory. If and only if you use MSDOS, you can locate + ``_lv'' at current working directory. + They can be also described in the environment variable LV. + Every configuration will be overloaded in this order if there is. Command line +diff -Naur lv-4.51.orig/lv.hlp lv-4.51.orig.patched/lv.hlp +--- lv-4.51.orig/lv.hlp 2020-11-12 01:44:33.635105673 -0500 ++++ lv-4.51.orig.patched/lv.hlp 2020-11-12 01:45:58.098097995 -0500 +@@ -37,7 +37,7 @@ + _t_c_s (1). + + _M_u_l_t_i_l_i_n_g_u_a_l _r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n_s _/ _M_u_l_t_i_l_i_n_g_u_a_l _g_r_e_p +- lv can recognize multi-bytes patterns as regular expressions, ++ lv can recognize multi-byte patterns as regular expressions, + and lv also provides multilingual _g_r_e_p (1) functionality by giv- + ing it another name, _l_g_r_e_p. Pattern matching is conducted in + the charset level, so an EUC fragment, for example, can be found +@@ -183,7 +183,7 @@ + -l Allow physical lines of each logical line printed on the screen + to be concatenated for cut and paste after screen refresh + +- -s Force old pages to be swept out from the screen Smoothly ++ -s Force old pages to be swept out from the screen smoothly + + -u Unify several character sets, eg. JIS X0208 and C6226. In addi- + tion, lv equates ISO 646 variants, eg. JIS X0201-Roman, and +@@ -219,7 +219,7 @@ + + CCOONNFFIIGGUURRAATTIIOONN + Options can be described in configuration file ``.lv'' (``_lv'' on +- MSDOS) located at you HOME directory. If and only if you use MSDOS, ++ MSDOS) located in your HOME directory. If and only if you use MSDOS, + you can locate ``_lv'' at current working directory. They can be also + described in the environment variable LV. Every configuration will be + overloaded in this order if there is. Command line options are always diff --git a/system/lv/patches/no_inline.diff b/system/lv/patches/no_inline.diff new file mode 100644 index 0000000000000..ebc1eb58f6a6d --- /dev/null +++ b/system/lv/patches/no_inline.diff @@ -0,0 +1,19 @@ +Description: Remove inline-related compiler warnings (by not using inline) +Author: B. Watson <yahlcru@gmail.com> + +-- + +diff -Naur lv-4.51.orig/src/file.h lv-4.51.orig.patched/src/file.h +--- lv-4.51.orig/src/file.h 2020-11-12 01:41:53.353120244 -0500 ++++ lv-4.51.orig.patched/src/file.h 2020-11-12 01:44:33.701105667 -0500 +@@ -169,8 +169,8 @@ + # endif + # define IobufFeof( a ) feof( (a)->iop ) + #else +-public inline int IobufGetc( iobuf_t *iobuf ); +-public inline int IobufUngetc( int ch, iobuf_t *iobuf ); ++public int IobufGetc( iobuf_t *iobuf ); ++public int IobufUngetc( int ch, iobuf_t *iobuf ); + public offset_t IobufFtell( iobuf_t *iobuf ); + public int IobufFseek( iobuf_t *iobuf, offset_t off, int mode ); + public int IobufFeof( iobuf_t *iobuf ); diff --git a/system/lv/patches/series b/system/lv/patches/series new file mode 100644 index 0000000000000..0228981fdffa6 --- /dev/null +++ b/system/lv/patches/series @@ -0,0 +1,4 @@ +fix_implicit_decls.diff +no_inline.diff +man_typos.diff +makefile.diff diff --git a/system/lv/slack-desc b/system/lv/slack-desc new file mode 100644 index 0000000000000..cf08b44fb5b7a --- /dev/null +++ b/system/lv/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------------------------------------------------------| +lv: lv (pager, grep, and iconv replacement) +lv: +lv: lv is a powerful file viewer like less. lv can decode and encode +lv: multilingual streams in many encodings, including ISO-8859, ISO-2022, +lv: EUC, SJIS, Big5, HZ, and Unicode. It recognizes multi-byte patterns +lv: in regular expressions, and can be run as "lgrep" to act as a grep +lv: replacement. In addition, lv can recognize ANSI escape sequences for +lv: text decoration (making it suitable for use as MANPAGER). +lv: +lv: +lv: |