Skip to content

Commit f14f5e3

Browse files
authored
Merge pull request #1024 from jingjingxyk/build_native_php
Build native php
2 parents 72c2935 + 79639de commit f14f5e3

File tree

1 file changed

+39
-24
lines changed

1 file changed

+39
-24
lines changed

sapi/src/builder/extension/swoole.php

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,42 +98,57 @@
9898
$p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)');
9999

100100
$p->withExportVariable('SWOOLE_ODBC_LIBS', '$(pkg-config --libs-only-L --libs-only-l --static odbc odbccr odbcinst readline ncursesw ) ' . " -L{$libiconv_prefix}/lib -liconv ");
101-
102-
103101
/*
104-
$p->withBeforeConfigureScript('swoole', function () use ($p) {
105-
$workDir = $p->getWorkDir();
106-
$shell = "set -x ;cd {$workDir} ; WORKDIR={$workDir} ;" . PHP_EOL;
107-
$shell .= <<<'EOF'
108-
102+
$p->withBeforeConfigureScript('swoole', function () use ($p) {
103+
$workDir = $p->getWorkDir();
104+
$shell = "set -x ;cd {$workDir} ; WORKDIR={$workDir} ;" . PHP_EOL;
105+
$shell .= <<<'EOF'
109106
SWOOLE_VERSION=$(awk 'NR==1{ print $1 }' "sapi/SWOOLE-VERSION.conf")
110107
CURRENT_SWOOLE_VERSION=''
111108
112-
if [ -f "ext/swoole/CMakeLists.txt" ] ;then
113-
CURRENT_SWOOLE_VERSION=$(grep 'set(SWOOLE_VERSION' ext/swoole/CMakeLists.txt | awk '{ print $2 }' | sed 's/)//')
114-
if [[ "${CURRENT_SWOOLE_VERSION}" =~ "-dev" ]]; then
115-
echo 'swoole version master'
116-
if [ -n "${GITHUB_ACTION}" ]; then
117-
test -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz && rm -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz
118-
CURRENT_SWOOLE_VERSION=''
109+
if [ -f "ext/swoole/CMakeLists.txt" ] ;then
110+
CURRENT_SWOOLE_VERSION=$(grep 'set(SWOOLE_VERSION' ext/swoole/CMakeLists.txt | awk '{ print $2 }' | sed 's/)//')
111+
if [[ "${CURRENT_SWOOLE_VERSION}" =~ "-dev" ]]; then
112+
echo 'swoole version master'
113+
if [ -n "${GITHUB_ACTION}" ]; then
114+
test -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz && rm -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz
115+
CURRENT_SWOOLE_VERSION=''
116+
fi
119117
fi
120-
fi
121118
122-
if [ "${SWOOLE_VERSION}" != "${CURRENT_SWOOLE_VERSION}" ] ;then
123-
test -d ext/swoole && rm -rf ext/swoole
124-
if [ ! -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz ] ;then
125-
test -d /tmp/swoole && rm -rf /tmp/swoole
126-
git clone -b "${SWOOLE_VERSION}" https://github.com/swoole/swoole-src.git /tmp/swoole
127-
cd /tmp/swoole
128-
rm -rf /tmp/swoole/.git/
129-
tar -czvf ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz .
119+
if [ "${SWOOLE_VERSION}" != "${CURRENT_SWOOLE_VERSION}" ] ;then
120+
test -d ext/swoole && rm -rf ext/swoole
121+
if [ ! -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz ] ;then
122+
test -d /tmp/swoole && rm -rf /tmp/swoole
123+
git clone -b "${SWOOLE_VERSION}" https://github.com/swoole/swoole-src.git /tmp/swoole
124+
cd /tmp/swoole
125+
rm -rf /tmp/swoole/.git/
126+
tar -czvf ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz .
127+
fi
130128
fi
131129
# swoole extension hook
132130
cd {$workDir}
133131
sed -i '' 's/pthread_barrier_init/pthread_barrier_init_x_fake/' ext/swoole/config.m4
134-
EOF;
132+
133+
EOF;
135134
136135
return $shell;
137136
});
138137
*/
138+
$p->withBeforeConfigureScript('swoole', function () use ($p) {
139+
$workDir = $p->getWorkDir();
140+
$shell = "set -x ;cd {$workDir} ; WORKDIR={$workDir} ; IS_MACOS={$p->isMacos()}" . PHP_EOL;
141+
142+
$shell .= <<<'EOF'
143+
# swoole extension hook
144+
cd ${WORKDIR}
145+
if [ ${IS_MACOS} -eq 1 ];then
146+
sed -i '' 's/pthread_barrier_init/pthread_barrier_init_x_fake/' ext/swoole/config.m4
147+
fi
148+
149+
EOF;
150+
151+
return $shell;
152+
});
153+
139154
};

0 commit comments

Comments
 (0)