nixpkgs/pkgs/development/compilers/vala/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
3.6 KiB
Nix
Raw Normal View History

{ stdenv, lib, fetchurl, fetchpatch, pkg-config, flex, bison, libxslt, autoconf, autoreconfHook
2022-06-12 22:57:17 +02:00
, gnome, graphviz, glib, libiconv, libintl, libtool, expat, substituteAll, vala
}:
let
generic = lib.makeOverridable ({
version, sha256,
extraNativeBuildInputs ? [],
extraBuildInputs ? [],
withGraphviz ? false
}:
let
# Patches from the openembedded-core project to build vala without graphviz
# support. We need to apply an additional patch to allow building when the
# header file isn't available at all, but that patch (./gvc-compat.patch)
# can be shared between all versions of Vala so far.
graphvizPatch =
2022-01-09 03:21:25 +01:00
{
2020-02-10 20:16:11 +01:00
"0.48" = ./disable-graphviz-0.46.1.patch;
"0.54" = ./disable-graphviz-0.46.1.patch;
"0.56" = ./disable-graphviz-0.46.1.patch;
}.${lib.versions.majorMinor version} or (throw "no graphviz patch for this version of vala");
disableGraphviz = lib.versionAtLeast version "0.38" && !withGraphviz;
in stdenv.mkDerivation rec {
pname = "vala";
inherit version;
setupHook = substituteAll {
src = ./setup-hook.sh;
apiVersion = lib.versions.majorMinor version;
};
src = fetchurl {
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
inherit sha256;
};
2018-08-08 20:28:43 +02:00
postPatch = ''
patchShebangs tests
'';
# If we're disabling graphviz, apply the patches and corresponding
# configure flag. We also need to override the path to the valac compiler
# so that it can be used to regenerate documentation.
patches = lib.optionals disableGraphviz [ graphvizPatch ./gvc-compat.patch ];
configureFlags = lib.optional disableGraphviz "--disable-graphviz";
2022-06-12 22:57:17 +02:00
# when cross-compiling ./compiler/valac is valac for host
# so add the build vala in nativeBuildInputs
preBuild = lib.optionalString (disableGraphviz && (stdenv.buildPlatform == stdenv.hostPlatform)) "buildFlagsArray+=(\"VALAC=$(pwd)/compiler/valac\")";
2017-11-24 02:14:13 +01:00
outputs = [ "out" "devdoc" ];
nativeBuildInputs = [
pkg-config flex bison libxslt
] ++ lib.optional (stdenv.isDarwin && (lib.versionAtLeast version "0.38")) expat
++ lib.optional disableGraphviz autoreconfHook # if we changed our ./configure script, need to reconfigure
2022-06-12 22:57:17 +02:00
++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ vala ]
++ extraNativeBuildInputs;
buildInputs = [
glib libiconv libintl
] ++ lib.optional (lib.versionAtLeast version "0.38" && withGraphviz) graphviz
++ extraBuildInputs;
2018-09-04 22:48:01 +02:00
enableParallelBuilding = true;
2018-08-08 20:28:43 +02:00
doCheck = false; # fails, requires dbus daemon
passthru = {
updateScript = gnome.updateScript {
attrPath =
let
roundUpToEven = num: num + lib.mod num 2;
in "${pname}_${lib.versions.major version}_${builtins.toString (roundUpToEven (lib.toInt (lib.versions.minor version)))}";
packageName = pname;
freeze = true;
};
};
meta = with lib; {
description = "Compiler for GObject type system";
homepage = "https://wiki.gnome.org/Projects/Vala";
license = licenses.lgpl21Plus;
platforms = platforms.unix;
2021-09-21 09:02:19 +02:00
maintainers = with maintainers; [ antono jtojnar maxeaubrey ] ++ teams.pantheon.members;
};
});
in rec {
2020-02-10 20:16:11 +01:00
vala_0_48 = generic {
version = "0.48.24";
sha256 = "NknvhFc7aGX8NHBkDuYDcgCZ65FbOfqtGbdJjeGn3yQ=";
};
vala_0_54 = generic {
version = "0.54.8";
sha256 = "7fs+eUhqS/SM666pKR5X/HfakyK2lh6VSd9tlz0EvIA=";
};
vala_0_56 = generic {
version = "0.56.1";
sha256 = "xRi4Hf3agtHN9Yaz+bIyMWLLlr08taLANlDOoCXZH7k=";
};
2022-05-12 21:28:49 +02:00
vala = vala_0_56;
}