fix: use openssl@3 on macOS, falling back to openssl@1.1 - #22
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.
|
Thank you for identifying the Homebrew OpenSSL issue and proposing a fix. This is now addressed by #24 and released in v0.3.1. The shipped implementation selects the dependency by PHP version: PHP 8.1+ uses OpenSSL 3, while older versions select the legacy dependency and report a clear error when it is unavailable. Explicit PHP_CONFIGURE_OPTIONS are preserved. The README and macOS CI prerequisites were also updated, and the complete macOS installation check passed. We cannot use the unconditional OpenSSL 3 preference from this PR for all versions: the official PHP requirements specify OpenSSL < 3.0 for PHP 7.1–8.0, so the stated PHP 7.4 compatibility would be unsafe to rely on. Closing as superseded by the version-aware fix in #24. Thank you for the contribution. |
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.