A tool for building and packaging PHP and shared extensions with static-php-cli.
- PHP 8.3 or higher
- ruby
- fpm (gem)
- rpmbuild (for creating RPM package repository)
- dpkg-deb (for creating DEB package repository)
-
Clone the repository:
git clone https://github.com/static-php/spc-packages.git cd spc-packages
-
Install dependencies:
composer install
The build process is configured using the config/craft.yml
file.
The main command-line tool is bin/spp
, which uses Symfony Console for command-line parsing and provides several commands:
To build PHP with the configured extensions:
php bin/spp build
This will:
- Copy the configuration to the static-php-cli vendor directory
- Run static-php-cli to build PHP with the specified extensions
- Copy the built files to the
build
directory
To create RPM and DEB packages for the built PHP binaries and extensions:
php bin/spp package
You can specify which package types to build (RPM, DEB, or both) using the --type
parameter:
php bin/spp package --type=rpm # Build only RPM packages
php bin/spp package --type=deb # Build only DEB packages
php bin/spp package --type=rpm,deb # Build both RPM and DEB packages (default)
This will:
- Create packages for each SAPI (cli, fpm, embed)
- Create packages for each extension
- Store the packages in the
dist/rpm
and/ordist/deb
directories, depending on the package types specified
Alternatively, you can specify which packages to build using the --packages
option:
php bin/spp package --packages=pdo # Build only pdo package
To run both build and package steps in one command:
php bin/spp all
You can specify the target architecture using the --target
option. This option takes a target triple that Zig understands, such as x86_64-linux-gnu
or aarch64-linux-gnu
:
php bin/spp build --target=x86_64-linux-gnu # build for x86_64 architecture
# or
php bin/spp build --target=aarch64-linux-gnu # build for aarch64 architecture
The build process produces:
- PHP binaries in
build/bin/
- PHP modules in
build/modules/
- PHP libraries in
build/lib/
- RPM packages in
dist/rpm/
- DEB packages in
dist/deb/