Install devel/lua-lgi (version 0.7.1). Try to run the samples/gtkhello.lua example from lgi distribution. Alternatively, run lua-5.1 and type this: lgi = require("lgi") gtk = lgi.Gtk You'll get this error: /usr/local/share/lua/5.1/lgi/override/Gdk.lua:57: attempt to index field 'RGBA' (a nil value) stack traceback: /usr/local/share/lua/5.1/lgi/override/Gdk.lua:57: in main chunk [C]: in function 'require' /usr/local/share/lua/5.1/lgi/namespace.lua:176: in function 'require' /usr/local/share/lua/5.1/lgi/namespace.lua:163: in function </usr/local/share/lua/5.1/lgi/namespace.lua:148> (tail call): ? stdin:1: in main chunk [C]: ? This happens because 'Gdk.RGBA' only exists in Gtk3, not Gtk2. The fix is to apply the patch from commit 8000f6d [1]. (See the attached patch). [1] https://github.com/pavouk/lgi/commit/8000f6d1362fc38ebe349119554d291f6226e04e Fix: Patch attached with submission follows:
Responsible Changed From-To: freebsd-ports-bugs->lua lua@ wants this port PRs (via the GNATS Auto Assign Tool)
State Changed From-To: open->feedback Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Maintainer of devel/lua-lgi, Please note that PR ports/179960 has just been submitted. If it contains a patch for an upgrade, an enhancement or a bug fix you agree on, reply to this email stating that you approve the patch and a committer will take care of it. The full text of the PR can be found at: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/179960 -- Edwin Groothuis via the GNATS Auto Assign Tool edwin@FreeBSD.org
Vitaly, is this still a problem? Apparently I can require lgi and then intantiate a Gtk object fine, and lua-5.1 samples/gtkhello.lua appears to work fine, too, for me, and I have linked against Gtk+2: > $ ldd /usr/local/lib/lua/5.1/lgi/corelgilua51.so | grep libg > libgirepository-1.0.so.1 => /usr/local/lib/libgirepository-1.0.so.1 (0x801217000) > libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x80144a000) > libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x801697000) > libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x80189a000) > libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x8023e7000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x804fa5000) Best regards, Matthias
Matthias Andree wrote: > is this still a problem? Yes, although the example I provided should be corrected in the case you have Gtk3 installed: lgi = require 'lgi' gtk = lgi.require("Gtk", "2.0")
Author: mandree Date: Tue Aug 6 01:01:30 2013 New Revision: 324297 URL: http://svnweb.freebsd.org/changeset/ports/324297 Log: Fix compatibility with GTK+ v2.x, which does not provide Gdk.RGBA. (GTK+ v3.x does provide that). PR: 179960 Submitted by: Vitaly Magerya <vmagerya@gmail.com> Approved by: (maintainer timeout, 6 weeks; port signed over to lua@) Obtained from: <https://github.com/pavouk/lgi/commit/8000f6d1362fc38ebe349119554d291f6226e04e> Added: head/devel/lua-lgi/files/patch-lgi-override-Gdk.lua (contents, props changed) Modified: head/devel/lua-lgi/Makefile Modified: head/devel/lua-lgi/Makefile ============================================================================== --- head/devel/lua-lgi/Makefile Tue Aug 6 00:32:08 2013 (r324296) +++ head/devel/lua-lgi/Makefile Tue Aug 6 01:01:30 2013 (r324297) @@ -2,6 +2,7 @@ PORTNAME= lgi PORTVERSION= 0.7.1 +PORTREVISION= 1 CATEGORIES= devel PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX} Added: head/devel/lua-lgi/files/patch-lgi-override-Gdk.lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/lua-lgi/files/patch-lgi-override-Gdk.lua Tue Aug 6 01:01:30 2013 (r324297) @@ -0,0 +1,31 @@ +--- lgi/override/Gdk.lua.orig 2013-06-25 14:33:15.000000000 +0300 ++++ lgi/override/Gdk.lua 2013-06-25 14:34:28.000000000 +0300 +@@ -54,16 +54,18 @@ + } do Gdk._constant[name] = Gdk.Atom(val) end + + -- Easier-to-use Gdk.RGBA.parse() override. +-local parse = Gdk.RGBA.parse +-function Gdk.RGBA._method.parse(arg1, arg2) +- if Gdk.RGBA:is_type_of(arg1) then +- -- Standard member method. +- return parse(arg1, arg2) +- else +- -- Static constructor variant. +- local rgba = Gdk.RGBA() +- return parse(rgba, arg1) and rgba or nil +- end ++if Gdk.RGBA then ++ local parse = Gdk.RGBA.parse ++ function Gdk.RGBA._method.parse(arg1, arg2) ++ if Gdk.RGBA:is_type_of(arg1) then ++ -- Standard member method. ++ return parse(arg1, arg2) ++ else ++ -- Static constructor variant. ++ local rgba = Gdk.RGBA() ++ return parse(rgba, arg1) and rgba or nil ++ end ++ end + end + + -- Gdk.Window.destroy() actually consumes 'self'. Prepare workaround _______________________________________________ svn-ports-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-ports-all To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
State Changed From-To: feedback->closed Committed. Thanks!
The lgi.require("Gtk", "2.0") was the bit I missed when trying to reproduce your problem. Thank you, I have now committed Andreas's patch that you've submitted.