From 718552eca4196dcc9d20bd2c24a7f1e2857e6518 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 4 Feb 2018 10:13:06 +0100 Subject: [PATCH] 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 --- pkgs/top-level/lua-packages.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index b91f9dae9f0..d80c43b03f5 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -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;