Skip to content

libswift: add support for Android and OpenBSD in the CMake config #40277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2021

Conversation

finagolfin
Copy link
Member

@finagolfin finagolfin commented Nov 21, 2021

Add a new libswift build mode for cross-compilation in the process, that currently only works for non-Darwin hosts.

@3405691582, let me know if you'd like me to added OpenBSD too.

@eeckstein, this modifies your pull #39461 to add support for Android, which I just built the Nov. 19 source snapshot natively on. When you get back from Thanksgiving, let me know what you think.

@3405691582
Copy link
Member

Sure, happy to test this for OpenBSD with some guidance on how to run a bootstrap build.

@finagolfin
Copy link
Member Author

I just built the latest trunk tag normally and it chooses the bootstrap build by default.

@eeckstein
Copy link
Contributor

Interesting. Is Android used as a host platform? I.e. is the swift compiler itself built on an Android system?

@finagolfin
Copy link
Member Author

Yes, I periodically build a trunk Swift toolchain natively on my Android phone and spin off patches like these to submit here. I also maintain the Termux package that provides a prebuilt toolchain for the Termux app on Android.

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@finagolfin finagolfin force-pushed the boot branch 2 times, most recently from b37551f to e3f088d Compare November 28, 2021 21:58
@finagolfin
Copy link
Member Author

I've extended this pull to support both HOSTTOOLS and CROSSCOMPILE-WITH-HOSTLIBS for non-Darwin platforms like Android. I just cross-compiled the last trunk snapshot toolchain for Android by using a tweaked version of this patch, and reused the existing logic to enable cross-compilation by passing in the requisite flag.

Let me know what you think of how I structured this.

@finagolfin finagolfin changed the title libswift: add bootstrapping support for Android in the CMake config libswift: add support for Android in the CMake config Nov 28, 2021
@finagolfin finagolfin marked this pull request as draft November 30, 2021 15:16
@finagolfin finagolfin marked this pull request as ready for review December 1, 2021 05:48
@finagolfin
Copy link
Member Author

Reworked this pull to add a new libswift build mode for non-Darwin cross-compilation instead, taking your lead from the now-closed #40308.

Ready for review, let me know what you think.

@finagolfin finagolfin changed the title libswift: add support for Android in the CMake config libswift: add support for Android and OpenBSD in the CMake config Dec 1, 2021
Add a new libswift build mode for cross-compilation in the process, that currently
only works for non-Darwin hosts.
Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!
Please make sure to also test the "hosttools" mode locally. It's not tested in CI

@finagolfin
Copy link
Member Author

finagolfin commented Dec 1, 2021

Squashed the commits into one, can you run the CI? I haven't tried "hosttools" mode on Android, but @3405691582 reported it worked for him on OpenBSD, so I figure it'll work for me too.

@finagolfin
Copy link
Member Author

@MaxDesiatov, would you run the CI on this?

@MaxDesiatov
Copy link
Contributor

@swift-ci please smoke test

@finagolfin
Copy link
Member Author

Passed CI, can be merged now.

@finagolfin
Copy link
Member Author

@eeckstein, would you merge?

@eeckstein eeckstein merged commit 1b2ac8c into swiftlang:main Dec 6, 2021
@finagolfin
Copy link
Member Author

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.

4 participants