Skip to content

Commit 6e3d1ee

Browse files
Dynamically set DRIVER_VERSION in build script
Remove hardcoded DRIVER_VERSION and read it from files.
1 parent c959595 commit 6e3d1ee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

build_scripts/php-fb-build-linux.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
FIREBIRD_INCLUDE_DIR="/opt/firebird/include"
55
INSTALL_DIR="../ext"
66
REPO_URL="https://github.com/FirebirdSQL/php-firebird.git"
7-
DRIVER_VERSION="5.0.2"
87
BRANCH_OR_COMMIT="master" # Set to a specific tag or commit if needed
98
PHP_VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3" "8.4") # Adjust as needed
109
BUILD_DIR="php-firebird-build"
@@ -16,6 +15,15 @@ rm -rf "$BUILD_DIR"
1615
echo "Cloning repository from $REPO_URL (branch: $BRANCH_OR_COMMIT)..."
1716
git clone --depth 1 --branch "$BRANCH_OR_COMMIT" "$REPO_URL" "$BUILD_DIR"
1817

18+
# Read version from driver
19+
if [[ -f "$BUILD_DIR/php_interbase.h" ]]; then
20+
DRIVER_VERSION=$(grep -Eo 'PHP_INTERBASE_VERSION\s+"[0-9.]+"' "$BUILD_DIR/php_interbase.h" | grep -Eo '[0-9.]+')
21+
elif [[ -f "$BUILD_DIR/package.xml" ]]; then
22+
DRIVER_VERSION=$(grep -oPm1 "(?<=<version>)[^<]+" "$BUILD_DIR/package.xml")
23+
else
24+
DRIVER_VERSION="unknown"
25+
fi
26+
1927
for VERSION in "${PHP_VERSIONS[@]}"; do
2028
echo "==> Building for PHP $VERSION"
2129

0 commit comments

Comments
 (0)