Commit Graph

51 Commits

Author SHA1 Message Date
Emily
c9f171a0bb cmake: drop fixCmakeFiles hook
This regularly broke things – as can be seen from the number
of packages that were opting out of it – while providing only a
dubious and partial benefit to purity that other build systems did
not “enjoy”.

It has become associated with Darwin, but was actually introduced
in 2007 as part of 67d41efde1,
a work‐in‐progress commit for KDE 4 that introduced the CMake
setup hook. It has haunted us ever since, and will presumably become
even better at doing so now that it is a dead ghost.

Of course, it is possible and even likely that more impure paths will
leak into Darwin builds from third‐party CMake modules included
in packages. However, considering it already disregarded many of the
most common macOS system paths, it will be better overall to address
these in a targeted manner than dealing with the effects of this
brute‐force hook. In the long run, a good sandbox is going to be
the solution for reliable build reproducibility on the platform.
2025-09-19 18:34:06 +01:00
Emily
f7a0510047 swift: don’t build LLVM tools
These aren’t required by the build, and fail to compile with the
LLVM 21 / Darwin system libc++ changes.
2025-09-15 22:46:21 +01:00
Emily
2153141b51 swiftPackages.*: build with the default LLVM version 2025-09-02 04:14:28 +01:00
Emily
37cad5dfd5 swiftPackages.swift{,-unwrapped}: get libc++ headers from Swift’s LLVM
libc++ only supports a limited range of Clang versions, so this was
relying on the LLVM version corresponding to the one used in Swift’s
fork. Since Swift builds its own LLVM 15 anyway, we can simply install
the required libc++ headers along with it.
2025-09-02 04:14:28 +01:00
Emily
809f7d037c swiftPackages.swift{,-unwrapped,-driver}: ignore $NIX_CC
Swift needs Clang to link with. The linker patch breaks linking
when using Swift with a GCC‐based standard environment.

Similarly, the internal Clang headers in the resource directory are
coupled to the corresponding version of Clang. The resource root patch
caused Swift’s Clang to use the resource directory from the version
of Clang used in the build environment, which is only compatible if
the versions match.

Instead, hard‐code the Clang path in the patches and wrappers.
2025-09-02 04:09:46 +01:00
Emily
e0d9c9386f swiftPackages.swift-unwrapped: backport patches for modern LLVM 2025-09-02 04:09:46 +01:00
Emily
810bed0854 swiftPackages.swift-unwrapped: vendor Clang patch
The versions of `llvmPackages` that require this patch are going
away soon.
2025-09-02 04:09:46 +01:00
Emily
efde96d9be swiftPackages.swift-unwrapped: drop unnecessary mkdir
Honestly I did this in the middle of trying things and then forgot
about it, and I just don’t feel like bootstrapping the whole thing
again to drop this commit.
2025-09-02 04:09:46 +01:00
Emily
0ec026a14a swift.tests.cxx-interop-test: init
I used this to verify the libc++ changes.
2025-09-02 04:09:46 +01:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Charlotte 🦝 Deleńkec
61593a72a0 swift: throw on unsupported arch 2025-07-11 22:09:01 -05:00
Olivér Falvai
024f70f64d swift: use Python 3.12
https://hydra.nixos.org/build/299109156

Per the release notes: https://docs.python.org/3/whatsnew/3.13.html

> Remove the PyEval_ThreadsInitialized() function, deprecated in Python 3.9. Since Python 3.7, Py_Initialize() always creates the GIL: calling PyEval_InitThreads() does nothing and PyEval_ThreadsInitialized() always returns non-zero.
2025-06-03 18:43:25 +02:00
Michael Hoang
e3895dafc9 swift: use aarch64 instead of arm64 on Linux 2025-05-05 13:06:42 +10:00
Fernando Rodrigues
05580f4b44 treewide: switch instances of lib.teams.*.members to the new meta.teams attribute
Follow-up to #394797.

Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2025-04-25 22:20:17 -03:00
Emily
61582c7043 lib/systems: use Darwin architecture names for config and uname
`aarch64-apple-darwin` no longer works with LLVM 20.
2025-04-02 21:22:47 +01:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Wolfgang Walther
b19d0f6d3d treewide: replace substituteAll with replaceVars 2025-02-10 22:51:56 +01:00
Emily
e05898e313 swift: remove code for macOS < 11 2025-01-03 17:41:02 +00:00
Artturin
276fe40ff3 swift: Fix eval failure error: expected a string but found null: null
Dunno if this is correct, there's other `hostPlatform.isDarwin`
conditionals which may be wrong.

Leaving the other conditionals to swift maintainers or people who are
interested in swift cross-compilation

```
$ nix repl --file . --system aarch64-darwin
nix-repl> pkgsCross.aarch64-multiplatform.swift
«derivation /nix/store/kqbaqwdfc9g0yvkq4ffrlqspranprlmy-swift-wrapper-aarch64-unknown-linux-gnu-5.8.drv»

nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.swift
error:
       error: expected a string but found null: null
       at /home/artturin/nixgits/my-nixpkgs/.worktree/2/pkgs/development/compilers/swift/compiler/default.nix:586:11:
          585|         #WATCHOS_SIMULATOR
          586|       }.${targetPlatform.darwinPlatform}}
             |           ^
          587|
```
2024-12-12 21:09:56 +02:00
Zhong Jianxin
8dfed1b9a4 swift: Workaround Hydra darwin build problem
Fail to build with ninja 1.12 when NIX_BUILD_CORES is low (Hydra or Github Actions):

```
ld: warning: directory not found for option '-L/nix/store/g9rbp9m6vs1xj4jl6b6vjb6bm8kgr107-SDKs/MacOSX10.15.sdk/usr/lib/swift'
...
ld: warning: Could not find or use auto-linked library 'swiftCompatibility56'
Undefined symbols for architecture arm64:
  "__swift_FORCE_LOAD_$_swiftCompatibility56", referenced from:
      __swift_FORCE_LOAD_$_swiftCompatibility56_$_Optimizer in libswiftCompilerModules-bootstrapping1.a(Optimizer.o)
  ...
```

Can reproduce using `nix --option cores 2 build -f . swiftPackages.swift-unwrapped`.

Until we find out the exact cause, follow [swift upstream][1], pin ninja to version
1.11.1.

[1]: https://github.com/swiftlang/swift/pull/72989
2024-11-08 12:31:09 +08:00
Randy Eckenrode
15331b1c32 swift: use cctools.libtool directly 2024-10-10 01:07:17 -04:00
Randy Eckenrode
7c0c8fd74a swift: build Swift with associated SDK version
Swift releases are associated with particular Darwin SDK versions. They
don’t _have_ to use that version, but it makes sense to use that version
by default. The deployment target is set to the supported Swift minimum
versions. Unlike C and C++, Swift requires you to availability
annotations, so propagating a newer SDK should be safe.
2024-10-10 01:07:17 -04:00
Randy Eckenrode
083d02ffc4 swift: drop libarclite
libarclite is needed to support ARC on very old deployment targets
(10.10 and older). None of these deployment targets are supported
deployment targets in nixpkgs, especially for Swift. This removes the
need to package the command-line tools executables.
2024-10-10 01:07:17 -04:00
Randy Eckenrode
4d080bdf16 swift: add cctools.libtool as a native build input on Darwin 2024-10-10 01:07:17 -04:00
Randy Eckenrode
1ad3206aea swift: clean up ncurses and libedit references 2024-10-10 01:07:17 -04:00
Randy Eckenrode
cf0003e56f swift: fix build with the new Darwin SDK
Swift’s build makes a few assumptions about how the SDK is set up that
are not true anymore with the new SDK. Fix it to find the SDK at
`$SDKROOT` and copy additional stubs it needs to bootstrap.
2024-10-10 01:07:17 -04:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
Emily
b4bfb99048 swift: disable zerocallusedregs on all AArch64 2024-09-12 18:39:57 +01:00
Emily
6bbe65701d swift: add LLVM patches for SWIG 4 2024-09-12 18:11:01 +01:00
Tristan Ross
f9c6960071 swift: use clang 12 purity patch
LLVM 14's clang purity patch was removed as it is a duplicate of 12's.
2024-08-09 15:20:56 -07:00
Anderson Torres
7246208bc7 treewide: update meta.maintainers for Swift suite 2024-07-17 23:34:16 -03:00
Anderson Torres
2a9a026118 treewide: add lib.teams.swift.members to Swift suite 2024-07-17 23:34:16 -03:00
Anderson Torres
c9f7d60011 treewide: remove dtzWill as maintainer [no orphans]
Since theey is not active in a long span of time.

None of the packages in this commit are orphan.

All the packages listed here are related to Swift programming language compiler
suite.
2024-07-17 23:34:16 -03:00
David McFarland
514d22d117 swift: mark as unbroken on darwin 2024-07-12 13:09:06 -03:00
David McFarland
a5373e00f0 swift: disable zerocallusedregs hardening
Fixes: #320900
2024-07-12 13:09:06 -03:00
Vladimír Čunát
25c945df28 swift: fixup build after upgrade to python-3.12
https://hydra.nixos.org/build/264423982/nixlog/4/tail
I tested only building on x86_64-linux.
2024-07-06 09:00:37 +02:00
Guanran Wang
b9d5f7ca1e swift: mark as broken on darwin (#324593) 2024-07-04 20:37:41 -04:00
Alexis Hildebrandt
f8c4a98e8e treewide: Remove the definite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"([Tt]he)? ' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Tt]he (.)/\1\U\2/'
2024-06-09 23:08:46 +02:00
a-n-n-a-l-e-e
ce789e7e35 llvmPackages_{12,13,14,15,16,17,git}.{libcxx,libcxxabi}: merge libcxxabi into libcxx (#292043)
- merge libcxxabi into libcxx for LLVM 12, 13, 14, 15, 16, 17, and git.
- remove the link time workaround `-lc++ -lc++abi` from 58 packages as it is no longer required.
- fixes https://github.com/NixOS/nixpkgs/issues/166205
- provides alternative fixes for. https://github.com/NixOS/nixpkgs/issues/269548 https://github.com/NixOS/nix/issues/9640
- pkgsCross.x86_64-freebsd builds work again

This change can be represented in 3 stages
1. merge libcxxabi into libcxx -- files: pkgs/development/compilers/llvm/[12, git]/{libcxx, libcxxabi}
2. update stdenv to account for merge -- files: stdenv.{adapters, cc.wrapper, darwin}
3. remove all references to libcxxabi outside of llvm (about 58 packages modified)

### merging libcxxabi into libcxx
- take the union of the libcxxabi and libcxx cmake flags
- eliminate the libcxx-headers-only package - it was only needed to break libcxx <-> libcxxabi circular dependency
- libcxx.cxxabi is removed. external cxxabi (freebsd) will symlink headers / libs into libcxx.
- darwin will re-export the libcxxabi symbols into libcxx so linking `-lc++` is sufficient.
- linux/freebsd `libc++.so` is a linker script `LINK(libc++.so.1, -lc++abi)` making `-lc++` sufficient.
- libcxx/default.nix [12, 17] are identical except for patches and `LIBCXX_ADDITIONAL_LIBRARIES` (only used in 16+)
- git/libcxx/defaul.nix  does not link with -nostdlib when useLLVM is true so flag is removed. this is not much different than before as libcxxabi used -nostdlib where libcxx did not, so libc was linked in anyway.

### stdenv changes
- darwin bootstrap, remove references to libcxxabi and cxxabi
- cc-wrapper: remove c++ link workaround when libcxx.cxxabi doesn't exist (still exists for LLVM pre 12)
- adapter: update overrideLibcxx to account for a pkgs.stdenv that only has libcxx

### 58 package updates
- remove `NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}` as no longer needed
- swift, nodejs_v8 remove libcxxabi references in the clang override

https://github.com/NixOS/nixpkgs/pull/292043
2024-03-11 03:53:37 -07:00
Sergei Trofimovich
e5ec997164 swift: fix build against gcc-13
Without the change `swift` build fails on bundled `llvm` on
`staging-next` as:

    In file included from /build/src/llvm-project/llvm/lib/Support/Signals.cpp:14:
    /build/src/llvm-project/llvm/include/llvm/Support/Signals.h:119:24:
        error: unknown type name 'uintptr_t'; did you mean '__intptr_t'?
      void CleanupOnSignal(uintptr_t Context);
                           ^~~~~~~~~
                           __intptr_t

THe change pulls in upstream fix.
2024-01-03 19:54:04 +00:00
Randy Eckenrode
e7cf9a7c45 swift: update for cc-wrapper changes
The Swift compiler derivation modifies the clang wrapper to use
`exec -a "$0"` to allow it to use the same binary for both `clang` and
`clang++`. The sed script it uses to do this fails after the cc-wrapper
changes in 6f2b3ba027 were merged.

This is fixed by updating `makeClangWrapper` to work with the cc-wrapper
changes by having Bash invoke a simple script that uses `exec -a "$0"`
to set the required name for clang.

This fixes the staging-next build failures with Swift on Darwin and Linux.

https://github.com/NixOS/nixpkgs/pull/248496#issuecomment-1676831102
2023-08-20 00:17:10 -04:00
Stéphan Kochen
f85d12198f swift: 5.7.3 -> 5.8 2023-04-30 15:03:20 +02:00
Stéphan Kochen
cc2738c71a swift: reduce closure size of swift-lib 2023-03-15 19:08:38 +01:00
Stéphan Kochen
a34a8db902 swift: enable experimental flags to match upstream 2023-02-01 08:29:36 +01:00
Domen Kožar
cfb80ea275 Merge pull request #211908 from stephank/fix/swift-darwin
[staging-next] swift: bootstrap using system stdlib
2023-01-28 11:58:03 +00:00
Stéphan Kochen
7220d26ed5 swift: bootstrap using system stdlib
`BOOTSTRAPPING-WITH-HOSTLIBS` is also what official builds use on
Darwin. It's unclear why `BOOTSTRAPPING` was working before, but it is
probably not supported on Darwin to begin with. It was now causing
crashes because of mixing of two copies of stdlib at run-time.
2023-01-22 10:36:11 +01:00
Guillaume Girol
447ca4bf3b treewide: migrate to nativeCheckInputs 2023-01-21 12:00:00 +00:00
Stéphan Kochen
a4c8c87cb1 swift: remove NIX_BUILD_TOP 2022-11-21 11:04:54 +01:00
Stéphan Kochen
449e2f1b01 swift: track version in a central sources.nix 2022-11-15 14:24:25 +01:00
Stéphan Kochen
dcb0eaf66d swift-driver: init at 5.7 2022-10-10 21:26:50 +02:00