Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchurl, fetchpatch, pkg-config, flex, bison, libxslt, autoconf, autoreconfHook 2, gnome, graphviz, glib, libiconv, libintl, libtool, expat, substituteAll, vala 3}: 4 5let 6 generic = lib.makeOverridable ({ 7 version, sha256, 8 extraNativeBuildInputs ? [], 9 extraBuildInputs ? [], 10 withGraphviz ? false 11 }: 12 let 13 # Patches from the openembedded-core project to build vala without graphviz 14 # support. We need to apply an additional patch to allow building when the 15 # header file isn't available at all, but that patch (./gvc-compat.patch) 16 # can be shared between all versions of Vala so far. 17 graphvizPatch = 18 { 19 "0.48" = ./disable-graphviz-0.46.1.patch; 20 21 "0.54" = ./disable-graphviz-0.46.1.patch; 22 23 "0.56" = ./disable-graphviz-0.46.1.patch; 24 25 }.${lib.versions.majorMinor version} or (throw "no graphviz patch for this version of vala"); 26 27 disableGraphviz = lib.versionAtLeast version "0.38" && !withGraphviz; 28 29 in stdenv.mkDerivation rec { 30 pname = "vala"; 31 inherit version; 32 33 setupHook = substituteAll { 34 src = ./setup-hook.sh; 35 apiVersion = lib.versions.majorMinor version; 36 }; 37 38 src = fetchurl { 39 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 40 inherit sha256; 41 }; 42 43 postPatch = '' 44 patchShebangs tests 45 ''; 46 47 # If we're disabling graphviz, apply the patches and corresponding 48 # configure flag. We also need to override the path to the valac compiler 49 # so that it can be used to regenerate documentation. 50 patches = lib.optionals disableGraphviz [ graphvizPatch ./gvc-compat.patch ]; 51 configureFlags = lib.optional disableGraphviz "--disable-graphviz"; 52 # when cross-compiling ./compiler/valac is valac for host 53 # so add the build vala in nativeBuildInputs 54 preBuild = lib.optionalString (disableGraphviz && (stdenv.buildPlatform == stdenv.hostPlatform)) "buildFlagsArray+=(\"VALAC=$(pwd)/compiler/valac\")"; 55 56 outputs = [ "out" "devdoc" ]; 57 58 nativeBuildInputs = [ 59 pkg-config flex bison libxslt 60 ] ++ lib.optional (stdenv.isDarwin && (lib.versionAtLeast version "0.38")) expat 61 ++ lib.optional disableGraphviz autoreconfHook # if we changed our ./configure script, need to reconfigure 62 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ vala ] 63 ++ extraNativeBuildInputs; 64 65 buildInputs = [ 66 glib libiconv libintl 67 ] ++ lib.optional (lib.versionAtLeast version "0.38" && withGraphviz) graphviz 68 ++ extraBuildInputs; 69 70 enableParallelBuilding = true; 71 72 doCheck = false; # fails, requires dbus daemon 73 74 passthru = { 75 updateScript = gnome.updateScript { 76 attrPath = 77 let 78 roundUpToEven = num: num + lib.mod num 2; 79 in "${pname}_${lib.versions.major version}_${builtins.toString (roundUpToEven (lib.toInt (lib.versions.minor version)))}"; 80 packageName = pname; 81 freeze = true; 82 }; 83 }; 84 85 meta = with lib; { 86 description = "Compiler for GObject type system"; 87 homepage = "https://wiki.gnome.org/Projects/Vala"; 88 license = licenses.lgpl21Plus; 89 platforms = platforms.unix; 90 maintainers = with maintainers; [ antono jtojnar maxeaubrey ] ++ teams.pantheon.members; 91 }; 92 }); 93 94in rec { 95 vala_0_48 = generic { 96 version = "0.48.25"; 97 sha256 = "UMs8Xszdx/1DaL+pZBSlVgReedKxWmiRjHJ7jIOxiiQ="; 98 }; 99 100 vala_0_54 = generic { 101 version = "0.54.9"; 102 sha256 = "hXLA6Nd9eMFZfVFgCPBUDH50leA10ou0wlzJk+U85LQ="; 103 }; 104 105 vala_0_56 = generic { 106 version = "0.56.7"; 107 sha256 = "PTnHWW1fqa6L/q5HZmn4EfcFe397kwhHiie2hEPYsAM="; 108 }; 109 110 vala = vala_0_56; 111}