This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
gas isn't built for Darwin, so previously this failed when trying to
install it:
make: Entering directory '/private/tmp/nix-build-binutils-2.44.drv-0/build'
make: *** /private/tmp/nix-build-binutils-2.44.drv-0/build-arm64-apple-darwin/gas: No such file or directory. Stop.
make: Leaving directory '/private/tmp/nix-build-binutils-2.44.drv-0/build'
Fixes: 437ad124ac ("binutils-unwrapped-all-targets: per-target gas")
This way, we don't have to touch every file generated from one we
patch. It also makes it possible to do an out-of-tree build —
otherwise, the source files would be copied into the build directory
during Make, so there'd be no opportunity to touch some of them.
This same hack is already used by the minimal-bootstrap binutils.
They are not doing anything right now. This is in preparation for their
complete removal from the tree.
Note: several changes that affect the derivation inputs (e.g. removal of
references to stub paths in build instructions) were left out. They will
be cleaned up the next iteration and will require special care.
Note: this PR is a result of a mix of ugly regex (not AST) based
automation and some manual labor. For reference, the regex automation
part was hacked in: https://github.com/booxter/nix-clean-apple_sdk
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev 78e9caf153
result/bin/apply-formatting $NIXPKGS_PATH
Currently the target triple leaks into the clang build via llvm using
libbfd, whose build varies according to the target triple.
LLVM only uses libbfd to enable LTO via the linker plugin (called
LLVMgold.so, though multiple linkers can use the same plugin).
Drop the dependency on the libbfd build, and consume the only needed
source instead. (This would be a good use of CA-derivations FWIW).
The result of this commit is that these match:
* nix eval --raw nixpkgs#clang.cc
* nix eval --raw nixpkgs#pkgsStatic.pkgsLLVM.stdenv.cc.cc
* nix eval --raw nixpkgs#pkgsCross.aarch64-multiplatform.pkgsLLVM.stdenv.cc.cc
This means fewer clang builds will be needed to support cross
configurations, and users wanting to target an exotic cross
configuration should be able to do so without a rebuild of clang.
Also drops libbfd.hasPluginAPI which no longer has any users.
Signed-off-by: Peter Waller <p@pwaller.net>
The Darwin patch was always supposed to be unconditional, and neither
of these patches should have any effect when applied to other targets.
Conditional application should be avoided where possible as it makes
it very easy to miss when a patch needs to be updated.
This was added in ebc2243778 ("binutils: Add iOS as a supported
platform"), at the same time as a patch. That patch was removed in
045c2d219d ("binutils-unwrapped: remove broken iOS patch"), and I'm
not sure what other reason there would be for autoreconfHook to be
required specifically for iOS, so I think we can remove it. It's not
possible to test since iOS cross has been broken for months, and
keeping this around is making other refactors (like adding cross
binutils packages) harder.
This hasn't made it past patchPhase since dde943e535 ("Revert
"Revert "Merge pull request #86954 from
lovesegfault/binutils-2.34"""), more than four ago. It's therefore
safe to say that nobody depends on this continuing to work in recent
Nixpkgs, and all these targetPlatform conditionals are making new
development (like adding cross binutils packages), so let's just
remove it.
It can be brought back if somebody wants to make it work in future,
but given that upstream binutils will continue to diverge from the
stagnant vc4 fork, a better way of doing this would be to upstream vc4
support to binutils, or at the very least use a different expression
for vc4 binutils.
This hasn't applied since e1ef521cff ("binutils: 2.39 -> 2.40"),
almost two years ago. It's therefore safe to say that nobody depends
on this continuing to work in recent Nixpkgs, and all these
targetPlatform conditionals are making new development (like adding
cross binutils packages), so let's just remove it.
It can be brought back if somebody wants to make it work in future,
but since it seems to just be trying to make iOS behave identically to
macOS, a better solution would probably be to just pass the darwin
triple when building for iOS.
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
Without the change `pkgsMusl.pkgsStatic.buildPackages.binutils.bintools`
build fails as:
$ ln: failed to create symbolic link './include': File exists
This happens because both host and target are `x86_64-unknown-linux-musl`.
But `hostPlatform` differs from `targetPlatform` by `isStatic` value.
By `./configure`'s standard it's not yet a cross-compilation. The change
tries to move things around only when tuples change.
binutils plugins API does not depend on target. It depends only on host.
Tested the change to still be able to compile `firefox` which uses wasi
target and pulls in llvm with binutils plugin support.
`binutils` is inconsistent at installing it's headers to
$dev/include
Instead it installs headers into two locations:
$out/$host/$target/include
$dev/include
There is no distinction between these two. Both headers are for HOST
libraries. Expetially for multitarget binutils builds.
This change fixes build of the following packages that build `binutils`
as a cross-compiler:
pkgsCross.x86_64-freebsd.buildPackages.llvm_12
pkgsCross.aarch64-multiplatform.buildPackages.llvm_12
I got the plugin API support at least once incorrect. Instead of
copying the deifnition let's consolidate it within binutils itself.
While at it forward-ported changes to llvm_{13,14,15}.
The change is a no-op from rebuild perspective.
A few potentially disruptive changes:
- binutils does not embed ${binutils-unwrapped}/lib as a default library
search path anymore. This will cause link failures for -lbfd -lopcodes
users that did not declare their dependency on those libraries. They
will need to add `libbfd` and `libopcodes` attributes to build inputs.
- `libbfd` and `libopcodes` attributes now just reference
`binutils-unwrapped.{dev,lib}` pair of attributes without patching
`binutils` build system.
We don't patch build system anymore and use multiple outputs out of
existing `binutils` build. That makes the result more maintainable: no
need to handle ever growing list of dependencied of `libbfd`. This time
new addition was `libsframe`.
To accomodate `out` / `lib` output split I had to remove `lib` -> `bin`
backreference by removing legacy lookup path for plugins.
I also did not enable `zstd` just yet as `nixpkgs` version of `zstd`
package pulls in `cmake` into bootstrap sequence.
Changes: https://lists.gnu.org/archive/html/info-gnu/2023-01/msg00003.html
Normally binutils provides pregenerated manuals along with release
tarball. Manuals regeneration is needed every time we change
`configure.ac`. But usually there are no material changes in it.
This change instead inhibits manuals regeenration by keeping
man and info files up to date.
The diff of bootstrap tree before and after the change:
$ nix-store --query --graph $(nix-instantiate -A stdenv) |
fgrep ' -> ' | awk '{print $3}' | sort -u |
sed 's/"[0-9a-z]\{32\}-/"/g' | sort > before
$ nix-store --query --graph $(nix-instantiate -A stdenv) |
fgrep ' -> ' | awk '{print $3}' | sort -u |
sed 's/"[0-9a-z]\{32\}-/"/g' | sort > after
$ diff -U0 before after
--- before
+++ after
@@ -100 +99,0 @@
-"texinfo-6.8.drv"
Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>