summary refs log tree commit diff
path: root/pkgs/development/libraries/grantlee
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@mailbox.org>2017-05-19 09:16:26 -0500
committerThomas Tuegel <ttuegel@mailbox.org>2017-08-21 06:51:18 -0500
commit5a609e389a28915c949c4c37d304c6ebf52adbb2 (patch)
tree97c659605df49d3e9d510efa267472fb59bafffa /pkgs/development/libraries/grantlee
parent548f52c0a3b7861f2895843bf0c6de9111ec3985 (diff)
downloadnixpkgs-5a609e389a28915c949c4c37d304c6ebf52adbb2.tar
nixpkgs-5a609e389a28915c949c4c37d304c6ebf52adbb2.tar.gz
nixpkgs-5a609e389a28915c949c4c37d304c6ebf52adbb2.tar.bz2
nixpkgs-5a609e389a28915c949c4c37d304c6ebf52adbb2.tar.lz
nixpkgs-5a609e389a28915c949c4c37d304c6ebf52adbb2.tar.xz
nixpkgs-5a609e389a28915c949c4c37d304c6ebf52adbb2.tar.zst
nixpkgs-5a609e389a28915c949c4c37d304c6ebf52adbb2.zip
grantlee5: multiple outputs
Diffstat (limited to 'pkgs/development/libraries/grantlee')
-rw-r--r--pkgs/development/libraries/grantlee/5/default.nix23
-rw-r--r--pkgs/development/libraries/grantlee/5/setup-hook.sh23
2 files changed, 43 insertions, 3 deletions
diff --git a/pkgs/development/libraries/grantlee/5/default.nix b/pkgs/development/libraries/grantlee/5/default.nix
index 7025877c847..571ad98c38c 100644
--- a/pkgs/development/libraries/grantlee/5/default.nix
+++ b/pkgs/development/libraries/grantlee/5/default.nix
@@ -1,8 +1,10 @@
-{ stdenv, lib, copyPathsToStore, fetchurl, qtbase, qtscript, cmake }:
+{ mkDerivation, lib, copyPathsToStore, fetchurl, qtbase, qtscript, cmake }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "grantlee-${version}";
   version = "5.1.0";
+  grantleeCompatVersion = "5.1";
+  grantleePluginPrefix = "lib/grantlee/${grantleeCompatVersion}";
 
   src = fetchurl {
     url = "https://github.com/steveire/grantlee/archive/v${version}.tar.gz";
@@ -15,7 +17,22 @@ stdenv.mkDerivation rec {
   buildInputs = [ qtbase qtscript ];
   nativeBuildInputs = [ cmake ];
 
-  meta = with stdenv.lib; {
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$grantleePluginPrefix" "$bin"
+
+    # CMake checks that the provided libraries and plugins exist
+    # Link libraries into $dev to satisfy CMake
+    mkdir -p $dev/lib
+    find $out/lib -name '*.so.*' -exec ln -s \{\} $dev/lib \;
+
+    # Link plugins into $dev to satisfy CMake
+    ln -s $bin/lib/grantlee $dev/lib
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  meta = with lib; {
     description = "Qt5 port of Django template system";
     longDescription = ''
       Grantlee is a plugin based String Template system written using the Qt
diff --git a/pkgs/development/libraries/grantlee/5/setup-hook.sh b/pkgs/development/libraries/grantlee/5/setup-hook.sh
new file mode 100644
index 00000000000..d11ef5883a1
--- /dev/null
+++ b/pkgs/development/libraries/grantlee/5/setup-hook.sh
@@ -0,0 +1,23 @@
+grantleePluginPrefix=@grantleePluginPrefix@
+
+providesGrantleeRuntime() {
+    [ -d "$1/$grantleePluginPrefix" ]
+}
+
+_grantleeCrossEnvHook() {
+    if providesQtRuntime "$1"; then
+        propagatedBuildInputs+=" $1"
+        propagatedUserEnvPkgs+=" $1"
+    fi
+}
+crossEnvHooks+=(_grantleeCrossEnvHook)
+
+_grantleeEnvHook() {
+    if providesGrantleeRuntime "$1"; then
+        propagatedNativeBuildInputs+=" $1"
+        if [ -z "$crossConfig" ]; then
+        propagatedUserEnvPkgs+=" $1"
+        fi
+    fi
+}
+envHooks+=(_grantleeEnvHook)