From 57a998f52e2d77e758ff339d03f26556b3b9c63f Mon Sep 17 00:00:00 2001 From: doncatnip Date: Thu, 1 Sep 2016 23:53:32 +0200 Subject: [PATCH 2/3] gnu: lua: Add lua-lgi. * gnu/packages/lua.scm (lua-lgi): New variable. --- gnu/packages/lua.scm | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm index 9f19cc9..cdc28b0 100644 --- a/gnu/packages/lua.scm +++ b/gnu/packages/lua.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2014 Andreas Enge ;;; Copyright © 2016 Efraim Flashner ;;; Copyright © 2016 Ricardo Wurmus +;;; Copyright © 2016 doncatnip ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,7 +30,12 @@ #:use-module (gnu packages) #:use-module (gnu packages readline) #:use-module (gnu packages tls) - #:use-module (gnu packages xml)) + #:use-module (gnu packages xml) + #:use-module (gnu packages glib) + #:use-module (gnu packages libffi) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages xorg) + #:use-module (gnu packages gtk)) (define-public lua (package @@ -259,3 +265,72 @@ directory structure and file attributes.") communication. It takes an already established TCP connection and creates a secure session between the peers.") (license (package-license lua-5.1)))) + +(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 + (delete 'configure) ; no configure script + (add-before 'build 'set-env + (lambda* (#:key inputs #:allow-other-keys) + ; we need to load cairo dynamically + (let* ((cairo (string-append + (assoc-ref inputs "cairo") "/lib" ))) + (setenv "LD_LIBRARY_PATH" cairo )))) + (add-before 'build 'set-lua-version + (lambda _ + ; lua version and therefore install directories are hardcoded + ; FIXME: This breaks when we update lua to >=5.3 + (substitute* "./lgi/Makefile" + (("LUA_VERSION=5.1") "LUA_VERSION=5.2")))) + (add-before 'check 'skip-test-gtk + (lambda _ + ; 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 01/09/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',")))) + (add-before 'check 'start-xserver-instance + (lambda* (#:key inputs #:allow-other-keys) + ;; 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 (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 license:expat))) -- 2.9.3