>From 995b67847508a70782eb522cda52b0aa36a20bd2 Mon Sep 17 00:00:00 2001 From: doncatnip Date: Thu, 25 Aug 2016 02:22:37 +0200 Subject: [PATCH 2/3] gnu: lua: Add lua-lgi. * gnu/packages/lua.scm (lua-lgi): New variable. --- gnu/packages/lua.scm | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index c68a3ff..8af0318 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm @@ -27,7 +27,12 @@ #:use-module (guix download) #:use-module (guix build-system gnu) #:use-module (gnu packages) - #:use-module (gnu packages readline)) + #:use-module (gnu packages readline) + #:use-module (gnu packages glib) + #:use-module (gnu packages libffi) + #:use-module (gnu packages xorg) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages gtk)) (define-public lua (package @@ -111,3 +116,67 @@ programming language. Lua is a powerful, dynamic and light-weight programming language. It may be embedded or used as a general-purpose, stand-alone language.") (license x11))) + +(define-public lua-lgi + (package + (name "lua-lgi") + (version "0.9.1") + (source + (origin + (method url-fetch) + (uri (string-append + "https://github.com/pavouk/lgi/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 (base32 "1fmgdl5y4ph3yc6ycg865s3vai1rjkyda61cgqxk6zd13hmznw0c")))) + (build-system gnu-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key inputs #:allow-other-keys) + ; needs to load cairo dynamically + (let* ((cairo (string-append + (assoc-ref inputs "cairo") "/lib" ))) + (setenv "LD_LIBRARY_PATH" cairo )) + + ; FIXME: Skip GTK tests: + ; gtk3 - can't get it to run with the xorg-server config below + ; and some non-gtk tests will also fail + ; gtk2 - lots of functions aren't implemented + ; We choose gtk2 as the lesser evil and simply skip the test. + ; as of 22/08/2016 awesome is the only package dependent on lgi but + ; it doesn't need or interact with gtk using lgi. + (substitute* "./tests/test.lua" + (("'gtk.lua',") "-- 'gtk.lua',")) + ; lua version and therefore install directories are hardcoded + (substitute* "./lgi/Makefile" + (("LUA_VERSION=5.1") "LUA_VERSION=5.2")) + + ;; There must be a running X server during tests. + (system (format #f "~a/bin/Xvfb :1 &" (assoc-ref inputs "xorg-server"))) + (setenv "DISPLAY" ":1")))) + + #:make-flags + (let ((out (assoc-ref %outputs "out"))) + (list "CC=gcc" + (string-append "PREFIX=" (assoc-ref %outputs "out")))))) + + (inputs + `(("gobject-introspection" ,gobject-introspection) + ("glib" ,glib) + ("pango", pango) + ("gtk", gtk+-2) + ("lua" ,lua) + ("cairo" ,cairo) + ("libffi" ,libffi) + ("xorg-server", xorg-server))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (home-page "https://github.com/pavouk/lgi/") + (synopsis "Lua bridge to GObject based libraries") + (description + "LGI is gobject-introspection based dynamic Lua binding to GObject +based libraries. It allows using GObject-based libraries directly from Lua. +Notable examples are GTK+, GStreamer and Webkit.") + (license expat))) -- 2.9.3