19 assert langAda -> gnat-bootstrap != null;
21 lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
22 export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
23 export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
24 export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
25 export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
27 + lib.optionalString langAda ''
28 export PATH=${gnat-bootstrap}/bin:$PATH
31 # For a cross-built native compiler, i.e. build!=(host==target), the
32 # bundled libgfortran needs a gfortran which can run on the
33 # buildPlatform and emit code for the targetPlatform. The compiler
34 # which is built alongside gfortran in this configuration doesn't
35 # meet that need: it runs on the hostPlatform.
38 (langFortran && (with stdenv; buildPlatform != hostPlatform && hostPlatform == targetPlatform))
40 export GFORTRAN_FOR_TARGET=${pkgsBuildTarget.gfortran}/bin/${stdenv.targetPlatform.config}-gfortran
43 # In order to properly install libgccjit on macOS Catalina, strip(1)
44 # upon installation must not remove external symbols, otherwise the
45 # install step errors with "symbols referenced by indirect symbol
46 # table entries that can't be stripped".
47 + lib.optionalString (hostPlatform.isDarwin && langJit) ''
48 export STRIP='strip -x'
51 # HACK: if host and target config are the same, but the platforms are
52 # actually different we need to convince the configure script that it
53 # is in fact building a cross compiler although it doesn't believe it.
55 lib.optionalString (targetPlatform.config == hostPlatform.config && targetPlatform != hostPlatform)
57 substituteInPlace configure --replace is_cross_compiler=no is_cross_compiler=yes
60 # Normally (for host != target case) --without-headers automatically
61 # enables 'inhibit_libc=true' in gcc's gcc/configure.ac. But case of
62 # gcc->clang or dynamic->static "cross"-compilation manages to evade it: there
63 # hostPlatform != targetPlatform, hostPlatform.config == targetPlatform.config.
64 # We explicitly inhibit libc headers use in this case as well.
68 targetPlatform != hostPlatform && withoutTargetLibc && targetPlatform.config == hostPlatform.config
71 export inhibit_libc=true
74 + lib.optionalString (targetPlatform != hostPlatform && withoutTargetLibc && enableShared) (
75 import ./libgcc-buildstuff.nix { inherit lib stdenv; }