Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,84 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

bundled-php-extension-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
php-versions:
- '8.1.33'
- '8.2.29'
- '8.3.23'
- '8.4.10'
- '8.5.0alpha2'
steps:
- name: "Purge built-in PHP version"
run: |
echo "libmemcached11 php* hhvm libhashkit2" | xargs -n 1 sudo apt-get purge --assume-yes || true
sudo apt-add-repository --remove ppa:ondrej/php -y
- name: Install platform dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
g++ gcc make autoconf libtool bison re2c pkg-config unzip \
libcurl4-openssl-dev \
liblmdb-dev \
libdb-dev \
libqdbm-dev \
libenchant-2-dev \
libexif-dev \
libgd-dev \
libpng-dev \
libtiff-dev \
libfreetype-dev \
libfreetype6 \
libfontconfig1-dev \
libgmp-dev \
libssl-dev \
libsodium-dev \
libxml2-dev \
libonig-dev \
libldap-dev \
libedit-dev \
libsnmp-dev \
libtidy-dev \
libxslt1-dev \
libsasl2-dev \
libpq-dev \
libsqlite3-dev \
libzip-dev
- name: "Set php-src download URL"
run: echo "php_src_download_url=https://www.php.net/distributions/php-${{ matrix.php-versions }}.tar.gz" >> $GITHUB_ENV
- name: "Set php-src download URL (8.5 pre-release)"
if: ${{ startsWith(matrix.php-versions, '8.5.') }}
run: echo "php_src_download_url=https://downloads.php.net/~edorian/php-${{ matrix.php-versions }}.tar.gz" >> $GITHUB_ENV
- name: "Install PHP ${{ matrix.php-versions }}"
run: |
mkdir -p /tmp/php
mkdir -p /tmp/php.ini.d
cd /tmp/php
echo "Downloading release from ${{ env.php_src_download_url }} ..."
wget -O php.tgz ${{ env.php_src_download_url }}
tar zxf php.tgz
rm php.tgz
ls -l
cd *
ls -l
./buildconf --force
./configure --disable-dom --disable-xml --disable-xmlreader --disable-xmlwriter --disable-json --with-openssl --with-config-file-scan-dir=/tmp/php.ini.d
make -j$(nproc)
sudo make install
cd $GITHUB_WORKSPACE
- uses: actions/checkout@v4
- name: Composer Install
run: composer install --ignore-platform-reqs
- name: Run bundled PHP install test
run: sudo php test/install-bundled-php-exts.php php-config
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

behaviour-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"require": {
"php": "8.1.*||8.2.*||8.3.*||8.4.*||8.5.*",
"composer/composer": "^2.8.9",
"composer/composer": "^2.8.10",
"composer/pcre": "^3.3.2",
"composer/semver": "^3.4.3",
"fidry/cpu-core-counter": "^1.2",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions src/Building/UnixBuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Php\Pie\Building;

use Php\Pie\ComposerIntegration\BundledPhpExtensionsRepository;
use Php\Pie\Downloading\DownloadedPackage;
use Php\Pie\File\BinaryFile;
use Php\Pie\Platform\TargetPhp\PhpizePath;
Expand All @@ -15,8 +16,11 @@
use function count;
use function file_exists;
use function implode;
use function rename;
use function sprintf;

use const DIRECTORY_SEPARATOR;

/** @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks */
final class UnixBuild implements Build
{
Expand Down Expand Up @@ -90,6 +94,25 @@ public function __invoke(
return BinaryFile::fromFileWithSha256Checksum($expectedSoFile);
}

private function renamesToConfigM4(DownloadedPackage $downloadedPackage, OutputInterface $output): void
{
$configM4 = $downloadedPackage->extractedSourcePath . DIRECTORY_SEPARATOR . 'config.m4';
if (file_exists($configM4)) {
return;
}

$output->writeln('config.m4 does not exist; checking alternatives', OutputInterface::VERBOSITY_VERY_VERBOSE);
foreach (['config0.m4', 'config9.m4'] as $alternateConfigM4) {
$fullPathToAlternate = $downloadedPackage->extractedSourcePath . DIRECTORY_SEPARATOR . $alternateConfigM4;
if (file_exists($fullPathToAlternate)) {
$output->writeln(sprintf('Renaming %s to config.m4', $alternateConfigM4), OutputInterface::VERBOSITY_VERY_VERBOSE);
rename($fullPathToAlternate, $configM4);

return;
}
}
}

/** @param callable(SymfonyProcess::ERR|SymfonyProcess::OUT, string): void|null $outputCallback */
private function phpize(
PhpizePath $phpize,
Expand All @@ -103,6 +126,8 @@ private function phpize(
$output->writeln('<comment>Running phpize step using: ' . implode(' ', $phpizeCommand) . '</comment>');
}

$this->renamesToConfigM4($downloadedPackage, $output);

Process::run(
$phpizeCommand,
$downloadedPackage->extractedSourcePath,
Expand Down Expand Up @@ -150,6 +175,11 @@ private function make(
$makeCommand[] = sprintf('-j%d', $targetPlatform->makeParallelJobs);
}

$makeCommand = BundledPhpExtensionsRepository::augmentMakeCommandForPhpBundledExtensions(
$makeCommand,
$downloadedPackage,
);

if ($output->isVerbose()) {
$output->writeln('<comment>Running make step with: ' . implode(' ', $makeCommand) . '</comment>');
}
Expand Down
6 changes: 6 additions & 0 deletions src/Command/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Php\Pie\ComposerIntegration\PieComposerFactory;
use Php\Pie\ComposerIntegration\PieComposerRequest;
use Php\Pie\ComposerIntegration\PieOperation;
use Php\Pie\DependencyResolver\BundledPhpExtensionRefusal;
use Php\Pie\DependencyResolver\DependencyResolver;
use Php\Pie\DependencyResolver\InvalidPackageName;
use Php\Pie\DependencyResolver\UnableToResolveRequirement;
Expand Down Expand Up @@ -88,6 +89,11 @@ public function execute(InputInterface $input, OutputInterface $output): int
$targetPlatform,
$this->container,
);
} catch (BundledPhpExtensionRefusal $bundledPhpExtensionRefusal) {
$output->writeln('');
$output->writeln('<comment>' . $bundledPhpExtensionRefusal->getMessage() . '</comment>');

return self::INVALID;
}

$output->writeln(sprintf('<info>Found package:</info> %s which provides <info>%s</info>', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
Expand Down
6 changes: 6 additions & 0 deletions src/Command/DownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Php\Pie\ComposerIntegration\PieComposerFactory;
use Php\Pie\ComposerIntegration\PieComposerRequest;
use Php\Pie\ComposerIntegration\PieOperation;
use Php\Pie\DependencyResolver\BundledPhpExtensionRefusal;
use Php\Pie\DependencyResolver\DependencyResolver;
use Php\Pie\DependencyResolver\InvalidPackageName;
use Php\Pie\DependencyResolver\UnableToResolveRequirement;
Expand Down Expand Up @@ -90,6 +91,11 @@ public function execute(InputInterface $input, OutputInterface $output): int
$targetPlatform,
$this->container,
);
} catch (BundledPhpExtensionRefusal $bundledPhpExtensionRefusal) {
$output->writeln('');
$output->writeln('<comment>' . $bundledPhpExtensionRefusal->getMessage() . '</comment>');

return self::INVALID;
}

$output->writeln(sprintf('<info>Found package:</info> %s which provides <info>%s</info>', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
Expand Down
6 changes: 6 additions & 0 deletions src/Command/InfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Php\Pie\ComposerIntegration\PieComposerFactory;
use Php\Pie\ComposerIntegration\PieComposerRequest;
use Php\Pie\ComposerIntegration\PieOperation;
use Php\Pie\DependencyResolver\BundledPhpExtensionRefusal;
use Php\Pie\DependencyResolver\DependencyResolver;
use Php\Pie\DependencyResolver\InvalidPackageName;
use Php\Pie\DependencyResolver\UnableToResolveRequirement;
Expand Down Expand Up @@ -87,6 +88,11 @@ public function execute(InputInterface $input, OutputInterface $output): int
$targetPlatform,
$this->container,
);
} catch (BundledPhpExtensionRefusal $bundledPhpExtensionRefusal) {
$output->writeln('');
$output->writeln('<comment>' . $bundledPhpExtensionRefusal->getMessage() . '</comment>');

return self::INVALID;
}

$output->writeln(sprintf('<info>Found package:</info> %s which provides <info>%s</info>', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
Expand Down
6 changes: 6 additions & 0 deletions src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Php\Pie\ComposerIntegration\PieComposerFactory;
use Php\Pie\ComposerIntegration\PieComposerRequest;
use Php\Pie\ComposerIntegration\PieOperation;
use Php\Pie\DependencyResolver\BundledPhpExtensionRefusal;
use Php\Pie\DependencyResolver\DependencyResolver;
use Php\Pie\DependencyResolver\InvalidPackageName;
use Php\Pie\DependencyResolver\UnableToResolveRequirement;
Expand Down Expand Up @@ -103,6 +104,11 @@ public function execute(InputInterface $input, OutputInterface $output): int
$targetPlatform,
$this->container,
);
} catch (BundledPhpExtensionRefusal $bundledPhpExtensionRefusal) {
$output->writeln('');
$output->writeln('<comment>' . $bundledPhpExtensionRefusal->getMessage() . '</comment>');

return self::INVALID;
}

$output->writeln(sprintf('<info>Found package:</info> %s which provides <info>%s</info>', $package->prettyNameAndVersion(), $package->extensionName()->nameWithExtPrefix()));
Expand Down
Loading