From 79ca7f4cb4ab0842fd31ea3c1acfcb6f7baae55e Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 19 Jan 2019 15:47:53 +0100 Subject: [PATCH] vala: add setup hook Add datadir containing vapidir to XDG_DATA_DIRS and move vapipdir to dev output. --- pkgs/development/compilers/vala/default.nix | 7 ++++++- pkgs/development/compilers/vala/setup-hook.sh | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/compilers/vala/setup-hook.sh diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix index 5f21399229a5..d94437b6a167 100644 --- a/pkgs/development/compilers/vala/default.nix +++ b/pkgs/development/compilers/vala/default.nix @@ -1,5 +1,5 @@ { stdenv, lib, fetchurl, fetchpatch, pkgconfig, flex, bison, libxslt, autoconf, automake, autoreconfHook -, graphviz, glib, libiconv, libintl, libtool, expat +, graphviz, glib, libiconv, libintl, libtool, expat, substituteAll }: let @@ -45,6 +45,11 @@ let name = "vala-${version}"; version = "${major}.${minor}"; + setupHook = substituteAll { + src = ./setup-hook.sh; + apiVersion = major; + }; + src = fetchurl { url = "mirror://gnome/sources/vala/${major}/${name}.tar.xz"; inherit sha256; diff --git a/pkgs/development/compilers/vala/setup-hook.sh b/pkgs/development/compilers/vala/setup-hook.sh new file mode 100644 index 000000000000..8252143e998b --- /dev/null +++ b/pkgs/development/compilers/vala/setup-hook.sh @@ -0,0 +1,15 @@ +make_vala_find_vapi_files() { + # XDG_DATA_DIRS: required for finding .vapi files + if [ -d "$1/share/vala/vapi" -o -d "$1/share/vala-@apiVersion@/vapi" ]; then + addToSearchPath XDG_DATA_DIRS $1/share + fi +} + +addEnvHooks "$hostOffset" make_vala_find_vapi_files + +_multioutMoveVapiDirs() { + moveToOutput share/vala/vapi "${!outputDev}" + moveToOutput share/vala-@apiVersion@/vapi "${!outputDev}" +} + +preFixupHooks+=(_multioutMoveVapiDirs)