Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 124 lines 4.4 kB view raw
1{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, flex, bison, libxslt, autoconf, autoreconfHook 2, graphviz, glib, libiconv, libintl, libtool, expat, substituteAll 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 let 19 fp = { commit, sha256 }: fetchpatch { 20 url = "https://github.com/openembedded/openembedded-core/raw/${commit}/meta/recipes-devtools/vala/vala/disable-graphviz.patch"; 21 inherit sha256; 22 }; 23 24 in { 25 26 # NOTE: the openembedded-core project doesn't have a patch for 0.40.12 27 # We've fixed the single merge conflict in the following patch. 28 # 0.40.12: https://github.com/openembedded/openembedded-core/raw/8553c52f174af4c8c433c543f806f5ed5c1ec48c/meta/recipes-devtools/vala/vala/disable-graphviz.patch 29 "0.40" = ./disable-graphviz-0.40.12.patch; 30 31 # NOTE: the openembedded-core project doesn't have a patch for 0.44.1 32 # We've reverted the addition of the "--disable-valadoc" option 33 # and then applied the following patch. 34 # 0.42.4: https://github.com/openembedded/openembedded-core/raw/f2b4f9ec6f44dced7f88df849cca68961419eeb8/meta/recipes-devtools/vala/vala/disable-graphviz.patch 35 "0.44" = ./disable-graphviz-0.44.3.patch; 36 37 "0.46" = ./disable-graphviz-0.46.1.patch; 38 39 }.${lib.versions.majorMinor version} or (throw "no graphviz patch for this version of vala"); 40 41 disableGraphviz = lib.versionAtLeast version "0.38" && !withGraphviz; 42 43 in stdenv.mkDerivation rec { 44 pname = "vala"; 45 inherit version; 46 47 setupHook = substituteAll { 48 src = ./setup-hook.sh; 49 apiVersion = lib.versions.majorMinor version; 50 }; 51 52 src = fetchurl { 53 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 54 inherit sha256; 55 }; 56 57 postPatch = '' 58 patchShebangs tests 59 ''; 60 61 # If we're disabling graphviz, apply the patches and corresponding 62 # configure flag. We also need to override the path to the valac compiler 63 # so that it can be used to regenerate documentation. 64 patches = lib.optionals disableGraphviz [ graphvizPatch ./gvc-compat.patch ]; 65 configureFlags = lib.optional disableGraphviz "--disable-graphviz"; 66 preBuild = lib.optional disableGraphviz "buildFlagsArray+=(\"VALAC=$(pwd)/compiler/valac\")"; 67 68 outputs = [ "out" "devdoc" ]; 69 70 nativeBuildInputs = [ 71 pkgconfig flex bison libxslt 72 ] ++ lib.optional (stdenv.isDarwin && (lib.versionAtLeast version "0.38")) expat 73 ++ lib.optional disableGraphviz autoreconfHook # if we changed our ./configure script, need to reconfigure 74 ++ extraNativeBuildInputs; 75 76 buildInputs = [ 77 glib libiconv libintl 78 ] ++ lib.optional (lib.versionAtLeast version "0.38" && withGraphviz) graphviz 79 ++ extraBuildInputs; 80 81 enableParallelBuilding = true; 82 83 doCheck = false; # fails, requires dbus daemon 84 85 # Wait for PR #59372 86 # passthru = { 87 # updateScript = gnome3.updateScript { 88 # attrPath = "${pname}_${lib.versions.major version}_${lib.versions.minor version}"; 89 # packageName = pname; 90 # }; 91 # }; 92 93 meta = with stdenv.lib; { 94 description = "Compiler for GObject type system"; 95 homepage = https://wiki.gnome.org/Projects/Vala; 96 license = licenses.lgpl21Plus; 97 platforms = platforms.unix; 98 maintainers = with maintainers; [ antono jtojnar lethalman peterhoeg worldofpeace ]; 99 }; 100 }); 101 102in rec { 103 vala_0_36 = generic { 104 version = "0.36.20"; 105 sha256 = "19v7zjhr9yxkh9lxg46n9gjr0lb7j6v0xqfhrdvgz18xhj3hm5my"; 106 }; 107 108 vala_0_40 = generic { 109 version = "0.40.18"; 110 sha256 = "1f7cdkjdysg4dcri1wbzdddm46amk2s48jkwb5ghpdvhjb4l5j2m"; 111 }; 112 113 vala_0_44 = generic { 114 version = "0.44.11"; 115 sha256 = "06spdvm9q9k4riq1d2fxkyc8d88bcv460v360465iy1lnj3z9x2s"; 116 }; 117 118 vala_0_46 = generic { 119 version = "0.46.5"; 120 sha256 = "07fv895sp9wq74b20qig7hic0r4ynrr5pfaqba02r44xb794fy0s"; 121 }; 122 123 vala = vala_0_46; 124}