Skip to content

Commit c959595

Browse files
author
Martin Köditz
committed
Created build scripts for Linux.
1 parent 24cfdfa commit c959595

7 files changed

+56
-0
lines changed
File renamed without changes.

build_scripts/php-fb-build-linux.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
# Configuration
4+
FIREBIRD_INCLUDE_DIR="/opt/firebird/include"
5+
INSTALL_DIR="../ext"
6+
REPO_URL="https://github.com/FirebirdSQL/php-firebird.git"
7+
DRIVER_VERSION="5.0.2"
8+
BRANCH_OR_COMMIT="master" # Set to a specific tag or commit if needed
9+
PHP_VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3" "8.4") # Adjust as needed
10+
BUILD_DIR="php-firebird-build"
11+
12+
set -e
13+
14+
mkdir -p "$INSTALL_DIR"
15+
rm -rf "$BUILD_DIR"
16+
echo "Cloning repository from $REPO_URL (branch: $BRANCH_OR_COMMIT)..."
17+
git clone --depth 1 --branch "$BRANCH_OR_COMMIT" "$REPO_URL" "$BUILD_DIR"
18+
19+
for VERSION in "${PHP_VERSIONS[@]}"; do
20+
echo "==> Building for PHP $VERSION"
21+
22+
PHP_BIN="/usr/bin/php$VERSION"
23+
PHPIZE="/usr/bin/phpize$VERSION"
24+
PHP_CONFIG="/usr/bin/php-config$VERSION"
25+
26+
if [[ ! -x "$PHP_BIN" || ! -x "$PHPIZE" || ! -x "$PHP_CONFIG" ]]; then
27+
echo "--> Installing missing PHP $VERSION packages..."
28+
sudo apt-get install -y "php$VERSION-dev" "php$VERSION-cli" "php$VERSION-common"
29+
fi
30+
31+
cd "$BUILD_DIR"
32+
33+
echo "--> Cleaning previous build (if any)..."
34+
make clean || true
35+
echo "--> Running phpize..."
36+
"$PHPIZE"
37+
echo "--> Configuring build..."
38+
CPPFLAGS="-I$FIREBIRD_INCLUDE_DIR" ./configure --with-php-config="$PHP_CONFIG"
39+
echo "--> Compiling..."
40+
make -j"$(nproc)"
41+
42+
PHP_FULL_VERSION=$("$PHP_BIN" -r 'echo PHP_VERSION;')
43+
ARCH=$(uname -m)
44+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
45+
46+
OUTPUT_FILE="php_${PHP_FULL_VERSION}-interbase-${DRIVER_VERSION}-${OS}-${ARCH}.so"
47+
mkdir -p "$INSTALL_DIR"
48+
echo "--> Copying output to $INSTALL_DIR/$OUTPUT_FILE"
49+
cp modules/interbase.so "$INSTALL_DIR/$OUTPUT_FILE"
50+
51+
echo "Build complete for PHP $VERSION: $OUTPUT_FILE"
52+
cd ..
53+
done
54+
55+
echo "All builds completed. Files are located in: $INSTALL_DIR"
56+
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)