···11+Reorder some code so that the cairo-gobject library is used before this tries to
22+dlopen("libcairo.so.2"). Since cairo-gobject depends (RT_DEPEND) on cairo, this
33+causes cairo to be used and so the missing search path for the dlopen() call is
44+not a problem.
55+66+diff --git a/lgi/override/cairo.lua b/lgi/override/cairo.lua
77+index ca8193f..019239b 100644
88+--- a/lgi/override/cairo.lua
99++++ b/lgi/override/cairo.lua
1010+@@ -20,18 +20,8 @@ local record = require 'lgi.record'
1111+ local enum = require 'lgi.enum'
1212+ local ti = ffi.types
1313+1414+-cairo._module = core.module('cairo', 2)
1515+ local module_gobject = core.gi.cairo.resolve
1616+1717+--- Versioning support.
1818+-function cairo.version_encode(major, minor, micro)
1919+- return 10000 * major + 100 * minor + micro
2020+-end
2121+-cairo.version = core.callable.new {
2222+- addr = cairo._module.cairo_version, ret = ti.int } ()
2323+-cairo.version_string = core.callable.new {
2424+- addr = cairo._module.cairo_version_string, ret = ti.utf8 } ()
2525+-
2626+ -- Load some constants.
2727+ cairo._constant = {
2828+ MIME_TYPE_JP2 = 'image/jp2',
2929+@@ -58,6 +48,18 @@ for _, name in pairs {
3030+ end
3131+ end
3232+3333++-- Load libcairo.so directly; this has to happen after the typelib was used
3434++cairo._module = core.module('cairo', 2)
3535++
3636++-- Versioning support.
3737++function cairo.version_encode(major, minor, micro)
3838++ return 10000 * major + 100 * minor + micro
3939++end
4040++cairo.version = core.callable.new {
4141++ addr = cairo._module.cairo_version, ret = ti.int } ()
4242++cairo.version_string = core.callable.new {
4343++ addr = cairo._module.cairo_version_string, ret = ti.utf8 } ()
4444++
4545+ -- Load definitions of all boxed records.
4646+ cairo._struct = cairo._struct or {}
4747+ for index, struct in pairs {
+2
pkgs/top-level/lua-packages.nix
···671671 sed -i "s|/usr/local|$out|" lgi/Makefile
672672 '';
673673674674+ patches = [ ./lgi-find-cairo-through-typelib.patch ];
675675+674676 meta = with stdenv.lib; {
675677 description = "GObject-introspection based dynamic Lua binding to GObject based libraries";
676678 homepage = https://github.com/pavouk/lgi;