|
| 1 | +# For building linux-x64 |
| 2 | +FROM debian:bookworm |
| 3 | + |
| 4 | +ENV DEBIAN_FRONTEND=noninteractive |
| 5 | +RUN apt-get update && apt-get install -y \ |
| 6 | + build-essential autoconf bison re2c wget tar git patchelf libtommath1 |
| 7 | + |
| 8 | +# Download php |
| 9 | +ARG php_vers="7.4.13 8.0.30 8.1.33 8.2.29 8.3.26 8.4.13 8.5.0RC2" |
| 10 | +RUN --mount=type=cache,target=/usr/src \ |
| 11 | + cd /usr/src && \ |
| 12 | + set -e && \ |
| 13 | + for php in $php_vers; do \ |
| 14 | + if [ ! -d php-$php ]; then \ |
| 15 | + git clone --depth 1 --branch php-$php https://github.com/php/php-src.git php-$php; \ |
| 16 | + fi \ |
| 17 | + done |
| 18 | + |
| 19 | +# Build php |
| 20 | +RUN --mount=type=cache,target=/usr/src \ |
| 21 | + for php in $php_vers; do \ |
| 22 | + php_short=${php%.*} && \ |
| 23 | + cd /usr/src/php-$php && \ |
| 24 | + ./buildconf --force && \ |
| 25 | + ./configure \ |
| 26 | + --prefix=/opt/php-$php_short \ |
| 27 | + --disable-all --disable-cgi --enable-cli --build=x86_64-linux-gnu --host=x86_64-linux-gnu && \ |
| 28 | + make -j$(nproc) && make install; \ |
| 29 | + done |
| 30 | + |
| 31 | +# Download Firebird-5.0.3 |
| 32 | +ARG firebird=Firebird-5.0.3.1683-0-linux-x64 |
| 33 | +RUN --mount=type=cache,target=/usr/src \ |
| 34 | + cd /usr/src && \ |
| 35 | + if [ ! -d $firebird ]; then \ |
| 36 | + wget https://github.com/FirebirdSQL/firebird/releases/download/v5.0.3/$firebird.tar.gz; \ |
| 37 | + fi && \ |
| 38 | + tar xf $firebird.tar.gz && \ |
| 39 | + mkdir -p /opt/$firebird && \ |
| 40 | + tar xf $firebird/buildroot.tar.gz -C /opt/$firebird |
| 41 | + |
| 42 | +# Clone php-firebird |
| 43 | +RUN --mount=type=cache,target=/usr/src \ |
| 44 | + cd /usr/src && \ |
| 45 | + if [ -d php-firebird ]; then \ |
| 46 | + cd php-firebird && git pull; \ |
| 47 | + else \ |
| 48 | + git clone --depth 1 --branch "master" "https://github.com/FirebirdSQL/php-firebird.git"; \ |
| 49 | + fi |
| 50 | + |
| 51 | +# Build php-firebird |
| 52 | +RUN --mount=type=cache,target=/usr/src \ |
| 53 | + for php in $php_vers; do \ |
| 54 | + php_short=${php%.*} && \ |
| 55 | + cd /usr/src/php-firebird && \ |
| 56 | + (make clean || true) && \ |
| 57 | + (/opt/php-$php_short/bin/phpize --clean || true) && \ |
| 58 | + /opt/php-$php_short/bin/phpize && \ |
| 59 | + ./configure \ |
| 60 | + --with-php-config=/opt/php-$php_short/bin/php-config \ |
| 61 | + --with-interbase=/opt/$firebird/opt/firebird || (cat config.log && false) && \ |
| 62 | + make -j$(nproc) && \ |
| 63 | + patchelf --remove-rpath ./modules/interbase.so && \ |
| 64 | + cp ./modules/interbase.so /opt/php${php_short}-interbase-5.0.3-linux.so; \ |
| 65 | + done |
| 66 | + |
| 67 | +# TODO: git config --global advice.detachedHead false |
0 commit comments