Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libraries/lua-readline: Added (simple interface to the readline). #8467

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions libraries/lua-readline/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
lua-readline (lua interface to the readline and history libraries)

This Lua module offers a simple calling interface to the GNU Readline
and History libraries.

Optional dependencies:

- lua-posix: if this is installed, lua-readline can use it at runtime
to determine the user's home directory, if HOME is not set in the
environment.

- lua51: if this is installed when the package is built, lua-readline
will include a module for Lua 5.1.
15 changes: 15 additions & 0 deletions libraries/lua-readline/fix-version.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/readline.lua b/readline.lua
index 939a054..74f494e 100644
--- a/readline.lua
+++ b/readline.lua
@@ -7,8 +7,8 @@
---------------------------------------------------------------------

local M = {} -- public interface
-M.Version = '3.1' -- reset OldHistoryLength if histfile gets set
-M.VersionDate = '20apr2022'
+M.Version = '3.3' -- return nil if ctrl-D is first char
+M.VersionDate = '13apr2023' -- from git history

--[[
Alexander Adler suggests adding four Alternate-Interface functions:
122 changes: 122 additions & 0 deletions libraries/lua-readline/lua-readline.SlackBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/bin/bash

# Slackware build script for lua-readline

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# Based on the Arch PKGBUILD:
# https://aur.archlinux.org/packages/lua-readline

# There used to be a lua-readline on SBo, maintained by abooksigun,
# based on a different (older, v2.9) source. It was removed in April
# 2024 because "upstream no longer exists". This isn't quite true:
# upstream moved the lua-readline site & repo to gitlab. abooksigun
# says (via email) that he doesn't have the time to maintain this new
# build, so I will, since I'm up to my eyebrows in lua stuff already.

# This could serve as somewhat of a template for building lua modules
# from ".rock" files (which are just zip files), though the actual
# compile command(s) will be different. There's no Makefile or similar
# inside a .rock. The .rockspec file does give you a hint, but doesn't
# contain actual compile commands.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=lua-readline
VERSION=${VERSION:-3.3_0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

# Nonstandard flags: -fPIC is requires on all arches, not just x86_64.
SLKCFLAGS="-O2 -fPIC"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS+=" -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS+=" -march=i686 -mtune=i686"
fi

set -e

# You're in a maze of twisty version numbers, all alike...
SRCNAM=readline
ROCKVER=${VERSION/_/-}
ZIPFILE=$SRCNAM-$ROCKVER.src.rock
TARVER=${VERSION/_*/}
TARDIR=$SRCNAM-$TARVER
TARBALL=$TARDIR.tar.gz

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $TARDIR
unzip -p $CWD/$ZIPFILE $TARBALL | tar xvfz -
cd $TARDIR
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 {} +

# This patch is from Arch, it looks wrong to me: it sets the version
# to 3.2 in the lua source. But we're on version 3.3 of lua-readline.
# Debian doesn't include this patch at all.
patch -p1 < $CWD/fix-version.diff

# There's no Makefile, I based the compile command on the PKGBUILD.
# The -Wl,-s makes it build a stripped library.
# Compiled library gets written straight to $PKG, no copying.
# The set -x makes the shell show the commands (like make does).
runmake() {
set -x

local cmod=$PKG/$( pkg-config $1 --variable INSTALL_CMOD )
local lmod=$PKG/$( pkg-config $1 --variable INSTALL_LMOD )
local lflags=$( pkg-config $1 --cflags )

mkdir -p $cmod $lmod

${CC:-gcc} \
$SLKCFLAGS \
$lflags \
-shared \
-Wl,-s \
-o $cmod/C-readline.so \
C-readline.c \
-lreadline -lhistory

install -m0644 readline.lua $lmod
set +x
}

runmake lua
[ -x /usr/bin/lua51 ] && runmake lua51

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
head -n8 readline.lua > $PKGDOC/LICENSE
cp -a doc/*.html $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild

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
10 changes: 10 additions & 0 deletions libraries/lua-readline/lua-readline.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PRGNAM="lua-readline"
VERSION="3.3_0"
HOMEPAGE="https://peterbillam.gitlab.io/pjb_lua/lua/readline.html"
DOWNLOAD="http://luarocks.org/manifests/peterbillam/readline-3.3-0.src.rock"
MD5SUM="8df05ca5f23d38f65e8de8d2d38edb6d"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="lua"
MAINTAINER="B. Watson"
EMAIL="urchlay@slackware.uk"
19 changes: 19 additions & 0 deletions libraries/lua-readline/slack-desc
Original file line number Diff line number Diff line change
@@ -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------------------------------------------------------|
lua-readline: lua-readline (lua interface to the readline and history libraries)
lua-readline:
lua-readline: This Lua module offers a simple calling interface to the GNU Readline
lua-readline: and History libraries.
lua-readline:
lua-readline:
lua-readline:
lua-readline:
lua-readline:
lua-readline:
lua-readline: