Standalone use (linux) - easysoft/phpmicro_builder GitHub Wiki

Build PHPmicro with builder for linux

Requirements

  • docker
  • php 8+
  • common utils like coreutils, linux-tools

Prepare source

1.Clone builder to any dir

git clone https://github.com/longyan/phpmicro-builder builder
cd builder

2.Fetch php and micro source

php should be in php-src dir, micro should be in php-src/sapi/micro

for example, using git

# at builder dir
git clone --single-branch -b php-8.0.3 https://github.com/php/php-src php-src
git clone --single-branch -b master https://github.com/longyan/phpmicro php-src/sapi/micro

3.Fetch other dependencies codes

for example, nghttp2

# at builder dir
# note: if some code provided in tarball, it should have a file structure like
#  ./some-1.1.1
#  ./some-1.1.1/configure
#  ./some-1.1.1/some.c
#  ...
wget https://github.com/nghttp2/nghttp2/releases/download/v1.43.0/nghttp2-1.43.0.tar.xz

4.(Optional) Make dockerignore

Add a dockerignore to make build faster

# at builder dir
cat >.dockerignore <<EOF
php-src/.git
php-src/sapi/micro/.git
some/.git
EOF

5.Start making

For make.sh usage, see (make.sh reference (linux)) page.

# at builder dir
linux/make.sh \
 +dep,nghttp2,srcfile=nghttp2-1.43.0.tar.xz\
 +ext,swoole,srcfile=v4.6.3.tar.gz\
 -ext,bz2\
 -def,USE_MIRROR=mirrors.ustc.edu.cn

The sfx will be generated at micro.sfx

6.(Optional) Test your micro

# at builder dir
docker run \
 -v `realpath linux/test.sh`:/work/test.sh \
 -v `realpath linux/rmtests.txt`:/work/iwillrmthesetestsonthismachine \
 -w /work/php \
 dixyes/microbuilder \
 /work/test.sh INACTION