Commit Graph

136 Commits

Author SHA1 Message Date
Andrew Childs
6c4ce7960e bintools-wrapper, cc-wrapper: parameterize darwin min version variable
These variables are the ones that the standard toolchain uses, so we
should use those and not always use MACOSX_DEPLOYMENT_TARGET.

See 236a426c12/cctools/ld64/src/ld/PlatformSupport.cpp (L54-L55)
2021-04-11 09:47:10 +09:00
Andrew Childs
6605fadc68 bintools-wrapper: default platform versions for darwin
Instead of always supplying flags, apply the flags as defaults. Use
clang's native flags instead of lifting the linker flags from binutils
with `-Wl,`.

If a project is using clang to drive linking, make clang do the right
thing with MACOSX_DEPLOYMENT_TARGET. This can be overridden by command
line arguments. This will cause modern clang to pass
`-platform_version 10.12 0.0.0`, since it doesn't know about the SDK
settings. Older versions of clang will pass down `-macos_version_min`
flags with no sdk version.

At the linker layer, apply a default value for anything left
ambiguous. If nothing is specified, pass a full
`-platform_version`. If only `-macos_version_min` is specified, then
lock down the sdk_version explicitly with `-sdk_version`. If a min
version and sdk version is passed, do nothing.
2021-04-11 09:47:09 +09:00
Jan Tojnar
6d1958ad2d
Merge branch 'staging-next' into staging 2021-03-04 22:16:45 +01:00
s1341
aee60bef7a android_prebuilt: Fix eval 2021-03-04 18:17:39 +00:00
Andrew Childs
b26e0bac8d bintools-wrapper: set -arch on darwin 2021-03-02 17:21:08 +09:00
Ashish SHUKLA
1c39662e63
stdenv: Improve/fix FreeBSD support
Able to bootstrap stdenv on FreeBSD by compiling various dependencies
using built-in FreeBSD tools so mostly works now

Closes: https://github.com/NixOS/nixpkgs/pull/81459
2021-02-07 15:24:16 +00:00
Vladimír Čunát
a648a07c19
Merge #104742: linux bootstrap tools: fix tests on ppc64 2021-01-26 08:09:59 +01:00
Ben Siraphob
aa8868c7cc pkgs/build-support: stdenv.lib -> lib 2021-01-24 19:07:54 -08:00
John Ericson
9c213398b3 lib: Clean up how linux and gcc config is specified
Second attempt of 8929989614589ee3acd070a6409b2b9700c92d65; see that
commit for details.

This reverts commit 0bc275e634.
2021-01-23 10:01:28 -05:00
Jonathan Ringer
0bc275e634
Revert "lib: Clean up how linux and gcc config is specified"
This is a stdenv-rebuild, and should not be merged
into master

This reverts commit 8929989614.
2021-01-22 14:07:06 -08:00
John Ericson
8929989614 lib: Clean up how linux and gcc config is specified
The `platform` field is pointless nesting: it's just stuff that happens
to be defined together, and that should be an implementation detail.

This instead makes `linux-kernel` and `gcc` top level fields in platform
configs. They join `rustc` there [all are optional], which was put there
and not in `platform` in anticipation of a change like this.

`linux-kernel.arch` in particular also becomes `linuxArch`, to match the
other `*Arch`es.

The next step after is this to combine the *specific* machines from
`lib.systems.platforms` with `lib.systems.examples`, keeping just the
"multiplatform" ones for defaulting.
2021-01-21 22:44:09 -05:00
Jörg Thalheim
61bbbcd1af
bintools-wrapper: skip dynamic linker for static binaries 2020-12-27 16:42:11 +01:00
Vladimír Čunát
363175cd99
Revert "bintools-wrapper: skip dynamic linker for static binaries"
This reverts commit ccfd26ef14.

These toolchain changes are too problematic, so reverting for now; see
https://github.com/NixOS/nixpkgs/pull/107086#issuecomment-749196366
2020-12-21 22:27:48 +01:00
Jörg Thalheim
ccfd26ef14 bintools-wrapper: skip dynamic linker for static binaries
Currently we set dynamic-linker unconditionally. This breaks
however some static binaries i.e. rust binaries linked against musl.
There is no reason we should set an elf interpreter for static binaries
hence this is skipped if `-static` or `-static-pie` is either passed to
our cc or ld wrapper.
2020-12-14 15:42:54 +00:00
John Ericson
04f6973200 lib, binutils: Move Risc-V bfdEmulation to be by the others 2020-11-29 00:03:51 +00:00
Ryan Burns
9682c1d0da linux bootstrap tools: fix tests on ppc64
The dynamic loader on powerpc64 is called ld64.so.2 rather than
ld-linux.so.*, and was not matched by the existing pattern.

We reuse the dynamicLinker name from binutils to match a wider set
of platforms and to avoid specifying this information in two places.
2020-11-24 18:32:12 -08:00
Frederik Rietdijk
da12fc6838 Merge staging-next into staging 2020-11-18 15:36:56 +01:00
Frederik Rietdijk
986c2d36da Merge master into staging-next 2020-11-16 09:01:53 +01:00
zowoq
473b341fb1 bintools-wrapper: remove redundant arg
cctools 949.0.1 warns if min version is passed twice.
2020-11-14 07:11:29 +10:00
Samuel Dionne-Riel
6d8327ea96 Initial support for OpenRISC 1000 (or1k) 2020-11-09 22:32:11 -05:00
Ben Siraphob
445dde6304 Initial implementation of mmix cross-compile 2020-11-09 19:49:55 +07:00
Frederik Rietdijk
e560459c5b Revert "utils.bash: revert #93560 for darwin, unblocks channels"
Revert the hack and the original faulty commit.

This reverts commit 48264ee506105a2f5e61e5d327599e9f301bd77f.

Revert "Purity checking should accept $TMP and not just /tmp"

This reverts commit fb777be7d2.
2020-09-06 18:16:14 +02:00
Frederik Rietdijk
08eb704bc3 utils.bash: revert #93560 for darwin, unblocks channels
Temporary fix. We definitely do not want to have two separate
implementations.
2020-09-06 18:14:08 +02:00
John Ericson
704daf7a6e {bintools,cc}-wrapper: Ensure nix-support/*-flags files exist
This will unbreak firefox and a few other packages which try to grab
some of the libcxx flags.
2020-06-30 18:26:37 +00:00
John Ericson
1085403acd {cc,bintools}-wrapper: Comments no longer spliced
This means we can freely keep the comments up to date without the
penalty of a mass rebuild.
2020-06-30 15:04:10 +00:00
Matthew Bauer
d38bad590e
Merge pull request #83180 from matthewbauer/only-add-ldflags-for-macos
bintools: only add macos flags when targeting macOS
2020-05-13 10:34:40 -05:00
John Ericson
1ac5398589 *-wrapper; Switch from infixSalt to suffixSalt
I hate the thing too even though I made it, and rather just get rid of
it. But we can't do that yet. In the meantime, this brings us more
inline with autoconf and will make it slightly easier for me to write a
pkg-config wrapper, which we need.
2020-05-12 00:44:44 -04:00
Dmitry Kalinkin
c450617f99
bintools-wrapper: only propagate .info output if it exists in the original 2020-04-20 23:49:02 -04:00
Matthew Bauer
b0b0a06788 bintools: only add macos flags when targeting macOS
We can’t set this for cross-compiling since we use the GNU linker.
Instead, set these flags only when targetPlatform is macOS.

Fixes #80754

Fixes #83141
2020-03-23 00:32:45 -04:00
John Ericson
cfd013813e
Merge pull request #74090 from obsidiansystems/ghcjs-cross-without-cc
stdenv, haskell: bonafied GHCJS cross compilation without stdenv.cc
2019-12-30 16:40:43 -08:00
John Ericson
f191360ad0 Merge remote-tracking branch 'upstream/staging-next' into staging 2019-11-25 15:59:05 -05:00
John Ericson
6bc456c91c Merge remote-tracking branch 'upstream/master' into ghcjs-cross-without-cc 2019-11-25 00:23:07 +00:00
John Ericson
63bd851e95 stdenv: Introduce hasCC attribute
Before, we'd always use `cc = null`, and check for that. The problem is
this breaks for cross compilation to platforms that don't support a C
compiler.

It's a very subtle issue. One might think there is no problem because we
have `stdenvNoCC`, and presumably one would only build derivations that
use that. The problem is that one still wants to use tools at build-time
that are themselves built with a C compiler, and those are gotten via
"splicing". The runtime version of those deps will explode, but the
build time / `buildPackages` versions of those deps will be fine, and
splicing attempts to work this by using `builtins.tryEval` to filter out
any broken "higher priority" packages (runtime is the default and
highest priority) so that both `foo` and `foo.nativeDrv` works.

However, `tryEval` only catches certain evaluation failures (e.g.
exceptions), and not arbitrary failures (such as `cc.attr` when `cc` is
null). This means `tryEval` fails to let us use our build time deps, and
everything comes apart.

The right solution is, as usually, to get rid of splicing. Or, baring
that, to make it so `foo` never works and one has to explicitly do
`foo.*`. But that is a much larger change, and certaily one unsuitable
to be backported to stable.

Given that, we instead make an exception-throwing `cc` attribute, and
create a `hasCC` attribute for those derivations which wish to
condtionally use a C compiler: instead of doing `stdenv.cc or null ==
null` or something similar, one does `stdenv.hasCC`. This allows quering
without "tripping" the exception, while also allowing `tryEval` to work.

No platform without a C compiler is yet wired up by default. That will
be done in a following commit.
2019-11-25 00:12:38 +00:00
John Ericson
6d3b7458cc
Merge pull request #74065 from Ericson2314/cc-versions
compilers, binutils: Add version and pname
2019-11-24 18:35:13 -05:00
John Ericson
814f9104d7
Merge pull request #72657 from cleverca22/vc4
Initial implementation of vc4 cross-compile
2019-11-24 16:04:15 -05:00
Craig Hall
da3c053482 {cc,bintools}-wrapper: Inherit compiler version 2019-11-24 18:32:26 +00:00
John Ericson
747d5a3dbf Merge branch 'wrapper-pname-support-19.09' into wrapper-pname-support 2019-11-24 18:00:29 +00:00
John Ericson
4a0a297861 bintools-wrapper: Fix version 2019-11-24 17:57:06 +00:00
John Ericson
d0d5136cce Merge remote-tracking branch 'upstream/master' into wrapper-pname-support 2019-11-24 17:25:07 +00:00
Craig Hall
99537e994f {cc,bintools}-wrapper: use cc pname/version if set 2019-11-24 16:33:21 +00:00
Michael Bishop
4aa1ffae04
initial implementation of vc4 cross-compile 2019-11-19 22:19:15 -04:00
John Ericson
fae8d2627d cc-wrapper, bintools-wrapper: Remove now unneeded set {+,-}u 2019-11-04 19:57:14 -05:00
John Ericson
545e7518a8 bintools-wrapper: Don't stop set -u-ing
Same justification as previous commit.
2019-11-01 14:44:43 -04:00
volth
35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
Matthew Bauer
9abff4af4f wasm: init cross target
Adds pkgsCross.wasm32 and pkgsCross.wasm64. Use it to build Nixpkgs
with a WebAssembly toolchain.

stdenv/cross: use static overlay on isWasm

isWasm doesn’t make sense dynamically linked.
2019-04-23 21:48:57 -04:00
Jan Tojnar
cb1a20499a
Merge branch 'master' into staging 2019-04-05 11:37:15 +02:00
Aaron Lindsay
1eca945e94 systems: support TI MSP430 microcontrollers 2019-03-25 20:33:58 -07:00
Matthew Bauer
8a08d7e7cc
Merge pull request #56031 from matthewbauer/priorities
Add some more priorities
2019-03-09 18:02:55 -05:00
Matthew Bauer
85536e892b bintools-wrapper: fix unknown emulation error message
Using the + operator with throw doesn’t seems to work properly. You
need to use antiquotes here to get the targetPlatform config included.
2019-02-26 15:55:48 -05:00
Matthew Bauer
aab8c7ba43 netbsd: add cross target 2019-02-26 15:55:47 -05:00
Vincent Weisner
a547a9b554 Fix alpha-embedded Target on Hydra (#55725) 2019-02-19 22:36:00 -05:00
Matthew Bauer
9f6f223c18 bintools-wrapper: set low priority 2019-02-18 21:10:12 -05:00
Daniel Goertzen
1c10efc912 add generic x86_32 support (#52634)
* add generic x86_32 support

- Add support for i386-i586.
- Add `isx86_32` predicate that can replace most uses of `isi686`.
- `isi686` is reinterpreted to mean "exactly i686 arch, and not say i585 or i386".
- This branch was used to build working i586 kernel running on i586 hardware.

* revert `isi[345]86`, remove dead code

- Remove changes to dead code in `doubles.nix` and `for-meta.nix`.
- Remove `isi[345]86` predicates since other cpu families don't have specific model predicates.

* remove i386-linux since linux not supported on that cpu
2019-01-06 12:57:36 -06:00
Frederik Rietdijk
2219e2578e Merge staging-next into staging 2018-11-22 10:10:40 +01:00
Michael Raskin
ad1abb2824
Merge pull request #46115 from oxij/stdenv/bintools-cc-symlink
cc-wrapper, bintools-wrapper: simply symlink man and info outputs
2018-11-22 08:58:28 +00:00
Matthew Bauer
4e68511bb1 bintools: use i386 on all 32 bit x86 systems 2018-11-21 09:38:28 -06:00
Jan Malakhovski
d32f51c618 cc-wrapper, bintools-wrapper: simply symlink man and info outputs
With the previous commit `propagateDoc` is now always given the correct value
(i.e. it is never set to `true` when there are no `man` and `info` outputs).
Hence, we can simply symlink the original outputs to the wrapper outputs.

Pros:

- simpler, less indirection compared to `propagated-user-env-packages`,
- uses less inodes (1 symlink, which nix then simply automatically resolves
  and removes, vs. two directories and a file),
- makes direct references like "export MANPATH=${stdenv.cc.man}/share/man"
  simply work.

Cons:

- I'm not aware of any.

This and the previous commit together almost completely revert commits
fde7296a47,
fa41297209, and
c981787db9.
2018-11-07 08:37:51 +00:00
Matthew Bauer
412093994b gcc: support avr
- respect libc’s incdir and libdir
- make non-unix systems single threaded
- set LIMITS_H_TEST to false for avr
- misc updates to support new libc’s
- use multilib with avr

For threads we want to use:
- posix on unix systems
- win32 on windows
- single on everything else

For avr:
- add library directories for avrlibc
- to disable relro and bind
- avr5 should have precedence over avr3 - otherwise gcc uses the wrong one
2018-10-29 14:34:09 -05:00
Matthew Bauer
d59a9ac7cf avr: use new compilation infrastructure
Gets rid of:
  avrbinutils
  avrgcc

to replace with:
  pkgsCross.avr.buildPackages.binutils
  pkgsCross.avr.buildPackages.gcc
2018-10-29 14:34:09 -05:00
Jan Malakhovski
b2c7a5a271 bintools-wrapper, cc-wrapper, stdenv: infer propagateDoc automatically
02c09e0171 (NixOS/nixpkgs#44558) was reverted in
c981787db9 but, as it turns out, it fixed an issue
I didn't know about at the time: the values of `propagateDoc` options were
(and now again are) inconsistent with the underlying things those wrappers wrap
(see NixOS/nixpkgs#46119), which was (and now is) likely to produce more instances
of NixOS/nixpkgs#43547, if not now, then eventually as stdenv changes.

This patch (which is a simplified version of the original reverted patch) is the
simplest solution to this whole thing: it forces wrappers to directly inspect the
outputs of the things they are wrapping instead of making stdenv guess the correct
values.
2018-09-23 17:29:56 +00:00
CrystalGamma
72d161f548 [RFC] ppc64le enablement (#45340)
* ppc64le enablement

* gcc, glibc: properly handle __float128

* lib/systems, stdenv: syntax cleanup

* gcc7: remove ugly hack

* gcc: add/update __float128 flags

* stdenv: add another pair of quotes for consistency

* gcc: move __float128 flag for ppc64le-glibc into common/platform-flags.nix
2018-08-21 15:31:34 -04:00
Eelco Dolstra
fde7296a47
bintools-wrapper: propagated-build-inputs -> propagated-user-env-packages 2018-08-09 13:07:14 +02:00
Eelco Dolstra
c981787db9
Revert "cc-wrapper, bintools-wrapper: simply symlink man and info outputs"
This reverts commit 02c09e0171.
2018-08-09 12:57:38 +02:00
Jan Malakhovski
02c09e0171 cc-wrapper, bintools-wrapper: simply symlink man and info outputs
See discussion in #44516.
2018-08-06 20:50:16 +00:00
Matthew Bauer
96ce1e03a4 {cc,bintools}-wrapper: also replace . in config
Some configs will have dots for version numbers. To normalize we can
just use _ again.
2018-07-28 19:54:09 -04:00
John Q Crosscompiler
7cc62144b2
systems: Allow detection of powerpc and sparc 2018-07-26 09:33:36 -04:00
John Ericson
5e17335bd7 Merge remote-tracking branch 'upstream/staging' into strictDeps 2018-05-14 23:33:03 -04:00
John Ericson
330ca731e8 treewide: Get rid of all uses of crossConfig
The hack of using `crossConfig` to enforce stricter handling of
dependencies is replaced with a dedicated `strictDeps` for that purpose.
(Experience has shown that my punning was a terrible idea that made more
difficult and embarrising to teach teach.)

Now that is is clear, a few packages now use `strictDeps`, to fix
various bugs:

 - bintools-wrapper and cc-wrapper
2018-05-14 23:30:37 -04:00
John Ericson
4f7cdd35d5
Merge pull request #40139 from obsidiansystems/modular-setup-hooks
treewide: Modular setup hooks
2018-05-07 15:32:10 -04:00
John Ericson
8b0fce8cb1 {bintools,cc}-wrapper: Factor out role accumulation logic 2018-05-07 15:10:45 -04:00
John Ericson
2110c0bd30 treewide: Use pkgs/build-support/roles.bash to remove copy pasta
Also fix some setup hooks that unnecessarily used environment hooks,
which revolted in the same variable being modified too many times.
2018-05-07 15:10:37 -04:00
Matthew Justin Bauer
eeb016e8f0
Merge branch 'staging' into fix-ncurses-darwin-extensions 2018-05-02 15:40:38 -05:00
Jan Malakhovski
82dd4501f4 bintools-wrapper, cc-wrapper: don't add targetPrefix the second time
... binutils and gcc add it already anyway.

Without this it's easy to get cross-toolchain paths longer than 256
chars and nix-daemon will then fail to commit them to /nix/store on XFS.
2018-04-26 15:06:52 +00:00
John Ericson
b9acfb4ecf treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.

The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:

```
ISA:             ARMv8   {-A, -R, -M}
                 /    \
Mode:     Aarch32     Aarch64
             |         /   \
Encoding:   A64      A32   T32
```

At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.

The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.

[1]: https://developer.arm.com/products/architecture/a-profile

(cherry picked from commit ba52ae5048)
2018-04-25 15:50:41 -04:00
John Ericson
ba52ae5048 treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.

The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:

```
ISA:             ARMv8   {-A, -R, -M}
                 /    \
Mode:     Aarch32     Aarch64
             |         /   \
Encoding:   A64      A32   T32
```

At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.

The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.

[1]: https://developer.arm.com/products/architecture/a-profile
2018-04-25 15:28:55 -04:00
Will Fancher
d390ee74e3 Added bionic dynamic linker 2018-03-27 21:24:27 -04:00
Tuomas Tynkkynen
34f95d92a2 Merge remote-tracking branch 'upstream/master' into staging
Conflicts:
	pkgs/applications/misc/pytrainer/default.nix
	pkgs/development/tools/pew/default.nix
	pkgs/tools/misc/you-get/default.nix
2018-02-28 20:52:49 +02:00
Will Dietz
f14ff86ec9 bintools-wrapper: fix breakage on aarch64, where "isArm" is false
Unintentionally changed in #35247
2018-02-28 09:42:13 -06:00
Jan Malakhovski
0ab1067d12 bintools-wrapper: allow building without documentation 2018-02-26 22:42:32 +00:00
Daniel Barlow
9c50ae6898 lib, treewide: Add missing MIPS arches, and fix existing usage
Existing "mips64el" should be "mipsel".

This is just the barest minimum so that nixpkgs can recognize them as
systems - although required for building individual derivations onto
MIPS boards, it is not sufficient if you want to actually build nixos on
those targets
2018-02-23 20:43:42 -05:00
Will Dietz
d5916a84cf bintools-wrapper: teach about musl dynamic linkers 2018-02-13 09:44:33 -06:00
John Ericson
3a50395ef2 {bintools,cc}-wrapper: extraPackages should be depsTargetTargetPropagated
They are libraries used by programs built with these tools, not used by the
tools themselves.
2017-12-30 22:04:21 -05:00
John Ericson
cc44e04472 bintools-wrapper: Define fallback default emulation
This ensures we by-default cross-compile to the intended platform.
2017-12-29 17:32:28 -05:00
John Ericson
99806c5e12 bintools-wrapper: Create man and info outputs propagated underlying ones
These will be installed if the wrappers are. The wrappers aren't very
good to install, but that's another matter.
2017-12-13 16:08:19 -05:00
John Ericson
ef178be597 bintools-wrapper: Support ld.ldd, along with ld.bfd and ld.gold
Also make the code more precise in the process
2017-12-13 16:08:18 -05:00
John Ericson
8e557ed2c5 bintools-wrapper: Init
Factor a bintools (i.e. binutils / cctools) wrapper out of cc-wrapper. While
only LD is wrapped, the setup hook defines environment variables on behalf of
other utilites.
2017-12-13 16:08:18 -05:00