Skip to content
67 changes: 38 additions & 29 deletions docs/extension-maintainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,35 +387,44 @@ We are adding libraries and improving this feature over time. If the automatic
install of a system dependency that is supported below in your package manager
is NOT working, then please [report a bug](https://github.com/php/pie/issues).

| Library | Checked by PIE | Auto-installs in |
|---------------|----------------|--------------------|
| lib-curl | ✅ | apt, apk, dnf, yum |
| lib-enchant | ✅ | ❌ |
| lib-enchant-2 | ✅ | ❌ |
| lib-sodium | ✅ | apt, apk, dnf, yum |
| lib-ffi | ✅ | apt, apk, dnf, yum |
| lib-xslt | ✅ | apt, apk, dnf, yum |
| lib-zip | ✅ | apt, apk, dnf, yum |
| lib-png | ✅ | ❌ |
| lib-avif | ✅ | ❌ |
| lib-webp | ✅ | ❌ |
| lib-jpeg | ✅ | apt, apk, dnf, yum |
| lib-xpm | ✅ | ❌ |
| lib-freetype2 | ✅ | ❌ |
| lib-gdlib | ✅ | ❌ |
| lib-gmp | ✅ | ❌ |
| lib-gpgme | ✅ | apt, apk, dnf, yum |
| lib-pam | ✅ | apt, apk, dnf, yum |
| lib-sasl | ✅ | ❌ |
| lib-onig | ✅ | ❌ |
| lib-odbc | ✅ | ❌ |
| lib-capstone | ✅ | ❌ |
| lib-pcre | ✅ | ❌ |
| lib-edit | ✅ | ❌ |
| lib-snmp | ✅ | ❌ |
| lib-argon2 | ✅ | ❌ |
| lib-uriparser | ✅ | ❌ |
| lib-exslt | ✅ | ❌ |
| Library | Checked by PIE | Auto-installs in |
|-----------------|----------------|------------------|
| lib-curl | ✅ | apt, apk, dn |
| lib-enchant | ✅ | ❌ |
| lib-enchant-2 | ✅ | ❌ |
| lib-sodium | ✅ | apt, apk, dnf |
| lib-ffi | ✅ | apt, apk, dnf |
| lib-xslt | ✅ | apt, apk, dnf |
| lib-zip | ✅ | apt, apk, dnf |
| lib-png | ✅ | ❌ |
| lib-avif | ✅ | ❌ |
| lib-webp | ✅ | ❌ |
| lib-jpeg | ✅ | apt, apk, dnf |
| lib-xpm | ✅ | ❌ |
| lib-freetype2 | ✅ | ❌ |
| lib-gdlib | ✅ | ❌ |
| lib-gmp | ✅ | ❌ |
| lib-gpgme | ✅ | apt, apk, dnf |
| lib-pam | ✅ | apt, apk, dnf |
| lib-sasl | ✅ | apt, apk, dnf |
| lib-onig | ✅ | ❌ |
| lib-odbc | ✅ | ❌ |
| lib-capstone | ✅ | ❌ |
| lib-pcre | ✅ | ❌ |
| lib-edit | ✅ | ❌ |
| lib-snmp | ✅ | ❌ |
| lib-argon2 | ✅ | ❌ |
| lib-uriparser | ✅ | ❌ |
| lib-exslt | ✅ | ❌ |
| lib-yaml | ✅ | apt, apk, dnf |
| lib-uv | ✅ | apt, apk, dnf |
| lib-uuid | ✅ | apt, apk, dnf |
| lib-rdkafka | ✅ | apt, apk, dnf |
| lib-zlib | ✅ | apt, apk, dnf |
| lib-memcached | ✅ | apt, apk, dnf |
| lib-imagemagick | ✅ | apt, apk, dnf |
| lib-event | ✅ | apt, apk, dnf |
| lib-openssl | ✅ | apt, apk, dnf |

#### Checking the extension will work

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ class PhpBinaryPathBasedPlatformRepository extends PlatformRepository
'argon2' => 'libargon2',
'uriparser' => 'liburiparser',
'exslt' => 'libexslt',
'yaml' => 'yaml-0.1',
'uv' => 'libuv',
'uuid' => 'uuid',
'rdkafka' => 'rdkafka',
'zlib' => 'zlib',
'memcached' => 'libmemcached',
'imagemagick' => 'MagickWand',
'event' => 'libevent',
'openssl' => 'openssl',
];

private VersionParser $versionParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,76 @@ public static function default(): self
PackageManager::Microdnf->value => 'pkgconfig(pam)',
PackageManager::Yum->value => 'pkgconfig(pam)',
],
'yaml' => [
PackageManager::Apt->value => 'libyaml-dev',
PackageManager::Apk->value => 'yaml-dev',
PackageManager::Dnf->value => 'pkgconfig(yaml-0.1)',
PackageManager::Microdnf->value => 'pkgconfig(yaml-0.1)',
PackageManager::Yum->value => 'pkgconfig(yaml-0.1)',
],
'uv' => [
PackageManager::Apt->value => 'libuv1-dev',
PackageManager::Apk->value => 'libuv-dev',
PackageManager::Dnf->value => 'pkgconfig(libuv)',
PackageManager::Microdnf->value => 'pkgconfig(libuv)',
PackageManager::Yum->value => 'pkgconfig(libuv)',
],
'uuid' => [
PackageManager::Apt->value => 'uuid-dev',
PackageManager::Apk->value => 'util-linux-dev',
PackageManager::Dnf->value => 'pkgconfig(uuid)',
PackageManager::Microdnf->value => 'pkgconfig(uuid)',
PackageManager::Yum->value => 'pkgconfig(uuid)',
],
'rdkafka' => [
PackageManager::Apt->value => 'librdkafka-dev',
PackageManager::Apk->value => 'librdkafka-dev',
PackageManager::Dnf->value => 'pkgconfig(rdkafka)',
PackageManager::Microdnf->value => 'pkgconfig(rdkafka)',
PackageManager::Yum->value => 'pkgconfig(rdkafka)',
],
'zlib' => [
PackageManager::Apt->value => 'zlib1g-dev',
PackageManager::Apk->value => 'zlib-dev',
PackageManager::Dnf->value => 'pkgconfig(zlib)',
PackageManager::Microdnf->value => 'pkgconfig(zlib)',
PackageManager::Yum->value => 'pkgconfig(zlib)',
],
'sasl' => [
PackageManager::Apt->value => 'libsasl2-dev',
PackageManager::Apk->value => 'cyrus-sasl-dev',
PackageManager::Dnf->value => 'pkgconfig(libsasl2)',
PackageManager::Microdnf->value => 'pkgconfig(libsasl2)',
PackageManager::Yum->value => 'pkgconfig(libsasl2)',
],
'memcached' => [
PackageManager::Apt->value => 'libmemcached-dev',
PackageManager::Apk->value => 'libmemcached-dev',
PackageManager::Dnf->value => 'pkgconfig(libmemcached)',
PackageManager::Microdnf->value => 'pkgconfig(libmemcached)',
PackageManager::Yum->value => 'pkgconfig(libmemcached)',
],
'imagemagick' => [
PackageManager::Apt->value => 'libmagickwand-dev',
PackageManager::Apk->value => 'imagemagick-dev',
PackageManager::Dnf->value => 'pkgconfig(MagickWand)',
PackageManager::Microdnf->value => 'pkgconfig(MagickWand)',
PackageManager::Yum->value => 'pkgconfig(MagickWand)',
],
'event' => [
PackageManager::Apt->value => 'libevent-dev',
PackageManager::Apk->value => 'libevent-dev',
PackageManager::Dnf->value => 'pkgconfig(libevent)',
PackageManager::Microdnf->value => 'pkgconfig(libevent)',
PackageManager::Yum->value => 'pkgconfig(libevent)',
],
'openssl' => [
PackageManager::Apt->value => 'libssl-dev',
PackageManager::Apk->value => 'openssl-dev',
PackageManager::Dnf->value => 'pkgconfig(openssl)',
PackageManager::Microdnf->value => 'pkgconfig(openssl)',
PackageManager::Yum->value => 'pkgconfig(openssl)',
],
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,69 @@ public function testPlatformRepositoryContainsLibrariesReportedByPkgConfig(): vo
);
}

/** @return array<non-empty-string, array{0: non-empty-string, 1: non-empty-string, 2: non-empty-string}> */
public static function librariesDetectedUsingPkgConfig(): array
{
return [
'curl' => ['curl', 'libcurl', '8.12.1'],
'enchant' => ['enchant', 'enchant', '1.6.0'],
'enchant-2' => ['enchant-2', 'enchant-2', '2.3.3'],
'sodium' => ['sodium', 'libsodium', '1.0.18'],
'ffi' => ['ffi', 'libffi', '3.4.6'],
'xslt' => ['xslt', 'libxslt', '1.1.39'],
'zip' => ['zip', 'libzip', '1.10.1'],
'png' => ['png', 'libpng', '1.6.43'],
'avif' => ['avif', 'libavif', '1.0.4'],
'webp' => ['webp', 'libwebp', '1.3.2'],
'jpeg' => ['jpeg', 'libjpeg', '2.1.5'],
'xpm' => ['xpm', 'xpm', '3.5.17'],
'freetype2' => ['freetype2', 'freetype2', '26.1.20'],
'gdlib' => ['gdlib', 'gdlib', '2.3.3'],
'gmp' => ['gmp', 'gmp', '6.3.0'],
'gpgme' => ['gpgme', 'gpgme', '1.18.0'],
'pam' => ['pam', 'pam', '1.5.3'],
'sasl' => ['sasl', 'libsasl2', '2.1.28'],
'onig' => ['onig', 'oniguruma', '6.9.9'],
'odbc' => ['odbc', 'libiodbc', '3.52.16'],
'capstone' => ['capstone', 'capstone', '4.0.2'],
'pcre' => ['pcre', 'libpcre2-8', '10.42'],
'edit' => ['edit', 'libedit', '3.1'],
'snmp' => ['snmp', 'netsnmp', '5.9.4'],
'argon2' => ['argon2', 'libargon2', '20190702'],
'uriparser' => ['uriparser', 'liburiparser', '0.9.7'],
'exslt' => ['exslt', 'libexslt', '0.8.21'],
'yaml' => ['yaml', 'yaml-0.1', '0.2.5'],
'uv' => ['uv', 'libuv', '1.48.0'],
'uuid' => ['uuid', 'uuid', '2.39.3'],
'rdkafka' => ['rdkafka', 'rdkafka', '2.3.0'],
'zlib' => ['zlib', 'zlib', '1.3'],
'memcached' => ['memcached', 'libmemcached', '1.1.4'],
'imagemagick' => ['imagemagick', 'MagickWand', '6.9.12'],
'event' => ['event', 'libevent', '2.1.12-stable'],
'openssl' => ['openssl', 'openssl', '3.0.13'],
];
}

#[DataProvider('librariesDetectedUsingPkgConfig')]
public function testLibraryIsDetectedUsingPkgConfig(string $alias, string $pkgConfigName, string $version): void
{
$installedPiePackages = $this->createMock(InstalledPiePackages::class);
$installedPiePackages->method('allPiePackages')->willReturn(new PiePackageList([]));

$phpBinaryPath = $this->createMock(PhpBinaryPath::class);
$phpBinaryPath->method('version')->willReturn('8.1.0');
$phpBinaryPath->method('extensions')->willReturn([]);

$pkgConfig = $this->createMock(PkgConfig::class);
$pkgConfig->method('versionsOf')->willReturn([$pkgConfigName => $version]);

$platformRepository = new PhpBinaryPathBasedPlatformRepository($phpBinaryPath, $this->createMock(Composer::class), $installedPiePackages, $pkgConfig, []);

$lib = $platformRepository->findPackage('lib-' . $alias, '*');
self::assertNotNull($lib);
self::assertSame($version, $lib->getPrettyVersion());
}

/** @return array<non-empty-string, array{0: non-empty-string}> */
public static function installedLibraries(): array
{
Expand Down Expand Up @@ -227,6 +290,15 @@ public static function installedLibraries(): array
['argon2', 'libargon2'],
['uriparser', 'liburiparser'],
['exslt', 'libexslt'],
['yaml', 'yaml-0.1'],
['uv', 'libuv'],
['uuid', 'uuid'],
['rdkafka', 'rdkafka'],
['zlib', 'zlib'],
['memcached', 'libmemcached'],
['imagemagick', 'MagickWand'],
['event', 'libevent'],
['openssl', 'openssl'],
],
static function (array $pkg): bool {
try {
Expand Down
Loading
Loading