NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.96k stars 13.97k forks source link

Replace opencflite with CoreFoundation from Swift #308342

Open 2xsaiko opened 5 months ago

2xsaiko commented 5 months ago

The open-source CoreFoundation is available here, the opencflite repository hasn't been updated since 2015: https://github.com/apple/swift-corelibs-foundation/tree/release/6.0/CoreFoundation

This is already packaged as darwin.swift-corelibs-foundation but the package hard depends on launchd right now so doesn't compile on Linux as-is.

Related: #110357

Notify maintainers

@reckenrode I suppose, nobody really updated either of these ever since they were added and I think you're doing related toolchain stuff


Note for maintainers: Please tag this issue in your PR.


Add a :+1: reaction to issues you find important.

reckenrode commented 5 months ago

opencflite was updated to 635.21.8 in https://github.com/NixOS/nixpkgs/pull/296780. The source was changed to https://github.com/gerickson/opencflite/.

2xsaiko commented 5 months ago

Oh, my bad, I missed that. Looks like there is even a release of 1153.18 on the Apple open source page, which would be newer -- but still, that's a release from 2015 if the license header is to be believed, and I read a comment somewhere saying that up to date releases of CoreFoundation are now in that Swift repo.

reckenrode commented 5 months ago

According to the release notes for that release, opencflite has cherry-picked some changes from newer versions including 1153.18. I don’t think its version corresponds exactly to Apple’s.

Can you elaborate on the need for swift-corelibs-foundation? Darwin doesn’t use swift-corelibs-foundation anymore. It’s from 2018 and probably won’t be updated.

2xsaiko commented 5 months ago

What I want to say is the following:

  1. CoreFoundation is packaged twice in nixpkgs when I don't see why it needs to be
  2. Apple's up to date and actively maintained CF is in that Swift repo (kinda has to be since as far as I can tell Swift runtime builds on top of it), and opencflite, even the new repo, isn't getting any of those updates

Hence, my suggestion is, drop opencflite, make Swift CF build for all platforms and move it to pkgs.CoreFoundation (or lowercase, whatever).

Can you elaborate on the need for swift-corelibs-foundation?

I mean idk, it's packaged, both packaged versions are out of date, and there's at least one package depending on opencflite. (I'm considering using it for something I'm working on, at least as an alternative dependency to GNUstep, that's why I came across this in the first place.)

reckenrode commented 5 months ago

There’s a third implementation in nixpkgs: swiftPackages.Foundation on Linux includes CoreFoundation. There’s no separate libCoreFoundation.so, but the symbols appear to be included in libFoundation.so. One complication is there are no headers. Those would have to be added to the output.

Whether to merge or replace opencflite with the other implementations is up to @wegank, but I would be against adding a top-level CoreFoundation package. It risks creating confusion about whether it should be used on Darwin and could cause packages to depend on it accidentally and unintentionally. The source-based CF was dropped on x86_64-darwin for 23.11, and the changes for 24.11 will finish removing the hooks that supported it. It’s too much of a maintenance burden, and newer releases of macOS have issues with it due to added hardening in the system CoreFoundation.

reckenrode commented 5 months ago

I want to add that my objection is based on the name and potential to cause issues for Darwin. Moving swift-corelibs-foundation to the top-level (and by-name presumably) is not a bad idea in itself.

From what I can tell, making it build on Linux would involve more work than just dropping launchd. There are also patches for the Darwin build that would have to be made conditional. I also don’t know whether it would use objc4 or some other runtime.