nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 157 lines 4.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchzip, 5 which, 6 ocaml, 7 camlp-streams, 8 ocamlbuild, 9 findlib, 10}: 11 12if lib.versionAtLeast ocaml.version "5.5" then 13 throw "camlp4 is not available for OCaml ${ocaml.version}" 14else 15 16 let 17 param = 18 { 19 "4.02" = { 20 version = "4.02+6"; 21 sha256 = "06yl4q0qazl7g25b0axd1gdkfd4qpqzs1gr5fkvmkrcbz113h1hj"; 22 }; 23 "4.03" = { 24 version = "4.03+1"; 25 sha256 = "1f2ndch6f1m4fgnxsjb94qbpwjnjgdlya6pard44y6n0dqxi1wsq"; 26 }; 27 "4.04" = { 28 version = "4.04+1"; 29 sha256 = "1ad7rygqjxrc1im95gw9lp8q83nhdaf383f2808f1p63yl42xm7k"; 30 }; 31 "4.05" = { 32 version = "4.05+1"; 33 sha256 = "0wm795hpwvwpib9c9z6p8kw2fh7p7b2hml6g15z8zry3y7w738sv"; 34 }; 35 "4.06" = { 36 version = "4.06+1"; 37 sha256 = "0fazfw2l7wdmbwnqc22xby5n4ri1wz27lw9pfzhsbcdrighykysf"; 38 }; 39 "4.07" = { 40 version = "4.07+1"; 41 sha256 = "0cxl4hkqcvspvkx4f2k83217rh6051fll9i2yz7cw6m3bq57mdvl"; 42 }; 43 "4.08" = { 44 version = "4.08+1"; 45 sha256 = "0qplawvxwai25bi27niw2cgz2al01kcnkj8wxwhxslpi21z6pyx1"; 46 }; 47 "4.09" = { 48 version = "4.09+1"; 49 sha256 = "1gr33x6xs1rs0bpyq4vzyfxd6vn47jfkg8imi81db2r0cbs0kxx1"; 50 }; 51 "4.10" = { 52 version = "4.10+1"; 53 sha256 = "093bc1c28wid5li0jwglnd4p3csxw09fmbs9ffybq2z41a5mgay6"; 54 }; 55 "4.11" = { 56 version = "4.11+1"; 57 sha256 = "0sn7f6im940qh0ixmx1k738xrwwdvy9g7r19bv5218jb6mh0g068"; 58 }; 59 "4.12" = { 60 version = "4.12+1"; 61 sha256 = "1cfk5ppnd511vzsr9gc0grxbafmh0m3m897aij198rppzxps5kyz"; 62 }; 63 "4.13" = { 64 version = "4.13+1"; 65 sha256 = "0fzxa1zdhk74mlxpin7p90flks6sp4gkc0mfclmj9zak15rii55n"; 66 }; 67 "4.14" = { 68 version = "4.14+1"; 69 sha256 = "sha256-cPN3GioZT/Zt6uzbjGUPEGVJcPQdsAnCkU/AQoPfvuo="; 70 }; 71 "5.0" = { 72 version = "5.0"; 73 sha256 = "sha256-oZptFNPUEAq5YlcqAoDWfLghGMF9AN7E7hUN55SAX+4="; 74 }; 75 "5.1" = { 76 version = "5.1"; 77 sha256 = "sha256-Ubedjg3BeHA0bJbEalQN9eEk5+LRAI/er+8mWfVYchg="; 78 }; 79 "5.2" = { 80 version = "5.2"; 81 sha256 = "sha256-lzbc9xsgeYlbVf71O+PWYS14QivAH1aPdnvWhe0HHME="; 82 }; 83 "5.3" = { 84 version = "5.3"; 85 sha256 = "sha256-V/kKhTP9U4jWDFuQKuB7BS3XICg1lq/2Avj7UJR55+k="; 86 }; 87 "5.4" = { 88 version = "5.4"; 89 sha256 = "sha256-7FsKEr0cRVF4LIOvROWMyXBefRTBaS66ZqwtP2VLefM="; 90 }; 91 } 92 .${ocaml.meta.branch}; 93 in 94 95 stdenv.mkDerivation rec { 96 pname = "camlp4"; 97 inherit (param) version; 98 99 src = fetchzip { 100 url = "https://github.com/ocaml/camlp4/archive/${version}.tar.gz"; 101 inherit (param) sha256; 102 }; 103 104 strictDeps = true; 105 106 nativeBuildInputs = [ 107 which 108 ocaml 109 ocamlbuild 110 ] 111 ++ lib.optionals (lib.versionAtLeast ocaml.version "5.0") [ 112 findlib 113 ]; 114 115 buildInputs = lib.optionals (lib.versionAtLeast ocaml.version "5.0") [ 116 camlp-streams 117 ocamlbuild 118 ]; 119 120 # build fails otherwise 121 enableParallelBuilding = false; 122 123 dontAddPrefix = true; 124 125 preConfigure = '' 126 # increase stack space for spacetime variant of the compiler 127 # https://github.com/ocaml/ocaml/issues/7435 128 # but disallowed by darwin sandbox 129 ulimit -s unlimited || true 130 131 configureFlagsArray=( 132 --bindir=$out/bin 133 --libdir=$out/lib/ocaml/${ocaml.version}/site-lib 134 --pkgdir=$out/lib/ocaml/${ocaml.version}/site-lib 135 ) 136 ''; 137 138 postConfigure = '' 139 substituteInPlace camlp4/META.in \ 140 --replace +camlp4 $out/lib/ocaml/${ocaml.version}/site-lib/camlp4 141 ''; 142 143 makeFlags = [ "all" ]; 144 145 installTargets = [ 146 "install" 147 "install-META" 148 ]; 149 150 dontStrip = true; 151 152 meta = { 153 description = "Software system for writing extensible parsers for programming languages"; 154 homepage = "https://github.com/ocaml/camlp4"; 155 platforms = ocaml.meta.platforms or [ ]; 156 }; 157 }