summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/lua.scm67
1 files changed, 67 insertions, 0 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 84fd2c51da0..56f5ce6f418 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -1384,6 +1384,73 @@ for syntax highlighting or a linting tool.")
1384 (native-inputs (list pandoc)) 1384 (native-inputs (list pandoc))
1385 (inputs (list luajit)))) 1385 (inputs (list luajit))))
1386 1386
1387(define (make-lua-readline name lua)
1388 (package
1389 (name name)
1390 (version "3.3")
1391 (source
1392 (origin
1393 (method git-fetch)
1394 (uri (git-reference ;Peter Billam's Lua module monorepo
1395 (url "https://gitlab.com/peterbillam/pjb_lua.git")
1396 (commit "c558b912032cb81508f1f41fcd1fa417ba9ea4f3")))
1397 (file-name (git-file-name "pjb-lua" "2023.11.26"))
1398 (sha256 (base32 "00xwfyf7p6lvm51msv67sjxw3xkjydfr32dq4p0wfn0ig3xz8m63"))))
1399 (build-system gnu-build-system)
1400 (arguments
1401 (list
1402 #:tests? #f ;test_rl.lua is manual
1403 #:phases
1404 #~(let* ((lua-api-version #$(version-major+minor (package-version lua)))
1405 (lua-cpath (string-append #$output "/lib/lua/" lua-api-version))
1406 (lua-path (string-append #$output "/share/lua/" lua-api-version))
1407 (shared-object "C-readline.so"))
1408 (modify-phases %standard-phases
1409 (add-after 'unpack 'change-dir
1410 (lambda _
1411 (chdir "readline-0.0")))
1412 (delete 'configure)
1413 (replace 'build
1414 (lambda _
1415 (invoke #$(cc-for-target) "-O2" "-fPIC" "C-readline.c"
1416 "-llua" "-lreadline" "-shared" "-o" shared-object)))
1417 (replace 'install
1418 (lambda _
1419 (install-file shared-object lua-cpath)
1420 (install-file "readline.lua" lua-path)))))))
1421 (inputs (list lua readline))
1422 (home-page "https://peterbillam.gitlab.io/pjb_lua/lua/readline.html")
1423 (synopsis "Simple Lua interface to the readline and history libraries")
1424 (description
1425 "This Lua module offers an interface to the GNU readline library.
1426
1427The function @code{readline()} is a wrapper, which invokes the GNU readline,
1428adds the line to the end of the history list, and then returns the line.
1429Usually you call @code{save_history()} before the program exits,
1430so that the history list is saved to the @code{histfile}.
1431
1432This Lua module can dialogue with the user on the controlling-terminal
1433of the process (typically @file{/dev/tty}) as returned by @code{ctermid()}.
1434It also support most of readline's alternative interface, namely
1435@code{handler_install}, @code{read_char} and @code{handler_remove},
1436and readline's custom completion.")
1437 (license license:expat)))
1438
1439(define-public lua5.1-readline
1440 (make-lua-readline "lua5.1-readline" lua-5.1))
1441
1442(define-public lua5.2-readline
1443 (make-lua-readline "lua5.2-readline" lua-5.2))
1444
1445(define-public lua-readline
1446 (make-lua-readline "lua-readline" lua))
1447
1448(define-public lua5.4-readline
1449 (make-lua-readline "lua5.4-readline" lua-5.4))
1450
1451(define-public lua5.5-readline
1452 (make-lua-readline "lua5.5-readline" lua-5.5))
1453
1387(define (make-lua-scintillua name lua lua-lpeg lua-filesystem) 1454(define (make-lua-scintillua name lua lua-lpeg lua-filesystem)
1388 (package 1455 (package
1389 (name name) 1456 (name name)