diff options
| author | Nguyễn Gia Phong <cnx@loang.net> | 2026-04-01 03:22:00 +0900 |
|---|---|---|
| committer | Nguyễn Gia Phong <cnx@loang.net> | 2026-04-08 13:07:55 +0900 |
| commit | 5ab1c341581ae922b22d885688dcb7590e609c84 (patch) | |
| tree | 6e8cf64b2ed0945afb8347091a3543f6ecd75b1b /gnu/packages/lua.scm | |
| parent | 1bfc951376ebb55830d7e7daba483c77fe8bee0c (diff) | |
gnu: Add lua-scintillua.
* gnu/packages/lua.scm (lua-scintillua, lua5.4-scintillua):
New variables.
Change-Id: Idd90f8b2bfef8002dbb2f5172717d43895fd9f4f
Diffstat (limited to 'gnu/packages/lua.scm')
| -rw-r--r-- | gnu/packages/lua.scm | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index fd737d4d0c6..369e05bb3b7 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm | |||
| @@ -1308,6 +1308,85 @@ for syntax highlighting or a linting tool.") | |||
| 1308 | (native-inputs (list pandoc)) | 1308 | (native-inputs (list pandoc)) |
| 1309 | (inputs (list luajit)))) | 1309 | (inputs (list luajit)))) |
| 1310 | 1310 | ||
| 1311 | (define (make-lua-scintillua name lua lua-lpeg lua-filesystem) | ||
| 1312 | (package | ||
| 1313 | (name name) | ||
| 1314 | (version "6.6") | ||
| 1315 | (source | ||
| 1316 | (origin | ||
| 1317 | (method git-fetch) | ||
| 1318 | (uri (git-reference | ||
| 1319 | (url "https://github.com/orbitalquark/scintillua") | ||
| 1320 | (commit (string-append "scintillua_" version)))) | ||
| 1321 | (file-name (git-file-name name version)) | ||
| 1322 | (sha256 | ||
| 1323 | (base32 "121ilpy91wyprqp3la4xzbb60i2yp1xpnvjlahzgzg0vck48njm7")))) | ||
| 1324 | (build-system gnu-build-system) | ||
| 1325 | (arguments | ||
| 1326 | (list | ||
| 1327 | #:phases | ||
| 1328 | #~(let* ((lua-api-version #$(version-major+minor (package-version lua))) | ||
| 1329 | (lua-cpath (string-append "/lib/lua/" lua-api-version)) | ||
| 1330 | (lua-path (string-append "/share/lua/" lua-api-version)) | ||
| 1331 | (scintillua (string-append #$output lua-path "/scintillua")) | ||
| 1332 | (lexers (string-append scintillua "/lexers"))) | ||
| 1333 | (modify-phases %standard-phases | ||
| 1334 | (delete 'configure) | ||
| 1335 | (delete 'build) | ||
| 1336 | (delete 'check) ;move after install | ||
| 1337 | (replace 'install | ||
| 1338 | (lambda _ | ||
| 1339 | (mkdir-p scintillua) | ||
| 1340 | (copy-recursively "lexers" lexers) | ||
| 1341 | (substitute* (string-append lexers "/lexer.lua") | ||
| 1342 | (("package\\.path") | ||
| 1343 | (string-append "('" lexers "/?.lua;' .. package.path)"))) | ||
| 1344 | (with-output-to-file (string-append scintillua "/init.lua") | ||
| 1345 | (lambda () | ||
| 1346 | (display | ||
| 1347 | "return require'scintillua.lexers.lexer'\n"))))) | ||
| 1348 | (add-after 'install 'set-lua-path | ||
| 1349 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 1350 | (let ((input-dirs (map cdr (alist-delete "source" inputs)))) | ||
| 1351 | (setenv "GUIX_LUA_CPATH" | ||
| 1352 | (string-join | ||
| 1353 | (map (lambda (prefix) | ||
| 1354 | (string-append prefix lua-cpath)) | ||
| 1355 | input-dirs) | ||
| 1356 | ";")) | ||
| 1357 | (setenv "GUIX_LUA_PATH" | ||
| 1358 | (string-join | ||
| 1359 | (map (lambda (prefix) | ||
| 1360 | (string-append prefix lua-path)) | ||
| 1361 | (cons #$output input-dirs)) | ||
| 1362 | ";"))))) | ||
| 1363 | (add-after 'set-lua-path 'check | ||
| 1364 | (lambda _ | ||
| 1365 | (substitute* "tests.lua" | ||
| 1366 | (("^package\\.path = .*") "") | ||
| 1367 | (("require\\('lexer'\\)") "require'scintillua'") | ||
| 1368 | (("'lexers'") (string-append "'" lexers "'")) | ||
| 1369 | (("test_lua51" all) | ||
| 1370 | (string-append "skip_" all))) | ||
| 1371 | (invoke "lua" "tests.lua"))))))) | ||
| 1372 | (native-inputs (list lua)) | ||
| 1373 | (propagated-inputs (list lua-lpeg lua-filesystem)) | ||
| 1374 | (home-page "https://orbitalquark.github.io/scintillua/") | ||
| 1375 | (synopsis "Collection of LPeg lexer for source code") | ||
| 1376 | (description | ||
| 1377 | "This Lua library provides LPeg lexers for source code syntax | ||
| 1378 | highlighting. It can either be used by itself or as a drop-in replacement | ||
| 1379 | for Scintilla lexers.") | ||
| 1380 | (license license:expat))) | ||
| 1381 | |||
| 1382 | (define-public lua-scintillua | ||
| 1383 | (make-lua-scintillua "lua-scintillua" lua | ||
| 1384 | lua-lpeg lua-filesystem)) | ||
| 1385 | |||
| 1386 | (define-public lua5.4-scintillua | ||
| 1387 | (make-lua-scintillua "lua5.4-scintillua" lua-5.4 | ||
| 1388 | lua5.4-lpeg lua5.4-filesystem)) | ||
| 1389 | |||
| 1311 | (define-public lutok | 1390 | (define-public lutok |
| 1312 | (package | 1391 | (package |
| 1313 | (name "lutok") | 1392 | (name "lutok") |
