Skip to content

Conversation

@aperezdc
Copy link

Apply the needed changes to make builds succeed on Linux. Mainly this involves features missing on non-Apple systems:

  • URLResourceKey.volumeAvailableCapacityForImportantUsageKey is not available, so only .volumeAvailableCapacityKey is used.
  • The CryptoKit module is only available on Apple systems. The Crypto module can be used instead, which exposes the same API and wraps CryptoKit where available, and in the rest of cases uses a BoringSSL under the hood.
  • Linux Swift toolchains include a new FoundationNetworking module that contains some of the APIs previously available directly in Foundation.
  • URLError.downloadTaskResumeData is not available, download resumption is disabled on Linux.
  • The Hardware.registryProperty(for:) function always returns nil.
  • Using setbuf(__stdoutp, ...) does not build on Linux.
  • Shim autoreleasepool() functions are provided on Linux.

My goal with this is to be able to inspect and download MacOS images on Linux at some point. This is only a first patch to check if there's interest, and there are a number of changes that would be good to do after this patch 😃

There are a few more changes that probably would be good to have for non-Apple systems (like using $TMPDIR if defined with a fallback to /tmp), disabling generation of installer formats that require running MacOS tools (for example hdiutil) which are not available elsewhere, and removing the need to run as root (which will be fine to only do downloads).

Apply the needed changes to make builds succeed on Linux. Mainly this
involves features missing on non-Apple systems:

- URLResourceKey.volumeAvailableCapacityForImportantUsageKey is not
  available, so only .volumeAvailableCapacityKey is used.
- The CryptoKit module is only available on Apple systems. The Crypto
  module can be used instead, which exposes the same API and wraps
  CryptoKit where available, and in the rest of cases uses a BoringSSL
  under the hood.
- Linux Swift toolchains include a new FoundationNetworking module that
  contains some of the APIs previously available directly in Foundation.
- URLError.downloadTaskResumeData is not available, download resumption
  is disabled on Linux.
- The Hardware.registryProperty(for:) function always returns nil.
- Using setbuf(__stdoutp, ...) does not build on Linux.
- Shim autoreleasepool() functions are provided on Linux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant