Commit Graph

125 Commits

Author SHA1 Message Date
Uri Baghin
fd8e2ca0df stdenv: fix makeStaticDarwin not composing with stdenvNoCC 2023-06-22 15:33:54 +10:00
Artturin
67a84d1428 stdenvAdapters: fix preservation of env.NIX_CFLAGS_COMPILE
we have managed to migrate to NIX_CFLAGS_COMPILE to the env attrset well
enough that we don't need to support having it toplevel. mkDerivation
will throw if there's a attr in both env and toplevel so no need to
worry about that
2023-04-12 21:27:34 +03:00
Artturin
9adf83737f stdenvAdapters: fix preservation of env 2023-04-11 21:25:52 +03:00
github-actions[bot]
3cdd771820
Merge staging-next into staging 2023-02-23 18:01:49 +00:00
Artturin
f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00
Artturin
299a7bd35e stdenvAdapters: add useMoldLinker 2023-02-17 06:35:24 +02:00
Alyssa Ross
0ae87d514f treewide: add names to all setup hooks 2023-01-19 15:00:36 +00:00
pennae
abd2e87da1 stdenv: remove deprecated adapters 2022-08-26 16:25:44 +02:00
Robert Hensing
dd770cc211 stdenv/adapters.nix: Fix for overlay style arguments 2022-06-05 13:54:03 +02:00
Artturin
0c4d65b21e treewide: stdenv.glibc -> glibc 2022-05-25 15:51:20 +03:00
Artturin
2d019e0931 stdenv: deprecate unused adapters
stdenv: deprecate addCoverageInstrumentation adapter

this used to be used in nixos/tests but it hasn't been used in nixpkgs
for years

stdenv: deprecate replaceMaintainersField adapter

it was added in 2009 in 01e98e49b1
by nbp
there are no uses of it in nixpkgs now

stdenv: deprecate validateLicenses adapter

it was added in 2009 in b29073af25

unfreePredicate is now handled in ./pkgs/stdenv/generic/check-meta.nix
so this is unnecessary
2022-05-07 22:36:10 +03:00
matthewcroughan
b0c0e0d7eb stdenv: introduce withCFlags
Adds an easy method of appending compiler flags to your stdenv via a
list.

Co-authored-by: tomberek <tomberek@users.noreply.github.com>
Co-authored-by: Gytis Ivaskevicius <gytis02.21@gmail.com>
Co-authored-by: sternenseemann <sternenseemann@systemli.org>
2022-01-29 21:23:12 -05:00
John Ericson
3edba5edfc pkgsStatic: Finally obviate overlay! 2021-08-20 06:09:48 +00:00
John Ericson
904625852d pkgsStatic: Inline more of static overlay 2021-08-19 21:55:06 +00:00
John Ericson
f110a182a6 stdenv: Fix overriding + overrideAttrs
The old stdenv adapters were subtly wrong in two ways:

 - `overrideAttrs` leaked the original, unoverridden `mkDerivation`.

 - `stdenv.override` would throw away any manually-set `mkDerivation`
   from a stdenv reverting to the original.

Now, `mkDerivation` is controlled (nearly directly) via an argument, and
always correctly closes over the final ("self") stdenv. This means the
adapters can work entirely via `.override` without any manual `stdenv //
...`, and both those issues are fixed.

Note hashes are changed, because stdenvs no previously overridden like
`stdenvNoCC` and `crossLibcStdenv` now are. I had to add some
`dontDisableStatic = true` accordingly. The flip side however is that
since the overrides compose, we no longer need to override anything but
the default `stdenv` from which all the others are created.
2021-08-18 17:22:50 +00:00
Alyssa Ross
b0b5ef7286 stdenv: introduce dontAddStaticConfigureFlags
With removeUnknownConfigureFlags, it's impossible to express a package
that needs --enable-static, but will not accept --disable-shared,
without overriding the result of removeUnknownConfigureFlags _again_
in pkgs/top-level/static.nix.

It would be much better (and more in line with the rest of Nixpkgs) if
we encoded changes needed for static builds in package definitions
themselves, rather than in an ever-expanding list in static.nix.  This
is especially true when doing it in static.nix is going to require
multiple overrides to express what could be expressed with stdenv
options.

So as a step in that direction, and to fix the problem described
above, here I replace removeUnknownConfigureFlags with a new stdenv
option, dontAddStaticConfigureFlags.  With this mechanism, a package
that needs one but not both of the flags just needs to set
dontAddStaticConfigureFlags and then set up configureFlags manually
based on stdenv.hostPlatform.isStatic.
2021-06-11 14:16:05 -07:00
Ben Siraphob
36c91cea1d treewide: stdenv.lib -> lib 2021-01-27 13:08:40 +07:00
Jude Taylor
0de6275003 pkgsStatic: fix eval on Darwin 2020-04-28 08:41:48 -07:00
Dmitry Kalinkin
d05ee9c8ff
pkgsStatic: set BUILD_SHARED_LIBS=OFF for cmake 2020-01-03 11:31:17 -05:00
Matthew Bauer
07d78691da stdenv/adapters.nix: remove static from makeStaticLibraries
This logic should be in the pkgs/top-level/static.nix. We don’t want
to pollute Nixpkgs with =if stdenv.static=. Also, "static" is not
descriptive. We have two types of static stdenvs, ‘makeStaticLibaries’
and ‘makeStaticBinaries’. We shouldn’t rely on a static boolean like
this.
2019-09-19 12:52:28 -04:00
Tobias Mayer
bb71bb15ce pkgsStatic: propagate all buildInputs 2019-07-24 16:04:51 +02:00
Tobias Mayer
3c12ae1d35 Signal static build option in makeStaticLibraries
This flag can replace the extra static parameter to packages that
don't work automatically with this adapter.
2019-07-21 06:44:50 +02:00
Vladimír Čunát
b4ae841b23
Merge branch 'staging-next' into staging 2019-05-26 09:48:55 +02:00
Matthew Bauer
fea2422398 static: set default_library flag for meson in makeStaticLibrary
Adds support for building static libraries with meson.
2019-05-08 21:52:59 -04:00
Daniel Schaefer
786f02f7a4 treewide: Remove usage of isNull
isNull "is deprecated; just write e == null instead" says the Nix manual
2019-04-29 14:05:50 +02:00
James Kay
eb76dd37a7
makeStaticBinaries: add a static glibc when performing a mkDerivation 2018-12-14 11:02:18 +00:00
Matthew Bauer
8726f6a558 stdenv/adapters.nix: fixup makeStaticBinaries
- makeStaticBinaries don’t work on Darwin (no stable ABI!)
- Need to make sure NIX_CFLAGS_LINK appends
- isStatic is not used anymore
2018-12-04 21:12:17 -06:00
Yegor Timoshenko
cd0c8739d7
Merge pull request #37600 from abbradar/impureusenative
impureUseNativeOptimizations: add stdenv adapter
2018-10-13 14:09:55 +00:00
John Ericson
3e034bac1a stdenv adapter: Keep configureFlags a list 2018-08-03 17:06:03 -04:00
John Ericson
b81ee9df9f makeStdenvCross: Remove
It is inlined into the cross stdenv, which is its last use-case after
the previous commit.
2018-07-24 20:01:43 -04:00
John Ericson
c12b50b267 stdenv cross adapter: Use extraNativeBuildInputs
This means we don't need to hackily avoid overwriting `mkDerivation`.
2018-07-24 20:01:43 -04:00
John Ericson
87b4a5d6a7 stdenv: Remove crossAttrs, now that it is no longer used
Fix #33302
2018-07-24 20:01:43 -04:00
John Ericson
5a860c20f3 stdenv cross adapter: Don't define crossConfig
All its uses have been removed.
2018-05-14 23:33:12 -04:00
Nikolay Amiantov
15bfee85f3 impureUseNativeOptimizations: add stdenv adapter
This allows one to force a compiler to use native machine optimizations. This
goes contrary to all the usual guarantees of Nix and so should be used only by
end-user and only in specific cases when they know what are they doing.

In my case this is needed to get a noticeable FPS boost in RPCS3 which is very
CPU-hungry PlayStation 3 emulator.
2018-04-17 13:12:07 +03:00
John Ericson
8f54d931cd
Merge pull request #36401 from obsidiansystems/no-stdenv-cross-adapter
stdenv cross adapter: Get rid if `selfNativeBuildInput`
2018-03-06 20:17:13 -05:00
John Ericson
8d58008039 stdenv cross adapter: Get rid if selfNativeBuildInput
It is finally no longer used anywhere

Fixes #30587
2018-03-06 20:05:13 -05: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
5dcf3cdf37 stdenv: automatically update config.sub for musl 2018-02-13 09:44:36 -06:00
John Ericson
1cde06acf6 stdenv cross adapter: Get rid of extra propagatation of buildInputs
Binutils is patched so we don't rely on `--rpath-link`.
2017-12-29 17:32:28 -05:00
John Ericson
7a733ceda4 cross stdenv: No more native-fishing hack.
The comment says it was put there for pkgconfig, but now pkgconfig has
been dealt with.
2017-09-21 15:49:54 -04:00
John Ericson
3af3d6efc2 stdenv cross adapater: Remove old extraBuildInputs
They, unlike their native counterparts, run on the wrong platform and
are therefore invalid.
2017-09-21 14:52:42 -04:00
John Ericson
05ef1034c7 stdenv cross adaptor: Add optional overrides parameter
By default, all previous overrides are discarded as before, as they
would only apply to the old host platform. But sometimes it is useful to
add some new ones, and this optional parameter allows that.
2017-09-21 14:52:07 -04:00
John Ericson
738bb4777c stdenv: Update autotools scripts on all Aarch64, not just Linux
This is needed when cross-compiling for iOS (Aarch64 + Darwin). I also
changed the syntax of the Linux stdenv for visual consistency, though
that has no effect on semantics as the os is already guaranteed to be
Linux.
2017-09-21 14:40:40 -04:00
John Ericson
e826a6a247 stdenv: Move some logic from cross adapter to stdenv proper
Eventually the adapter will be removed.  Moved is

 - Name suffix from hostPlatform

 - configurePlatforms

   To not cause more breakage, the default is currently [], but
   eventually it will be [ "build" "host" ], as the cross adapter makes
   it today.
2017-07-13 19:05:36 -04:00
John Ericson
a302d7360f top-level: {build,host,target}Platform are defined in the stdenv instead
See #27069 for a discussion of this
2017-07-07 12:55:02 -04:00
John Ericson
e0492d58a6 cross stdenv adaptor: Disable checkPhase by default
Before gcc-cross-wrapper did this unconditionally
2017-06-22 17:52:28 -04:00
John Ericson
594d264205 cross stdenv adaptor: Support --host --build --target across the board
Packages get --host and --target by default, but can explicitly request
any subset to be passed as needed. See docs for more info.

rustc: Avoid hash breakage by using the old (ignored)
dontSetConfigureCross when not cross building
2017-06-22 17:52:28 -04:00
John Ericson
9bfd03eff7 cross stdenv adaptor: Remove ccCross binutils attrs and binutils extra buildDepends
It now has the correct wrapped tools and nothing else is needed.
2017-06-22 17:52:28 -04:00
John Ericson
295315cc87 binutilsCross: Remove and use binutils instead always
See previous commit for what was done to `binutils` to make this
possible.

There were some uses of `forcedNativePackages` added. The
combination of overrides with that attribute is highly spooky: it's
often important that if an overridden package comes from it, the
replaced arguments for that package come from it. Long term this
package set and all the spookiness should be gone and irrelevant:

  "Move along, nothing to see here!"

No hashes should be changed with this commit
2017-04-25 21:36:19 -04:00
John Ericson
49c99b70cf cross-stdenv: Only prune most overrides in the final stage
Before all overrides were also pruned in the previous stage, now
only gcc and binutils are, because they alone care about about the
target platform. The rest of the overrides don't, so it's better to
preserve them in order to avoid spurious rebuilds.
2017-04-24 16:31:53 -04:00