-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build] Add a flag that allows disabling appending the host target's name to the install-destdir for a cross-compiled toolchain #40633
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
Conversation
I have no idea, sorry. It's been too long, and the build script has totally changed in that time. Although I think "hostname" in this case might be a little ambiguous. When I looked at it just now, I thought it would be appending a name like "Karls-Laptop" (i.e. a network hostname)... which would be alarming and not making a lot of sense. I feel like there are already so many flags, it's hard to know what any of them do or why you'd use them. Ideally at least their names would be extremely clear. |
I was surprised to find that this installation code is untouched since you wrote it in 2016. Of course, not many people cross-compile the Swift toolchain, so that's why.
Most come with a short description in the help, as I've written here, so that usually hasn't been a problem for me. |
@kubamracek, would you review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general approach looks good to me -- we are still relying on build-script-impl
for part of our build logic, and in this case I don't think we can avoid updating it.
My only suggestion would be to rename the flag -- more details in the comments (start from utils/build_swift/build_swift/driver_arguments.py
)
utils/swift_build_support/swift_build_support/build_script_invocation.py
Outdated
Show resolved
Hide resolved
…name to the install-destdir for a cross-compiled toolchain This is useful if you're cross-compiling the toolchain for a single host and don't want your specified install path modified.
d113d7b
to
3e77176
Compare
@edymtt, made all the changes you asked for, ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks good to me, thanks a lot for incorporating my feedback!
default=True, | ||
help="Append each cross-compilation host target's name as a subdirectory " | ||
"for each cross-compiled toolchain's destdir, useful when building " | ||
"multiple toolchains and can be disabled if only cross-compiling one.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you phrased this description -- in particular how concise it is.
elif [[ "${host}" == "merged-hosts" ]]; then | ||
# This assumes that all hosts are merged to the lipo. | ||
elif [[ "${host}" == "merged-hosts" ]] || | ||
[[ "$(true_false ${CROSS_COMPILE_APPEND_HOST_TARGET_TO_DESTDIR})" == "FALSE" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turned out way better than I imagined -- thanks for reminding me about the true_false
facility.
@swift-ci please smoke test |
@swift-ci please test Apple Silicon |
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test |
@swift-ci please python lint |
@swift-ci Please Build Toolchain |
Build failed |
@swift-ci please smoke test macOS |
|
@swift-ci please smoke test Linux |
All tests should pass, since cross-compiling the toolchain for non-Darwin platforms isn't tested on the CI. |
Linux Toolchain (Ubuntu 16.04) Install command |
Failing macOS tests are unrelated to this pull. |
This is useful if you're cross-compiling the toolchain for a single host and don't want your specified install path modified.
I have been patching out the hostname for years when cross-compiling the toolchain for Android, so I just came up with this
build-script
flag instead, finagolfin/termux-packages@17cb147, and that worked. Another advantage is when cross-compiling standalone SDKs, these unnecessary hostname directories won't be applied.I'm not particular about hacking in a build flag like this, so if someone has a better idea, I'm all ears. @karwa, you added this in #2497 more than five years ago and @gribozavr approved it, any input welcome.