lgi: Fix cairo bindings search path

Since commit e44038bccab0cae, cairo-1.0.typelib contains an absolute
path to cairo in the nix store so that no $LD_LIBRARY_PATH hacks are
needed. However, this did not yet work for lgi, because lgi does
dlopen("libcairo.so.2") without a full path, too.

To make this work, this commit ensures that lgi first uses
gobject-introspection to load libcairo. This uses the full path provided
by the typelib. Afterwards, dlopen("libcairo.so.2") does not hit the
filesystem anymore since the library is already loaded.

This commit adds a patch that reorders some code in lgi's cairo
initialisation. Previously, this started with core.module('cairo', 2),
which is where the dlopen happens. Now, this code is moved down and
instead core.gi.cairo.resolve is used to load the definitions of some
enums first. This part of the code goes through gobject-introspection
and causes libcairo to be loaded.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2018-02-04 10:13:06 +01:00
parent 7e0b231b53
commit 718552eca4

@ -9,7 +9,7 @@
, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat, cairo
, perl, gtk2, python, glib, gobjectIntrospection, libevent, zlib, autoreconfHook
, mysql, postgresql, cyrus_sasl
, fetchFromGitHub, libmpack, which
, fetchFromGitHub, libmpack, which, fetchpatch
}:
let
@ -671,6 +671,14 @@ let
sed -i "s|/usr/local|$out|" lgi/Makefile
'';
patches = [
(fetchpatch {
name = "lgi-find-cairo-through-typelib.patch";
url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
})
];
meta = with stdenv.lib; {
description = "GObject-introspection based dynamic Lua binding to GObject based libraries";
homepage = https://github.com/pavouk/lgi;