Skip to content
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

Cross-platform all bottles: shebangs #11227

Closed
Bo98 opened this issue Apr 22, 2021 · 9 comments
Closed

Cross-platform all bottles: shebangs #11227

Bo98 opened this issue Apr 22, 2021 · 9 comments
Labels
features New features outdated PR was locked due to age

Comments

@Bo98
Copy link
Member

Bo98 commented Apr 22, 2021

Provide a detailed description of the proposed feature

One key difference between macOS and Linux is how we use system Perl (and other scripting languages) on macOS but use brewed Perl on Linux.

This leads to different shebangs in some cases, with macOS pointing to /usr/bin/perl and Linux pointing to HOMEBREW_PREFIX/opt/perl/bin/perl.

In order to achieve cross-platform bottles, we could use keg-relocation logic to replace the shebangs with @@HOMEBREW_PERL@@ which can be replaced with the correct shebang at pour time.

What is the motivation for the feature?

Achieving cross-platform all bottles where possible.

How will the feature be relevant to at least 90% of Homebrew users?

Formulae which have all bottles can be installed on any platform without having to build from source - rather than be limited to just what we run CI on.

What alternatives to the feature have been considered?

An alternative is to stop using system Perl and use brewed Perl universally.

@Bo98 Bo98 added the features New features label Apr 22, 2021
@iMichka
Copy link
Member

iMichka commented Apr 22, 2021

An alternative is to stop using system Perl and use brewed Perl universally.

If I remember well, Apple plans to drop all scripting languages (like ruby, Python, ...). Don't know what is the fate of system perl. On the other hand they started providing Python 3 through the CLT, so their way of doing things is not super consistent.

@Bo98
Copy link
Member Author

Bo98 commented Apr 22, 2021

Yeah they do plan to do something, albeit it's not very clear exactly what. They say "future versions of macOS won’t include scripting language runtimes by default, and might require you to install additional packages."

"Additional packages" might refer to the CLT, but this would indeed still be a concern for us since we do support the no-devtools case.

@MikeMcQuaid
Copy link
Member

In order to achieve cross-platform bottles, we could use keg-relocation logic to replace the shebangs with @@HOMEBREW_PERL@@ which can be replaced with the correct shebang at pour time.

👍🏻

How/why does this happen, is it just uses_from_macos related? If so, perhaps something more generic could be done to use these uses_from_macos lines to replace system dependencies with Homebrew ones in these cases?

If I remember well, Apple plans to drop all scripting languages (like ruby, Python, ...).

They've announced it but I wouldn't bet on it happening for a good while. While we still have system libraries/languages: let's use them. That's kinda why Homebrew originally came into creation.

@Bo98
Copy link
Member Author

Bo98 commented Apr 22, 2021

How/why does this happen, is it just uses_from_macos related? If so, perhaps something more generic could be done to use these uses_from_macos lines to replace system dependencies with Homebrew ones in these cases?

Pretty much yes.

ExtUtils::MakeMaker will detect itself what perl executable is being run and use that as the shebang, and in other cases our own rewrite_shebang also does something similar to use /usr/bin/perl if we have uses_from_macos and HOMEBREW_PREFIX/opt/perl/bin/perl otherwise.

@MikeMcQuaid
Copy link
Member

Ah, this is pretty much only a thing because of rewrite_shebang, right? I think in that case it'd be reasonable to only handle those cases (or store enough state so that we know we need to fix up those cases when we do rewrite shebangs).

@Bo98
Copy link
Member Author

Bo98 commented Apr 22, 2021

this is pretty much only a thing because of rewrite_shebang, right?

Perl's ExtUtils::MakeMaker also does it.

@MikeMcQuaid
Copy link
Member

Gotcha. Makes sense to me to do it for Python/Perl, then 👍🏻. Thanks @Bo98!

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label May 14, 2021
@Bo98 Bo98 removed the stale No recent activity label May 23, 2021
@Bo98
Copy link
Member Author

Bo98 commented May 23, 2021

This was addressed in #11286.

@github-actions github-actions bot added the outdated PR was locked due to age label Jun 23, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
features New features outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

3 participants