Skip to content

Commit

Permalink
Merge pull request #705 from jingjingxyk/build_native_php
Browse files Browse the repository at this point in the history
Build native php
  • Loading branch information
jingjingxyk committed Jul 21, 2024
2 parents 0d6bf2e + a476082 commit 4d0c5f1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 166 deletions.
164 changes: 0 additions & 164 deletions build-musl-enviroment-example.sh

This file was deleted.

4 changes: 2 additions & 2 deletions build-release-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ if [ ${WITH_PHP_COMPOSER} -eq 1 ]; then
# composer install --no-interaction --optimize-autoloader

# composer update --optimize-autoloader
composer install --no-interaction --no-autoloader --no-scripts --profile # --no-dev

# composer install --no-interaction --no-autoloader --no-scripts --profile # --no-dev
composer install --no-interaction --no-autoloader --no-scripts --prefer-dist -vv --profile # --no-dev
composer dump-autoload --optimize --profile

composer config -g --unset repos.packagist
Expand Down
16 changes: 16 additions & 0 deletions sapi/src/builder/extension/ffi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

use SwooleCli\Preprocessor;
use SwooleCli\Extension;

return function (Preprocessor $p) {
$php_version = BUILD_PHP_VERSION;
$libffi_prefix = LIBFFI_PREFIX;
$p->addExtension(
(new Extension('ffi'))
->withHomePage('https://www.php.net/pgsql')
->withLicense('https://github.com/php/php-src/blob/master/LICENSE', Extension::LICENSE_PHP)
->withOptions('--with-ffi=' . $libffi_prefix)
->withDependentLibraries('libffi')
);
};
32 changes: 32 additions & 0 deletions sapi/src/builder/library/libffi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use SwooleCli\Library;
use SwooleCli\Preprocessor;

return function (Preprocessor $p) {
$libffi_prefix = LIBFFI_PREFIX;

$lib = new Library('libffi');
$lib->withHomePage('http://sourceware.org/libffi')
->withLicense('https://github.com/libffi/libffi/blob/master/LICENSE', Library::LICENSE_SPEC)
->withManual('https://github.com/libffi/libffi.git')
->withUrl('https://github.com/libffi/libffi/archive/refs/tags/v3.4.6.tar.gz')
->withFile('libffi-v3.4.6.tar.gz')
->withPrefix($libffi_prefix)
->withConfigure(
<<<EOF
sh autogen.sh
./configure --help
./configure \
--prefix={$libffi_prefix} \
--enable-shared=no \
--enable-static=yes
EOF
)
->withPkgName('libffi');

$p->addLibrary($lib);
};
6 changes: 6 additions & 0 deletions sapi/src/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@
define("MPDECIMAL_PREFIX", $p->getGlobalPrefix() . '/mpdecimal');
define("LIBB2_PREFIX", $p->getGlobalPrefix() . '/libb2');


define("GRPC_PREFIX", $p->getGlobalPrefix() . '/grpc');
define("RE2_PREFIX", $p->getGlobalPrefix() . '/re2');
define("LIBFFI_PREFIX", $p->getGlobalPrefix() . '/libffi');


define("EXAMPLE_PREFIX", $p->getGlobalPrefix() . '/example');




0 comments on commit 4d0c5f1

Please sign in to comment.