about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-06-02 16:29:16 +0200
committeraszlig <aszlig@redmoonstudios.org>2016-06-04 16:38:57 +0200
commit468f931f873e717d9e16e57e466ea82befbc4e77 (patch)
treefa6a49dd4034f37a9ab8eaa3172902a1614b33db
parente5d6acb5858329a76532a25ca4727cd1b046481d (diff)
downloadnixlib-468f931f873e717d9e16e57e466ea82befbc4e77.tar
nixlib-468f931f873e717d9e16e57e466ea82befbc4e77.tar.gz
nixlib-468f931f873e717d9e16e57e466ea82befbc4e77.tar.bz2
nixlib-468f931f873e717d9e16e57e466ea82befbc4e77.tar.lz
nixlib-468f931f873e717d9e16e57e466ea82befbc4e77.tar.xz
nixlib-468f931f873e717d9e16e57e466ea82befbc4e77.tar.zst
nixlib-468f931f873e717d9e16e57e466ea82befbc4e77.zip
gwenhywfar: Unify plugin directories
Having something like $out/lib/gwenhywfar/plugins/60 when on Nix is a
bit pointless, because we won't have something like a central plugin
directory which could contain plugins for older library versions.

Another reason to strip the effective shared object version is that we
really want to avoid the need to track and update the SO version on
every single update.

This makes it way easier to add support for libchipcard and/or other
related packages/plugins.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @cillianderoiste, @urkud
-rw-r--r--pkgs/development/libraries/aqbanking/default.nix8
-rw-r--r--pkgs/development/libraries/gwenhywfar/default.nix28
2 files changed, 34 insertions, 2 deletions
diff --git a/pkgs/development/libraries/aqbanking/default.nix b/pkgs/development/libraries/aqbanking/default.nix
index ee985e709417..7fd511f42725 100644
--- a/pkgs/development/libraries/aqbanking/default.nix
+++ b/pkgs/development/libraries/aqbanking/default.nix
@@ -16,11 +16,17 @@ stdenv.mkDerivation rec {
     sha256 = "1x0isvpk43rq2zlyyb9p0kgjmqv7yq07vgkiprw3f5sjkykvxw6d";
   };
 
+  postPatch = ''
+    sed -i -e '/^aqbanking_plugindir=/ {
+      c aqbanking_plugindir="\''${libdir}/gwenhywfar/plugins"
+    }' configure
+  '';
+
   buildInputs = [ gmp gwenhywfar libtool libxml2 libxslt xmlsec zlib ];
 
   nativeBuildInputs = [ pkgconfig ];
 
-  configureFlags = "--with-gwen-dir=${gwenhywfar}";
+  configureFlags = [ "--with-gwen-dir=${gwenhywfar}" ];
 
   meta = with stdenv.lib; {
     description = "An interface to banking tasks, file formats and country information";
diff --git a/pkgs/development/libraries/gwenhywfar/default.nix b/pkgs/development/libraries/gwenhywfar/default.nix
index 8cec26139dea..8fb96e078ac1 100644
--- a/pkgs/development/libraries/gwenhywfar/default.nix
+++ b/pkgs/development/libraries/gwenhywfar/default.nix
@@ -2,7 +2,6 @@
 
 stdenv.mkDerivation rec {
   name = "gwenhywfar-${version}";
-
   version = "4.15.3";
 
   src = let
@@ -15,6 +14,33 @@ stdenv.mkDerivation rec {
     sha256 = "0fp67s932x66xfljb26zbrn8ambbc5y5c3hllr6l284nr63qf3ka";
   };
 
+  postPatch = let
+    pluginSearchPaths = [
+      "/run/current-system/sw/lib/gwenhywfar/plugins"
+      ".nix-profile/lib/gwenhywfar/plugins"
+    ];
+    isRelative = path: builtins.substring 0 1 path != "/";
+    mkSearchPath = path: ''
+      p; g; s,\<PLUGINDIR\>,"${path}",g;
+    '' + stdenv.lib.optionalString (isRelative path) ''
+      s/AddPath(\(.*\));/AddRelPath(\1, GWEN_PathManager_RelModeHome);/g
+    '';
+
+  in ''
+    sed -i -e '/GWEN_PathManager_DefinePath.*GWEN_PM_PLUGINDIR/,/^#endif/ {
+      /^#if/,/^#endif/ {
+        H; /^#endif/ {
+          ${stdenv.lib.concatMapStrings mkSearchPath pluginSearchPaths}
+        }
+      }
+    }' src/gwenhywfar.c
+
+    # Strip off the effective SO version from the path so that for example
+    # "lib/gwenhywfar/plugins/60" becomes just "lib/gwenhywfar/plugins".
+    sed -i -e '/^gwenhywfar_plugindir=/s,/\''${GWENHYWFAR_SO_EFFECTIVE},,' \
+      configure
+  '';
+
   propagatedBuildInputs = [ gnutls libgcrypt ];
 
   buildInputs = [ gtk qt4 ];