Browse Source

update to 1.5.1 (add event support)

root 2 years ago
parent
commit
4b750825e9
7 changed files with 19 additions and 54 deletions
  1. 4 4
      README-en.md
  2. 4 4
      README.md
  3. 3 40
      docker/check-extensions.sh
  4. 3 3
      docker/config.json
  5. 3 2
      docker/download.sh
  6. 1 0
      docker/extensions.txt
  7. 1 1
      docker/fast-compiler.sh

+ 4 - 4
README-en.md

@@ -3,7 +3,7 @@ Compile A Statically Linked PHP With Swoole and other Extensions.
 
 BTW, It's only for CLI mode.
 
-[![version](https://img.shields.io/badge/version-1.5.0-green.svg)]()
+[![version](https://img.shields.io/badge/version-1.5.1-green.svg)]()
 ![Build Actions](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build-php.yml/badge.svg)
 
 ## Compilation Requirements
@@ -71,7 +71,7 @@ If you don't want to use docker, a single script for compiling:
 ```bash
 cd docker
 # Change PHP Version
-export VER_PHP="8.1.6"
+export VER_PHP="8.1.7"
 # Use Original download link (Default is China mainland mirror link, for others please use 'yes' for original link)
 export USE_BACKUP="yes"
 ./fast-compiler.sh
@@ -89,7 +89,7 @@ To customize PHP extensions, edit `docker/extensions.txt` file, and rules below:
 | yes     | ctype        | *       |                                          |
 | yes     | curl         | *       |                                          |
 | yes     | dom          | *       |                                          |
-|         | event        |         |                                          |
+| yes     | event        | >=3.0.8 | author's bitbucket version, not pecl     |
 | yes     | exif         | *       |                                          |
 | yes     | filter       | *       |                                          |
 | yes     | fileinfo     | *       |                                          |
@@ -134,7 +134,7 @@ To customize PHP extensions, edit `docker/extensions.txt` file, and rules below:
 - `docker/config.json` edit extensions and dependencies version and download links.
 
 ## Current Issue
-- [ ] Not support event(libevent), because of its `config.m4` and code.
+- [X] Not support event(libevent), because of its `config.m4` and code.
 - [ ] Swoole not support `--enable-swoole-curl`.
 - [ ] Not support readline, maybe caused by ncurses library.
 - [X] Not support curl (solved)

+ 4 - 4
README.md

@@ -7,7 +7,7 @@ Compile A Statically Linked PHP With Swoole and other Extensions. [English READM
 
 注:只能编译 CLI 模式,暂不支持 CGI 和 FPM 模式
 
-[![版本](https://img.shields.io/badge/script--version-1.5.0-green.svg)]()
+[![版本](https://img.shields.io/badge/script--version-1.5.1-green.svg)]()
 [![License](https://img.shields.io/badge/License-MIT-blue.svg)]()
 ![Build Actions](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build-php.yml/badge.svg)
 
@@ -78,7 +78,7 @@ file ./php
 ```bash
 cd docker
 # 用于切换编译的PHP版本
-export VER_PHP="8.1.6"
+export VER_PHP="8.1.7"
 ./fast-compiler.sh
 ```
 
@@ -94,7 +94,7 @@ export VER_PHP="8.1.6"
 | yes, enabled      | ctype        | *        |                                                         |
 | yes, enabled      | curl         | *        | 自带下载编译 curl 库                                    |
 | yes, enabled      | dom          | *        |                                                         |
-|          | event        |          |                                                         |
+| yes, enabled      | event        | >=3.0.8  | 从 BitBucket 作者仓库下载,非 pecl 版本                     |
 | yes, enabled      | exif         | *        |                                                         |
 | yes, enabled      | filter       | *        |                                                         |
 | yes, enabled      | fileinfo     | *        |                                                         |
@@ -141,7 +141,7 @@ export VER_PHP="8.1.6"
 - `docker/multi-version-compiler.sh` 可以同时编译多个版本的 PHP。
 
 ## 目前的问题(对勾为已解决)
-- [ ] 不支持 event(libevent) 扩展,event 扩展的 sockets 支持不能在静态编译中使用,因为静态内嵌编译暂时没办法调整扩展编译顺序,同时其本身也不支持静态编译。
+- [X] 不支持 event(libevent) 扩展,event 扩展的 sockets 支持不能在静态编译中使用,因为静态内嵌编译暂时没办法调整扩展编译顺序,同时其本身也不支持静态编译。
 - [ ] Swoole 扩展不支持 `--enable-swoole-curl`,也是因为编译顺序和加载顺序的问题。
 - [ ] 不支持 readline 扩展,readline 扩展安装后无法正常使用 `php -a`,原因还没有弄清楚,可能是静态编译造成的 ncurses 库出现了问题。
 - [X] curl/libcurl 扩展静态编译

+ 3 - 40
docker/check-extensions.sh

@@ -52,7 +52,7 @@ function do_curl_compiler() {
 }
 
 function do_copy_extension() {
-    ext_dir=$(find $self_dir/source -name "$1-*" -type d | tail -n1)
+    ext_dir=$(find $self_dir/source -name "*$1-*" -type d | tail -n1)
     mv $ext_dir $php_dir/ext/$1
     if [ $? != 0 ]; then
         echo "Compile error! ext: $1, ext_dir=$ext_dir"
@@ -127,44 +127,7 @@ function check_before_configure() {
         redis) do_copy_extension redis ;;
         swoole) do_copy_extension swoole ;;
         mongodb) do_copy_extension mongodb ;;
-        event)
-            PHP_EVENT='                     PHP_EVENT_PHP_VERSION=$PHP_VERSION                           '
-            PHP_EVENT="$PHP_EVENT"'\n    PHP_EVENT_PHP_VERSION_ID=$PHP_VERSION_ID                     '
-            PHP_EVENT="$PHP_EVENT"'\n    if test -z "$PHP_EVENT_PHP_VERSION"; then                    '
-            PHP_EVENT="$PHP_EVENT"'\n      AC_MSG_ERROR(\[unknown source with no php version\])         '
-            PHP_EVENT="$PHP_EVENT"'\n      PHP_EVENT_SUBDIR="."                                       '
-            PHP_EVENT="$PHP_EVENT"'\n    fi                                                           '
-            PHP_EVENT="$PHP_EVENT"'\n    if test "$PHP_EVENT_PHP_VERSION_ID" -ge "80000"; then        '
-            PHP_EVENT="$PHP_EVENT"'\n      PHP_EVENT_SUBDIR=php8                                      '
-            PHP_EVENT="$PHP_EVENT"'\n      AC_MSG_RESULT(\[PHP 8.x\])                                   '
-            PHP_EVENT="$PHP_EVENT"'\n    elif test "$PHP_EVENT_PHP_VERSION_ID" -ge "70000"; then      '
-            PHP_EVENT="$PHP_EVENT"'\n      PHP_EVENT_SUBDIR=php7                                      '
-            PHP_EVENT="$PHP_EVENT"'\n      AC_MSG_RESULT(\[PHP 7.x\])                                   '
-            PHP_EVENT="$PHP_EVENT"'\n    elif test "$PHP_EVENT_PHP_VERSION_ID" -ge "50000"; then      '
-            PHP_EVENT="$PHP_EVENT"'\n      PHP_EVENT_SUBDIR=php5                                      '
-            PHP_EVENT="$PHP_EVENT"'\n      AC_MSG_RESULT(\[PHP 5.x\])                                   '
-            PHP_EVENT="$PHP_EVENT"'\n    else                                                         '
-            PHP_EVENT="$PHP_EVENT"'\n      AC_MSG_ERROR(\[unknown source lol\])                         '
-            PHP_EVENT="$PHP_EVENT"'\n      PHP_EVENT_SUBDIR="."                                       '
-            PHP_EVENT="$PHP_EVENT"'\n    fi                                                           '
-            PHP_EVENT="$PHP_EVENT"'\n    echo PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR                                                           '
-            PHP_EVENT="$PHP_EVENT"'\n    echo PHP_EXT_BUILDDIR(event)\/$PHP_EVENT_SUBDIR                                                           '
-            PHP_EVENT="$PHP_EVENT"'\n    if test "$PHP_EVENT_SUBDIR" -ne "."; then                    '
-            PHP_EVENT="$PHP_EVENT"'\n    PHP_ADD_BUILD_DIR(PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR, 1)       '
-            PHP_EVENT="$PHP_EVENT"'\n    PHP_ADD_BUILD_DIR(PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR\/classes, 1)       '
-            PHP_EVENT="$PHP_EVENT"'\n    PHP_ADD_BUILD_DIR(PHP_EXT_SRCDIR(event)\/$PHP_EVENT_SUBDIR\/src, 1)       '
-            PHP_EVENT="$PHP_EVENT"'\n    PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(event)\/\[$PHP_EVENT_SUBDIR\])            '
-            PHP_EVENT="$PHP_EVENT"'\n    PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(event)\/\[$PHP_EVENT_SUBDIR\/classes\])            '
-            PHP_EVENT="$PHP_EVENT"'\n    PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(event)\/\[$PHP_EVENT_SUBDIR\/src\])            '
-            PHP_EVENT="$PHP_EVENT"'\n    fi                                                           '
-
-            do_copy_extension event && \
-                sed -ie 's/PHP_EVENT_SUBDIR="."//g' $php_dir/ext/event/config.m4 && \
-                sed -ie 's/AC_MSG_ERROR(\[unknown source\])/'"$PHP_EVENT"'/g' $php_dir/ext/event/config.m4
-            if [ $? != 0 ]; then
-                exit 1
-            fi
-            ;;
+        event) do_copy_extension event ;;
         esac
     done
 }
@@ -181,7 +144,7 @@ function check_in_configure() {
         curl)               php_configure="$php_configure --with-curl" ;;
         dom)                php_configure="$php_configure --enable-dom" ;;
         exif)               php_configure="$php_configure --enable-exif" ;;
-        event)              php_configure="$php_configure --with-event-core --with-event-extra --with-event-openssl --with-event-extra --disable-event-sockets" ;;
+        event)              php_configure="$php_configure --with-event-core --with-event-extra --with-event-openssl" ;;
         filter)             php_configure="$php_configure --enable-filter" ;;
         fileinfo)           php_configure="$php_configure --enable-fileinfo" ;;
         gd)

+ 3 - 3
docker/config.json

@@ -19,9 +19,9 @@
         "link_2": "https://pecl.php.net/get/inotify-{version}.tgz"
     },
     "event": {
-        "version": "3.0.4",
-        "link": "http://mirrors.zhamao.xin/pecl/event-{version}.tgz",
-        "link_2": "https://pecl.php.net/get/event-{version}.tgz"
+        "version": "3.0.8",
+        "link": "https://mirrors.zhamao.xin/library/php-event/event-{version}.tar.gz",
+        "link_2": "https://bitbucket.org/osmanov/pecl-event/get/{version}.tar.gz"
     },
     "redis": {
         "version": "5.3.7",

+ 3 - 2
docker/download.sh

@@ -42,13 +42,14 @@ else
     fi
 
     if [ $? == 0 ]; then
-        archive_file_tar=$(find . -name "$1*.*" | grep -E ".tar|.gz|.tgz" | tail -n1)
-        archive_file_zip=$(find . -name "*.zip" | tail -n1)
+        archive_file_tar=$(find . -name "*.*" -maxdepth 1 | grep -E ".tar|.gz|.tgz" | tail -n1)
+        archive_file_zip=$(find . -name "*.zip" -maxdepth 1 | tail -n1)
         if [ "$archive_file_tar" != "" ]; then
             tar -zxf $archive_file_tar && mv $archive_file_tar $SELF_DIR/source/cache/$1.tgz
         elif [ "$archive_file_zip" != "" ]; then
             unzip $archive_file_zip && mv $archive_file_zip $SELF_DIR/source/cache/$1.zip > /dev/null
         else
+            find . -name "*$1*.*"
             echo "Unable to find downloaded file, only support '.tar.gz', '.tgz', '.zip' file!"
             exit 1
         fi

+ 1 - 0
docker/extensions.txt

@@ -3,6 +3,7 @@ calendar
 ctype
 curl
 dom
+event
 exif
 fileinfo
 filter

+ 1 - 1
docker/fast-compiler.sh

@@ -2,7 +2,7 @@
 
 # This script needs alpine linux system.
 
-test "$VER_PHP" = "" && VER_PHP="8.1.6"
+test "$VER_PHP" = "" && VER_PHP="8.1.7"
 test "$USE_BACKUP" = "" && USE_BACKUP="no"
 
 LINK_APK_REPO='mirrors.ustc.edu.cn'