summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2017-11-25 03:12:07 +0100
committerClément Lassieur <clement@lassieur.org>2017-11-28 03:49:47 +0100
commit149b2c439e226c62e549bad7eecd649e1a3b8021 (patch)
tree5f579f5006f83eb8e15795a70aac0595e5ec03e0 /gnu/packages
parent1aace3dc34d703ebabc47057dc7efb98e38d2340 (diff)
downloadguix-149b2c439e226c62e549bad7eecd649e1a3b8021.tar.gz
gnu: lua-lpeg: Avoid code repetition.
* gnu/packages/lua.scm (make-lua-lpeg): New procedure.
(lua-lpeg, lua5.2-lpeg): Call make-lua-lpeg.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/lua.scm30
1 files changed, 6 insertions, 24 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index 1667bad8dc..d5f55b9631 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -356,9 +356,9 @@ based libraries.  It allows using GObject-based libraries directly from Lua.
 Notable examples are GTK+, GStreamer and Webkit.")
     (license license:expat)))
 
-(define-public lua-lpeg
+(define (make-lua-lpeg name lua)
   (package
-    (name "lua-lpeg")
+    (name name)
     (version "1.0.1")
     (source (origin
               (method url-fetch)
@@ -390,29 +390,11 @@ Grammars (PEGs).")
     (home-page "http://www.inf.puc-rio.br/~roberto/lpeg")
     (license license:expat)))
 
+(define-public lua-lpeg
+  (make-lua-lpeg "lua-lpeg" lua))
+
 (define-public lua5.2-lpeg
-  (package (inherit lua-lpeg)
-    (name "lua5.2-lpeg")
-    ;; XXX: The arguments field is almost an exact copy of the field in
-    ;; "lua-lpeg", except for the version string, which was derived from "lua"
-    ;; and now is taken from "lua-5.2".  See this discussion for context:
-    ;; http://lists.gnu.org/archive/html/guix-devel/2017-01/msg02048.html
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         ;; `make install` isn't available, so we have to do it manually
-         (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (lua-version ,(version-major+minor (package-version lua-5.2))))
-               (install-file "lpeg.so"
-                             (string-append out "/lib/lua/" lua-version))
-               (install-file "re.lua"
-                             (string-append out "/share/lua/" lua-version))
-               #t))))
-       #:test-target "test"))
-    (inputs `(("lua", lua-5.2)))))
+  (make-lua-lpeg "lua5.2-lpeg" lua-5.2))
 
 ;; Lua 5.3 is not supported.
 (define (make-lua-bitop name lua)