From 468f931f873e717d9e16e57e466ea82befbc4e77 Mon Sep 17 00:00:00 2001 From: aszlig Date: Thu, 2 Jun 2016 16:29:16 +0200 Subject: [PATCH] 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 Cc: @cillianderoiste, @urkud --- .../libraries/aqbanking/default.nix | 8 +++++- .../libraries/gwenhywfar/default.nix | 28 ++++++++++++++++++- 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,\,"${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 ];