Subject: [bug#29425] [PATCH] gnu: Add lua5.1-bitop.

From: Clément Lassieur <[email-masked]>
Date: Sat, 25 Nov 2017 03:20:54 +0100

* gnu/packages/lua.scm (lua5.1-bitop): New variable.
(make-lua-bitop): New procedure.
---
 gnu/packages/lua.scm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index c8bc4ef85..9708b6012 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -415,9 +415,9 @@ Grammars (PEGs).")
     (inputs `(("lua", lua-5.2)))))
 
 ;; Lua 5.3 is not supported.
-(define-public lua5.2-bitop
+(define (make-lua-bitop name lua)
   (package
-    (name "lua5.2-bitop")
+    (name name)
     (version "1.0.2")
     (source (origin
               (method url-fetch)
@@ -434,15 +434,21 @@ Grammars (PEGs).")
              (string-append "INSTALLPATH=printf "
                             (assoc-ref %outputs "out")
                             "/lib/lua/"
-                            ,(version-major+minor (package-version lua-5.2))
+                            ,(version-major+minor (package-version lua))
                             "/bit/bit.so"))
        #:phases
        (modify-phases %standard-phases
          (delete 'configure))))
-    (inputs `(("lua", lua-5.2)))
+    (inputs `(("lua", lua)))
     (home-page "http://bitop.luajit.org/index.html")
     (synopsis "Bitwise operations on numbers for Lua")
     (description
      "Lua BitOp is a C extension module for Lua which adds bitwise operations
 on numbers.")
     (license license:expat)))
+
+(define-public lua5.2-bitop
+  (make-lua-bitop "lua5.2-bitop" lua-5.2))
+
+(define-public lua5.1-bitop
+  (make-lua-bitop "lua5.1-bitop" lua-5.1))
-- 
2.15.0