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