Skip to content

Enable sodium and gmp when their libraries are installed - #1

Merged
Rusydy merged 2 commits into
Rusydy:refactor-with-php-buildfrom
runephilosof:optional-extensions
Oct 20, 2026
Merged

Rusydy merged 2 commits into
Rusydy:refactor-with-php-buildfrom
runephilosof:optional-extensions

Conversation

@runephilosof

Copy link
Copy Markdown

For asdf-community#200. Fixes asdf-community#147.

php-build's default configure options include neither --with-sodium nor --with-gmp. On master, macOS got both automatically when Homebrew had libsodium/gmp, but asdf-community#200 removes that detection, even though its README still lists brew install gmp libsodium. Linux never had it, so composer install fails for packages that need ext-sodium unless you set PHP_CONFIGURE_OPTIONS.

setup_optional_extensions adds --with-sodium / --with-gmp when pkg-config finds the library, on Linux and macOS. The flags take no DIR, because PHP < 8.4 then looks for DIR/include/gmp.h, which Debian's multiarch layout lacks. A sodium or gmp flag in PHP_CONFIGURE_OPTIONS takes precedence.
CI installs both libraries and checks with php --ri that openssl, curl, sodium and gmp are loaded.
The README's Linux dependencies add libsodium-dev, libgmp-dev and libbz2-dev. php-build configures --with-bz2 by default and fails without it.

Tested on Debian 12: asdf install php 8.2.34 loads all four extensions, and a Laravel app's composer install and test suite run on it. make lint, make fmt-check and bats (6 new tests) pass.

Not tested on macOS.

runephilosof and others added 2 commits October 12, 2026 12:58
php-build's default configure options include --with-bz2, so configure
fails with "Please reinstall the BZip2 distribution" without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
php-build's default configure options include neither --with-sodium nor
--with-gmp, so installing libsodium or gmp had no effect, and
composer install fails for packages that require ext-sodium.

Add both flags when pkg-config finds the library, on Linux and macOS.
The flags take no DIR because PHP < 8.4 then looks for DIR/include/gmp.h,
which Debian's multiarch layout lacks. A sodium or gmp flag in
PHP_CONFIGURE_OPTIONS takes precedence.

CI installs both libraries and checks with php --ri that openssl, curl,
sodium and gmp are loaded.

Fixes asdf-community#147

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rusydy
Rusydy merged commit 6b4792f into Rusydy:refactor-with-php-build Oct 20, 2026
12 checks passed
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.

2 participants