A tool for building and packaging PHP and shared extensions with static-php-cli.
- PHP 8.3 or higher
- Docker (unless you pass
--command="spc"
tobin/spp build
) - 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 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 --package
parameter:
php bin/spp package --package=pdo # Build only pdo package
To create a package repository from the built packages:
php bin/spp repo
To run all steps in one command:
php bin/spp all
The build defaults to using bin/spc-gnu-docker to build against glibc 2.17. If you want to use your system's compilation tools or build against musl, you can pass the --command
option:
php bin/spp build --command=spc # build on your local system
# or
php bin/spp build --command="spc-alpine-docker" # build against musl, not supported yet
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/