Skip to content

Latest commit

 

History

History
executable file
·
128 lines (94 loc) · 3.73 KB

Cygwin.md

File metadata and controls

executable file
·
128 lines (94 loc) · 3.73 KB

cygwin 环境下构建 swoole-cli

准备 cygwin 软件包

打开 https://cygwin.com/

下载 cygwin : https://cygwin.com/setup-x86_64.exe

cygwin 搜索软件包 https://cygwin.com/cgi-bin2/package-grep.cgi?grep=openssl

cygwin 换源地址 参考 https://mirrors.cernet.edu.cn/list/cygwin

命令行同时安装多个包,包名之间使用逗号隔开

安装cygwin 和 cygwin 依赖项

打开 windows 控制台,并找到 setup-x86_64.exe 所在目录, 执行如下命令

# 安装 cygwin
setup-x86_64.exe     --site  https://mirrors.ustc.edu.cn/cygwin/

# 安装 cygwin 依赖项
setup-x86_64.exe  --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus    --site  https://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel

setup-x86_64.exe  --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus    --site  https://mirrors.ustc.edu.cn/cygwin/ --packages zip unzip icu libicu-devel

setup-x86_64.exe  --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus    --site  https://mirrors.ustc.edu.cn/cygwin/ --packages libpq5 libpq-devel


# 打开 cygwin64 Terminal

构建步骤

首先需要安装上述工具和库,然后 Clone 项目,并切换 ext/swoole 到对应的分支,如 4.8.xmaster (5.0.x)

# 打开 cygwin64 Terminal

git clone --recursive https://github.com/swoole/swoole-cli.git

cd swoole-cli

# git submodule update --init

bash ./sapi/scripts/cygwin/install-re2c.sh

bash ./sapi/scripts/cygwin/cygwin-config-ext.sh
bash ./sapi/scripts/cygwin/cygwin-config.sh
bash ./sapi/scripts/cygwin/cygwin-build.sh
bash ./sapi/scripts/cygwin/cygwin-archive.sh

构建步骤说明

  • 准备re2c: bash ./sapi/scripts/cygwin/install-re2c.sh
  • 准备扩展: bash ./sapi/scripts/cygwin/cygwin-config-ext.sh
  • 预处理: bash ./sapi/scripts/cygwin/cygwin-config.sh
  • 构建: bash ./sapi/scripts/cygwin/cygwin-build.sh
  • 打包: bash ./sapi/scripts/cygwin/cygwin-archive.sh

打包完成后会在当前目录下生成 swoole-cli-{version}-cygwin-x64.zip 压缩包。

备注

  1. Cygwin 下不支持 mongodb 扩展,参考:mongodb/mongo-php-driver#1381

  2. 编译pgsql扩展,在./sapi/scripts/cygwin/cygwin-build.sh脚本 ./configure 后面增加一行: --with-pgsql --with-pdo-pgsql --enable-swoole-pgsql \ ,并将相同版本(如8.1.12)php-src中ext目录下的pgsql pdo_pgsql 两个文件夹拷贝到当前项目的ext目录下,再执行构建脚本

工具列表

  • make
  • autoconf
  • automake
  • libtool
  • bison
  • wget
  • tar
  • gcc-g++
  • openssl
  • re2c (需要源码安装)
  • zip/unzip(用于压缩打包)

libssl-devel
libcurl-devel
libxml2-devel
libxslt-devel
libgmp-devel
ImageMagick
libpng-devel
libjpeg-devel
libfreetype-devel
libwebp-devel
libsqlite3-devel
zlib-devel
libbz2-devel
libzip-devel
libicu-devel
libonig-devel
libcares-devel
libsodium-devel
libyaml-devel
libMagick-devel
libzstd-devel
libbrotli-devel
libreadline-devel
libintl-devel
libpq-devel (如果编译pgsql扩展)
libpq5 (如果编译pgsql扩展)
libicu-devel
icu