Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add extension from source

Shivam Mathur edited this pageMar 2, 2023 ·8 revisions

This guide is written for developers with basic knowledge of compiling packages, if you have any questions please feel free to askhere.

Add extension from GitHub

OnUbuntu andmacOS extensions can be compiled and installed from a git repository by suffixing the extension's name withrepository@version.

For example to compile and installmongodb from its GitHub repositorymongodb/mongo-php-driver and tag1.15.0:

-name:Setup PHP with mongodb from sourceuses:shivammathur/setup-php@v2with:php-version:'8.2'extensions:mongodb-mongodb/mongo-php-driver@1.15.0

The version can be a branch name or tag as supported bygit clone -b <name>. The clone is performed recursively, i.e. submodules if any, will be cloned as well.

The input format is<extension-name>-<repository>@<branch/tag>.

Add extension from other git providers

By default, the extension repository is cloned from GitHub. If the extension is hosted on any other git provider. You need to specify the complete repository URL.

For example to compile and installcsv extension from its repository hosted on GitLab:

-name:Setup PHP with csv from sourceuses:shivammathur/setup-php@v2with:php-version:'7.4'extensions:csv-https://gitlab.com/Girgias/csv-php-extension@0.3.1

Add extension from a sub-directory

If the extension is not in the root directory of the repository, you can specify the sub-directory using the environment variable<EXTENSION>_PATH. For example forprotobuf, the environment variable will bePROTOBUF_PATH.

-name:Setup PHP with protobuf from sourceuses:shivammathur/setup-php@v2with:php-version:'7.4'extensions:protobuf-protocolbuffers/protobuf@v3.15.2env:PROTOBUF_PATH:php/ext/google/protobuf

Add extension with different configurations

Extensions can require various configuration options. While compiling an extension the call to the configure script can look like this

PREFIX_OPTS ./configure SUFFIX_OPTS

ThePREFIX_OPTS can be Makefile variables likeCFLAGS,SUFFIX_OPTS can bem4 inputs like--enable-extension.

Sosetup-php supports the following environment variables.

  • <EXTENSION>_CONFIGURE_PREFIX_OPTS
  • <EXTENSION>_CONFIGURE_SUFFIX_OPTS or<EXTENSION>_CONFIGURE_OPTS (alias)

For example to compilehttp extension from source:

-name:Setup PHP with http from sourceuses:shivammathur/setup-php@v2with:php-version:'8.0'extensions:raphf, http-m6w6/ext-http@v4.0.0env:HTTP_CONFIGURE_PREFIX_OPTS:"CFLAGS=-Wno-implicit-function-declaration"HTTP_CONFIGURE_OPTS:"--with-http"

Add required libraries for the extension

Some extensions require external libraries. To setup libraries along with compiling the extension the following environment variables are supported.

  • <EXTENSION>_LIBS
  • <EXTENSION>_LINUX_LIBS
  • <EXTENSION>_DARWIN_LIBS.

If you are using a single operating system in a workflow, then you can use<EXTENSION>_LIBS. In a multi OS workflow, you can use<EXTENSION>_LINUX_LIBS for Ubuntu workflows and<EXTENSION>_DARWIN_LIBS for macOS workflows.

Libraries on Ubuntu are installed usingapt. On MacOS libraries are installed using Homebrew.

For example to compile and installredis extension withlz4 support in a cross-platform workflow:

-name:Get liblz4 directoryid:lz4run:|    if [ "$(uname -s)" = "Linux" ]; then      echo "lz4_dir=/usr" >> "$GITHUB_OUTPUT"    else      echo "lz4_dir=$(brew --prefix)/opt/lz4" >> "$GITHUB_OUTPUT"    fi-name:Setup PHP with redis from source with lz4 supportuses:shivammathur/setup-php@v2with:php-version:'8.0'extensions:redis-phpredis/phpredis@5.3.7env:REDIS_CONFIGURE_OPTS:--enable-redis  --enable-redis-lz4 --with-liblz4=${{ steps.lz4.outputs.lz4_dir }}REDIS_LINUX_LIBS:liblz4-devREDIS_DARWIN_LIBS:lz4

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp