diff options
author | B. Watson <urchlay@slackware.uk> | 2024-10-23 12:06:58 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-10-23 12:40:55 +0700 |
commit | 9f0f3d43743013f2993250c614bdf65cccbfff10 (patch) | |
tree | 622e8cd7724a680632e5a4fc8d00eaaf9e12349b | |
parent | 51814553d1bc3447c957df0c1a6ca0fd963f0ea6 (diff) |
libraries/lua-readline: Added (simple interface to the readline).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | libraries/lua-readline/README | 13 | ||||
-rw-r--r-- | libraries/lua-readline/fix-version.diff | 15 | ||||
-rw-r--r-- | libraries/lua-readline/lua-readline.SlackBuild | 122 | ||||
-rw-r--r-- | libraries/lua-readline/lua-readline.info | 10 | ||||
-rw-r--r-- | libraries/lua-readline/slack-desc | 19 |
5 files changed, 179 insertions, 0 deletions
diff --git a/libraries/lua-readline/README b/libraries/lua-readline/README new file mode 100644 index 000000000000..e831a2d9c20e --- /dev/null +++ b/libraries/lua-readline/README @@ -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. diff --git a/libraries/lua-readline/fix-version.diff b/libraries/lua-readline/fix-version.diff new file mode 100644 index 000000000000..43c21b018910 --- /dev/null +++ b/libraries/lua-readline/fix-version.diff @@ -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: diff --git a/libraries/lua-readline/lua-readline.SlackBuild b/libraries/lua-readline/lua-readline.SlackBuild new file mode 100644 index 000000000000..3499a1815a9c --- /dev/null +++ b/libraries/lua-readline/lua-readline.SlackBuild @@ -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 diff --git a/libraries/lua-readline/lua-readline.info b/libraries/lua-readline/lua-readline.info new file mode 100644 index 000000000000..7408b3a20136 --- /dev/null +++ b/libraries/lua-readline/lua-readline.info @@ -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" diff --git a/libraries/lua-readline/slack-desc b/libraries/lua-readline/slack-desc new file mode 100644 index 000000000000..978344aee6e7 --- /dev/null +++ b/libraries/lua-readline/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------------------------------------------------------| +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: |