summary refs log tree commit diff
path: root/pkgs/top-level/lua-packages.nix
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2018-02-04 10:13:06 +0100
committerUli Schlachter <psychon@znc.in>2018-02-04 11:23:35 +0100
commit718552eca4196dcc9d20bd2c24a7f1e2857e6518 (patch)
treee32d890df6595bd9f003250bce0658a6702e750f /pkgs/top-level/lua-packages.nix
parent7e0b231b5386ce8c2b88f204621e318a361b8fa2 (diff)
downloadnixlib-718552eca4196dcc9d20bd2c24a7f1e2857e6518.tar
nixlib-718552eca4196dcc9d20bd2c24a7f1e2857e6518.tar.gz
nixlib-718552eca4196dcc9d20bd2c24a7f1e2857e6518.tar.bz2
nixlib-718552eca4196dcc9d20bd2c24a7f1e2857e6518.tar.lz
nixlib-718552eca4196dcc9d20bd2c24a7f1e2857e6518.tar.xz
nixlib-718552eca4196dcc9d20bd2c24a7f1e2857e6518.tar.zst
nixlib-718552eca4196dcc9d20bd2c24a7f1e2857e6518.zip
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>
Diffstat (limited to 'pkgs/top-level/lua-packages.nix')
-rw-r--r--pkgs/top-level/lua-packages.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix
index b91f9dae9f04..d80c43b03f52 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;