Skip to content

Commit 3a4d6c4

Browse files
committed
Add rdkafka support and update to PHP 8.3.3
1 parent d57231a commit 3a4d6c4

9 files changed

Lines changed: 64 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
env:
99
APP_NAME: 'manticore-executor'
1010
DOCKER_TAG: 'manticoresearch/manticore-executor'
11-
PHP_VERSION: '8.2.12'
11+
PHP_VERSION: '8.3.3'
1212
MAINTAINER: 'Manticore'
1313
DESC: 'Custom built PHP executor for Manticore.'
1414
EXTRA_NAME: 'manticore-extra'
@@ -111,7 +111,7 @@ jobs:
111111
run: |
112112
echo "app_version=$(echo ${{ github.ref_name }} | cut -dv -f2)" >> $GITHUB_OUTPUT
113113
- name: Build manticore-executor-dev
114-
run: ./build-linux 8.2.12 0 1
114+
run: ./build-linux 8.3.3 0 1
115115
shell: bash
116116
- name: Create artifact
117117
run: |

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
APP_NAME: 'manticore-executor'
10-
PHP_VERSION: '8.2.12'
10+
PHP_VERSION: '8.3.3'
1111
MAINTAINER: 'Manticore'
1212
DESC: 'Custom built PHP executor for Manticore.'
1313

Dockerfile-dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN apt-get update -y && \
66
COPY ./build-linux ./build-linux
77
COPY ./build-bash-base.sh ./build-bash-base.sh
88
COPY ./helper.sh ./helper.sh
9-
RUN ./build-linux 8.2.12 0 0 && \
9+
RUN ./build-linux 8.2.16 0 0 && \
1010
cp build/dist/bin/php /usr/bin/manticore-executor && \
1111
rm -fr build
1212

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Manticore Executor is a custom built PHP binary which:
2828

2929
By default, we disable all extensions and enable only those required to run our scripts.
3030

31-
We build executor from `PHP 8.2.12` with the following extensions enabled and compiled into the executable statically:
31+
We build executor from `PHP 8.3.3` with the following extensions enabled and compiled into the executable statically:
3232

3333
* pcntl
3434
* posix
@@ -83,20 +83,20 @@ Several scripts used to build the final package:
8383
* `build-linux`
8484
* `build-osx`
8585

86-
The scripts accept a version of PHP as a parameter. The current version is `8.2.12`. To build the binary, you should run the following example:
86+
The scripts accept a version of PHP as a parameter. The current version is `8.3.3`. To build the binary, you should run the following example:
8787

8888
```bash
89-
./build-linux "8.2.12"
89+
./build-linux "8.3.3"
9090
```
9191

92-
The command above will build the package on Linux with **PHP** `8.2.12`. Once it's done, you can find your binary in folder `dist/bin`.
92+
The command above will build the package on Linux with **PHP** `8.3.3`. Once it's done, you can find your binary in folder `dist/bin`.
9393

9494
### Build for MacOS arm64
9595

9696
Build and collect assets, after we can put the assets to the repo.
9797

9898
```bash
99-
./build-osx "8.2.12"
99+
./build-osx "8.3.3"
100100
git checkout 0.7.6
101101
git tag v0.7.6
102102
APP_ARCH=$(arch) APP_NAME=manticore-executor APP_VERSION=$(git describe --tags | cut -dv -f2) GITHUB_SHA=$(git rev-parse HEAD) RUNNER_OS=macos ./collect-assets

build-alpine

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ install_deps() {
2727
install_curl
2828

2929
install_libzip
30+
31+
install_zlib
32+
33+
install_rdkafka
3034
}
3135

3236
install_dev_deps() {
@@ -54,6 +58,7 @@ ENABLE_STATIC=yes
5458
--enable-sockets \
5559
--enable-ds \
5660
--enable-swoole \
61+
--with-rdkafka \
5762
--with-openssl --with-zlib --with-zip \
5863
--enable-filter \
5964
--with-curl \

build-bash-base.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PHP_VERSION="$1"
1111
ZSTD_REV="2dfcd6524ccdcef6dfdaa97d7f3716b866885093"
1212
DS_REV="d42750d69beb684ec3ef7b3da48fba769ce57ffc"
1313
SWOOLE_REV="b72d22ad65dbcc0a5cf75b4d6a483b73c9f32157"
14+
RDKAFKA_REV="bcd5004f461d1d3a5f879bb21280bdde6f6800c2"
1415
SKIP_SYSTEM_DEPS="$2"
1516
BUILD_DEV="$3"
1617
BUILD_STATIC=1 # Always build static but dev
@@ -53,6 +54,12 @@ git clone https://github.com/swoole/swoole-src.git swoole
5354
cd swoole && git checkout "$SWOOLE_REV"
5455
cd ..
5556

57+
# rdkafka
58+
git clone https://github.com/arnaud-lb/php-rdkafka.git
59+
mv php-rdkafka rdkafka
60+
cd rdkafka && git checkout "$RDKAFKA_REV"
61+
cd ..
62+
5663
cd ..
5764

5865
BUILD_EXTRA=()

build-linux

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set -xe
1717

1818
install_deps() {
1919
sudo apt-get update -y
20-
sudo apt-get install -y curl build-essential autoconf automake bison re2c libzstd-dev pkg-config git libssl-dev zlib1g-dev libzip-dev libonig-dev cmake libcurl4-openssl-dev libzip-dev
20+
sudo apt-get install -y curl build-essential autoconf automake bison re2c libzstd-dev pkg-config git libssl-dev zlib1g-dev libzip-dev libonig-dev cmake libcurl4-openssl-dev libzip-dev librdkafka-dev
2121
}
2222

2323
install_dev_deps() {
@@ -44,6 +44,7 @@ ENABLE_STATIC=yes
4444
--enable-sockets \
4545
--enable-ds \
4646
--enable-swoole \
47+
--with-rdkafka \
4748
--with-openssl --with-zlib --with-zip \
4849
--enable-filter \
4950
--with-curl \

build-osx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88

99
set -e
1010
install_deps() {
11-
brew install bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip
11+
brew install bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka
1212

1313
OPENSSL_PREFIX="$(brew --prefix openssl)"
14+
LIBRDKAFKA_PREFIX="$(brew --prefix librdkafka)"
1415
OPENSSL_CFLAGS="-I${OPENSSL_PREFIX}/include"
1516
OPENSSL_LIBS="-L${OPENSSL_PREFIX}/lib -lcrypto -lssl"
1617
export OPENSSL_PREFIX OPENSSL_CFLAGS OPENSSL_LIBS
1718
export PATH="${OPENSSL_PREFIX}/bin:${PATH}"
18-
export LDFLAGS="-L${OPENSSL_PREFIX}@1.1/lib"
19-
export CPPFLAGS="-I${OPENSSL_PREFIX}/include"
19+
export LDFLAGS="-L${OPENSSL_PREFIX}/lib -L${LIBRDKAFKA_PREFIX}/lib"
20+
export CPPFLAGS="-I${OPENSSL_PREFIX}/include -I${LIBRDKAFKA_PREFIX}/include"
21+
2022
export PKG_CONFIG_PATH="${OPENSSL_PREFIX}/lib/pkgconfig"
2123
}
2224

@@ -74,14 +76,22 @@ if [[ "$bison_ver" =~ ^2\.[0-9]+$ ]]; then
7476
export YACC="$bison/bin/bison"
7577
fi
7678

79+
# Fix the path for the librdkafka
80+
kafka_prefix=$(brew --prefix librdkafka)
81+
sed "s|SEARCH_PATH=\"/usr/local /usr\"|SEARCH_PATH=\"${kafka_prefix}\"|" configure > configure-new
82+
mv configure-new configure
83+
chmod +x configure
84+
7785
./configure \
78-
CFLAGS="-O3" --prefix="$BUILD_PREFIX" --disable-all \
86+
CFLAGS="-O3 -lresolv -Wno-implicit-function-declaration" \
87+
--prefix="$BUILD_PREFIX" --disable-all \
7988
--enable-shared=$ENABLE_SHARED --enable-static=$ENABLE_STATIC --with-layout=GNU \
8089
--with-pear=no --disable-cgi --disable-phpdbg \
8190
--with-pcre-jit --enable-zstd --with-libzstd \
8291
--enable-pcntl --enable-posix \
8392
--enable-sockets \
8493
--enable-swoole \
94+
--with-rdkafka \
8595
--with-openssl --with-zlib --with-zip \
8696
--enable-filter \
8797
--with-curl \

helper.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,44 @@ install_curl() {
99
make -j8
1010
make install
1111
cd ..
12+
rm -fr curl-8.0.0
1213
}
1314

1415
install_libzip() {
1516
test -d libzip-1.9.2 && rm -fr "$_"
1617
curl -sSL https://github.com/nih-at/libzip/releases/download/v1.9.2/libzip-1.9.2.tar.gz | tar -xzf -
1718
cd libzip-1.9.2 && mkdir -p build && cd build
18-
cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_LZMA=OFF -DENABLE_BZIP2=OFF ..
19+
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_LZMA=OFF -DENABLE_BZIP2=OFF ..
1920
make -j4 && make install
2021
cd ../..
2122
rm -fr libzip-1.9.2
2223
}
2324

25+
install_zlib() {
26+
test -d zlib-1.3.1 && rm -fr "$_"
27+
curl -sSL https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz | tar -xzf -
28+
cd zlib-1.3.1
29+
export CFLAGS="-O3 -fPIC"
30+
./configure --prefix=/usr --static
31+
make -j4 && make install
32+
cd ..
33+
rm -fr zlib-1.3.1
34+
}
35+
36+
install_rdkafka() {
37+
test -d librdkafka-2.3.0 && rm -fr "$_"
38+
curl -sSL https://github.com/confluentinc/librdkafka/archive/refs/tags/v2.3.0.tar.gz | tar -xzf -
39+
cd librdkafka-2.3.0
40+
./configure --prefix=/usr --enable-static --disable-shared \
41+
--disable-debug-symbols --enable-strip \
42+
--disable-sasl --enable-lz4 --enable-zstd \
43+
--enable-zlib --enable-curl \
44+
--disable-regex-ext
45+
make -j4 && make install
46+
cd ..
47+
rm -fr librdkafka-2.3.0
48+
}
49+
2450
install_libxml2() {
2551
test -d libxml2-2.10.3 && rm -fr libxml2-2.10.3
2652
curl -sSL https://github.com/GNOME/libxml2/archive/refs/tags/v2.10.3.tar.gz | tar -xzf -

0 commit comments

Comments
 (0)