nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, version
4, buildPackages
5, targetPackages
6, texinfo
7, which
8, gettext
9, pkg-config ? null
10, gnused
11, patchelf
12, gmp
13, mpfr
14, libmpc
15, libucontext ? null
16, libxcrypt ? null
17, cloog ? null
18, isl ? null
19, zlib ? null
20, gnat-bootstrap ? null
21, flex ? null
22, boehmgc ? null
23, zip ? null
24, unzip ? null
25, gtk2 ? null
26, libart_lgpl ? null
27, perl ? null
28, xlibs ? null
29, langJava ? false
30, javaAwtGtk ? false
31, langAda ? false
32, langGo ? false
33, crossStageStatic ? null
34, threadsCross ? null
35}:
36
37let
38 inherit (lib) optionals;
39 inherit (stdenv) buildPlatform hostPlatform targetPlatform;
40in
41
42{
43 # same for all gcc's
44 depsBuildBuild = [ buildPackages.stdenv.cc ];
45
46 nativeBuildInputs = [
47 texinfo
48 which
49 gettext
50 ]
51 ++ optionals (perl != null) [ perl ]
52 ++ optionals javaAwtGtk [ pkg-config ]
53 ++ optionals (with stdenv.targetPlatform; isVc4 || isRedox && flex != null) [ flex ]
54 ++ optionals langAda [ gnat-bootstrap ]
55 # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
56 # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
57 ++ optionals buildPlatform.isDarwin [ gnused ]
58 ;
59
60 # For building runtime libs
61 # same for all gcc's
62 depsBuildTarget =
63 (
64 if hostPlatform == buildPlatform then [
65 targetPackages.stdenv.cc.bintools # newly-built gcc will be used
66 ] else assert targetPlatform == hostPlatform; [
67 # build != host == target
68 stdenv.cc
69 ]
70 )
71 ++ optionals targetPlatform.isLinux [ patchelf ];
72
73 buildInputs = [
74 gmp
75 mpfr
76 libmpc
77 ]
78 ++ optionals (lib.versionAtLeast version "10") [ libxcrypt ]
79 ++ [
80 targetPackages.stdenv.cc.bintools # For linking code at run-time
81 ]
82 ++ optionals (lib.versionOlder version "5" && cloog != null) [ cloog ]
83 ++ optionals (isl != null) [ isl ]
84 ++ optionals (zlib != null) [ zlib ]
85 ++ optionals langJava [ boehmgc zip unzip ]
86 ++ optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)
87 ++ optionals (langGo && stdenv.hostPlatform.isMusl) [ libucontext ]
88 ;
89
90 # threadsCross.package after gcc6 so i assume its okay for 4.8 and 4.9 too
91 depsTargetTarget = optionals (!crossStageStatic && threadsCross != { } && threadsCross.package != null) [ threadsCross.package ];
92}