Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 137 lines 3.6 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 pkg-config, 6 flex, 7 bison, 8 libxslt, 9 autoconf, 10 autoreconfHook, 11 gnome, 12 graphviz, 13 glib, 14 libiconv, 15 libintl, 16 libtool, 17 expat, 18 replaceVars, 19 vala, 20 gobject-introspection, 21}: 22 23let 24 generic = lib.makeOverridable ( 25 { 26 version, 27 hash, 28 extraNativeBuildInputs ? [ ], 29 extraBuildInputs ? [ ], 30 withGraphviz ? false, 31 }: 32 let 33 # Build vala (valadoc) without graphviz support. Inspired from the openembedded-core project. 34 # https://github.com/openembedded/openembedded-core/blob/a5440d4288e09d3e/meta/recipes-devtools/vala/vala/disable-graphviz.patch 35 graphvizPatch = 36 { 37 "0.56" = ./disable-graphviz-0.56.8.patch; 38 } 39 .${lib.versions.majorMinor version} or (throw "no graphviz patch for this version of vala"); 40 41 disableGraphviz = !withGraphviz; 42 43 in 44 stdenv.mkDerivation rec { 45 pname = "vala"; 46 inherit version; 47 48 setupHook = replaceVars ./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 hash; 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 ]; 65 configureFlags = lib.optional disableGraphviz "--disable-graphviz"; 66 # when cross-compiling ./compiler/valac is valac for host 67 # so add the build vala in nativeBuildInputs 68 preBuild = lib.optionalString ( 69 disableGraphviz && (stdenv.buildPlatform == stdenv.hostPlatform) 70 ) "buildFlagsArray+=(\"VALAC=$(pwd)/compiler/valac\")"; 71 72 outputs = [ 73 "out" 74 "devdoc" 75 ]; 76 77 nativeBuildInputs = 78 [ 79 pkg-config 80 flex 81 bison 82 libxslt 83 gobject-introspection 84 ] 85 ++ lib.optional (stdenv.hostPlatform.isDarwin) expat 86 ++ lib.optional disableGraphviz autoreconfHook # if we changed our ./configure script, need to reconfigure 87 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ vala ] 88 ++ extraNativeBuildInputs; 89 90 buildInputs = 91 [ 92 glib 93 libiconv 94 libintl 95 ] 96 ++ lib.optional (withGraphviz) graphviz 97 ++ extraBuildInputs; 98 99 enableParallelBuilding = true; 100 101 doCheck = false; # fails, requires dbus daemon 102 103 passthru = { 104 updateScript = gnome.updateScript { 105 attrPath = 106 let 107 roundUpToEven = num: num + lib.mod num 2; 108 in 109 "${pname}_${lib.versions.major version}_${builtins.toString (roundUpToEven (lib.toInt (lib.versions.minor version)))}"; 110 packageName = pname; 111 freeze = true; 112 }; 113 }; 114 115 meta = with lib; { 116 description = "Compiler for GObject type system"; 117 homepage = "https://vala.dev"; 118 license = licenses.lgpl21Plus; 119 platforms = platforms.unix; 120 maintainers = with maintainers; [ 121 antono 122 jtojnar 123 ]; 124 teams = [ teams.pantheon ]; 125 }; 126 } 127 ); 128 129in 130rec { 131 vala_0_56 = generic { 132 version = "0.56.18"; 133 hash = "sha256-8q/+fUCrY9uOe57MP2vcnC/H4xNMhP8teV9IL+kmo4I="; 134 }; 135 136 vala = vala_0_56; 137}