fix: use openssl@3 on macOS, falling back to openssl@1.1 - #22
Open
JamBalaya56562 wants to merge 1 commit into
Open
fix: use openssl@3 on macOS, falling back to openssl@1.1#22JamBalaya56562 wants to merge 1 commit into
JamBalaya56562 wants to merge 1 commit into
Conversation
Closes version-fox#8. Homebrew disabled openssl@1.1 on 2024-10-24, which broke bin/install on every modern macOS (the configure step couldn't resolve --with-openssl). Prefer openssl@3 (PHP 7.4+ supports OpenSSL 3) and fall back to openssl@1.1 only when it still happens to be installed for older PHP branches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the macOS build failure caused by
bin/installhardcoding theopenssl@1.1Homebrew formula, which Homebrew disabled on 2024-10-24.Prefer
openssl@3(which PHP 7.4+ supports natively) and only fall backto
openssl@1.1if it still happens to be installed locally.Closes #8.
Why
Trying to install any PHP version on a modern macOS goes like this:
The
homebrew_package_path openssl@1.1calls inbin/installthenreturn an empty string, the
--with-openssl=$openssl_pathflag is neveremitted, and
./configurefails (or builds a PHP without HTTPS support).openssl@1.1reached EOL upstream in September 2023 and Homebrew followeda year later. PHP 7.4 has supported OpenSSL 3 since release 7.4.30, and PHP
8.x supports it fully —
openssl@3is the right default now.What changed
homebrew_openssl_path()inbin/installthat resolvesopenssl@3first and falls back toopenssl@1.1if (and only if) theuser still has it installed for an older PHP branch. Both call sites
(
install_phpDarwin block andos_based_configure_optionsDarwinblock) now go through it.
.github/workflows/test-macos.yamland the macOS section ofREADME.mdnow list
openssl@3in the prerequisitebrew installline so the CImatrix actually exercises the new path.
The diff in `bin/install`
homebrew_package_path() { ... } +homebrew_openssl_path() { + local path=$(homebrew_package_path openssl@3) + if [ -z "$path" ]; then + path=$(homebrew_package_path openssl@1.1) + fi + echo "$path" +} install_php() { ... - local openssl_path=$(homebrew_package_path openssl@1.1) + local openssl_path=$(homebrew_openssl_path) ... } os_based_configure_options() { ... - local openssl_path=$(homebrew_package_path openssl@1.1) + local openssl_path=$(homebrew_openssl_path) ... }Compatibility notes
patch releases will still build but emit deprecation warnings during
make. Users on those patches typically already haveopenssl@1.1cached locally, in which case the fallback kicks in.
these need to install
openssl@1.1from a third-party tap (e.g.homebrew/cask-versionsor a community formula) and the fallbackresolves to it. Without it,
--with-opensslis omitted and PHPbuilds without HTTPS support, same as the current behaviour.
The fallback ordering is important: we always prefer
@3because that'swhat most users want, and
@1.1only wins when the user explicitlyinstalled it for a legacy build.
Out of scope
openssl@1.1support entirely — kept as a fallback so legacyPHP installs that the user has already configured don't regress.
this Homebrew change.