From: Timo Wilken <guix@twilken.net>
To: 61774@debbugs.gnu.org
Cc: Timo Wilken <guix@twilken.net>
Subject: [bug#61774] [PATCH] gnu: luarocks: Add for Lua 5.2 and fix dependencies.
Date: Sun, 26 Feb 2023 17:08:19 +0100 [thread overview]
Message-ID: <20230226160817.12138-1-guix@twilken.net> (raw)
In-Reply-To: <20230224224613.25630-1-guix@twilken.net>
Luarocks requires some external binaries, which should be set in its
config file instead of relying on the calling user's PATH containing
them.
Also, for use with Prosody, luarocks needs to be built against Lua
5.2, so provide multiple versions of the package, like for other Lua
packages.
* gnu/packages/lua.scm (make-luarocks): New function.
* gnu/packages/lua.scm (lua5.2-luarocks): New variable.
---
gnu/packages/lua.scm | 94 ++++++++++++++++++++++++++++++++++++--------
1 file changed, 78 insertions(+), 16 deletions(-)
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 3d18e18ca9..4771fa1d42 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -47,11 +47,15 @@ (define-module (gnu packages lua)
#:use-module (guix build-system meson)
#:use-module (guix build-system trivial)
#:use-module (gnu packages)
+ #:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages boost)
+ #:use-module (gnu packages curl)
#:use-module (gnu packages build-tools)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages gcc)
#:use-module (gnu packages glib)
+ #:use-module (gnu packages gnupg)
#:use-module (gnu packages gtk)
#:use-module (gnu packages libevent)
#:use-module (gnu packages libffi)
@@ -61,11 +65,15 @@ (define-module (gnu packages lua)
#:use-module (gnu packages pretty-print)
#:use-module (gnu packages re2c)
#:use-module (gnu packages readline)
+ #:use-module (gnu packages rsync)
+ #:use-module (gnu packages ssh)
#:use-module (gnu packages tls)
+ #:use-module (gnu packages version-control)
#:use-module (gnu packages vim)
+ #:use-module (gnu packages wget)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
- #:use-module (srfi srfi-1))
+ #:use-module ((srfi srfi-1) #:hide (zip)))
(define-public lua
(package
@@ -1142,21 +1150,69 @@ (define-public luarocks
"1nsfp7cwqcxa8vmkcqkgi5wc0iax0j3gbdfd183kw81cq3nf99mw"))))
(build-system gnu-build-system)
(arguments
- '(#:tests? #f ;upstream has no tests
- #:phases (modify-phases %standard-phases
- (add-before 'build 'patch-bin-sh
- (lambda* (#:key inputs #:allow-other-keys)
- (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
- "src/luarocks/core/sysdetect.lua")
- (("/bin/sh")
- (string-append (assoc-ref inputs "bash-minimal")
- "/bin/sh")))))
- (replace 'configure
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- (invoke "./configure"
- (string-append "--prefix=" out))))))))
- (inputs (list lua bash-minimal))
+ `(#:tests? #f ;upstream has no tests
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'patch-bin-sh
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* '("GNUmakefile" "src/luarocks/fs/unix.lua"
+ "src/luarocks/core/sysdetect.lua")
+ (("/bin/sh")
+ (string-append (assoc-ref inputs "bash-minimal")
+ "/bin/sh")))))
+ (replace 'configure
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (invoke "./configure"
+ (string-append "--prefix=" out)))))
+ (add-after 'install 'patch-unzip
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute*
+ (string-append
+ (assoc-ref outputs "out") "/etc/luarocks/config-"
+ ,(substring (package-version lua) 0 3) ".lua") ;e.g. "5.2"
+ (("variables = \\{")
+ (string-append
+ "variables = {\n"
+ " AR = \"" (assoc-ref inputs "binutils") "/bin/ar\";\n"
+ " BUNZIP2 = \"" (assoc-ref inputs "bzip2") "/bin/bunzip2\";\n"
+ " CC = \"" (assoc-ref inputs "gcc") "/bin/gcc\";\n"
+ " CHMOD = \"" (assoc-ref inputs "coreutils") "/bin/chmod\";\n"
+ " CMAKE = \"" (assoc-ref inputs "coreutils") "/bin/cmake\";\n"
+ " CP = \"" (assoc-ref inputs "coreutils") "/bin/cp\";\n"
+ " CURL = \"" (assoc-ref inputs "curl") "/bin/curl\";\n"
+ " CVS = \"" (assoc-ref inputs "cvs") "/bin/cvs\";\n"
+ " FIND = \"" (assoc-ref inputs "findutils") "/bin/find\";\n"
+ " GIT = \"" (assoc-ref inputs "git") "/bin/git\";\n"
+ " GPG = \"" (assoc-ref inputs "gnupg") "/bin/gpg\";\n"
+ " GUNZIP = \"" (assoc-ref inputs "gzip") "/bin/gunzip\";\n"
+ " HG = \"" (assoc-ref inputs "mercurial") "/bin/hg\";\n"
+ " LD = \"" (assoc-ref inputs "binutils") "/bin/ld\";\n"
+ " LS = \"" (assoc-ref inputs "coreutils") "/bin/ls\";\n"
+ " MAKE = \"" (assoc-ref inputs "make") "/bin/make\";\n"
+ " MD5SUM = \"" (assoc-ref inputs "coreutils") "/bin/md5sum\";\n"
+ " MKDIR = \"" (assoc-ref inputs "coreutils") "/bin/mkdir\";\n"
+ " MKTEMP = \"" (assoc-ref inputs "coreutils") "/bin/mktemp\";\n"
+ " OPENSSL = \"" (assoc-ref inputs "openssl") "/bin/openssl\";\n"
+ " PWD = \"" (assoc-ref inputs "coreutils") "/bin/pwd\";\n"
+ " RANLIB = \"" (assoc-ref inputs "binutils") "/bin/ranlib\";\n"
+ " RM = \"" (assoc-ref inputs "coreutils") "/bin/rm\";\n"
+ " RMDIR = \"" (assoc-ref inputs "coreutils") "/bin/rmdir\";\n"
+ " RSYNC = \"" (assoc-ref inputs "rsync") "/bin/rsync\";\n"
+ " SCP = \"" (assoc-ref inputs "openssh") "/bin/scp\";\n"
+ " SEVENZ = \"" (assoc-ref inputs "p7zip") "/bin/7z\";\n"
+ " SVN = \"" (assoc-ref inputs "subversion") "/bin/svn\";\n"
+ " TAR = \"" (assoc-ref inputs "tar") "/bin/tar\";\n"
+ " TEST = \"" (assoc-ref inputs "coreutils") "/bin/test\";\n"
+ " TOUCH = \"" (assoc-ref inputs "coreutils") "/bin/touch\";\n"
+ " UNZIP = \"" (assoc-ref inputs "unzip") "/bin/unzip -n\";\n"
+ " WGET = \"" (assoc-ref inputs "wget") "/bin/wget\";\n"
+ " ZIP = \"" (assoc-ref inputs "zip") "/bin/zip\";"))))))))
+ (inputs (list lua bash-minimal
+ ;; Executables required by luarocks.
+ binutils bzip2 coreutils curl cvs findutils gcc git gnupg
+ gzip gnu-make mercurial openssh openssl p7zip rsync
+ subversion tar unzip wget zip))
(native-inputs (list unzip))
(synopsis "A package manager for Lua modules")
(description
@@ -1176,6 +1232,12 @@ (define-public luarocks
;; "LuaRocks is free software and uses the same license as Lua."
(license license:x11)))
+(define-public lua5.2-luarocks
+ (make-luarocks "lua5.2-luarocks" lua-5.2))
+
+(define-public luarocks
+ (make-luarocks "luarocks" lua))
+
(define-public emilua
(package
(name "emilua")
--
2.39.1
next prev parent reply other threads:[~2023-02-26 16:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 22:46 [bug#61774] [PATCH] gnu: Add luarocks Timo Wilken
2023-02-26 16:08 ` Timo Wilken [this message]
2023-03-30 21:14 ` Ludovic Courtès
2024-05-26 11:26 ` bug#61774: " Andrew Tropin via Guix-patches via
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230226160817.12138-1-guix@twilken.net \
--to=guix@twilken.net \
--cc=61774@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).