Fix support for couchbase 4.x

This commit is contained in:
Shivam Mathur 2022-05-24 15:45:18 +05:30
parent 1dfe0dc4a4
commit 67ff09364d
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 58 additions and 63 deletions

View File

@ -1,5 +1,6 @@
amqp=amqp
apcu=apcu
couchbase=couchbase
expect=expect
gnupg=gnupg
grpc=grpc

View File

@ -1,7 +1,6 @@
# Function to install libraries required by couchbase
add_couchbase_clibs() {
ext=$1
if [ "$(uname -s)" = "Linux" ]; then
trunk="https://github.com/couchbase/libcouchbase/releases"
if [[ "$ext" =~ couchbase-2.+ ]]; then
release="2.10.9"
@ -15,18 +14,9 @@ add_couchbase_clibs() {
sudo tar -xf /tmp/libcouchbase.tar -C /tmp
install_packages libev4 libevent-dev
sudo dpkg -i /tmp/libcouchbase-*/*.deb
else
if [[ "$ext" =~ couchbase-2.+ ]]; then
brew install libcouchbase@2
brew link --overwrite --force libcouchbase@2
else
brew install libcouchbase
fi
fi
}
add_couchbase_cxxlibs() {
if [ "$(uname -s)" = "Linux" ]; then
if [ "$VERSION_ID" = "18.04" ]; then
if ! command -v gcc-8 >/dev/null || ! command -v g++-8 >/dev/null; then
install_packages gcc-8 g++-8 -y
@ -37,13 +27,6 @@ add_couchbase_cxxlibs() {
add_list cmake https://apt.kitware.com/ubuntu/ https://apt.kitware.com/keys/kitware-archive-latest.asc "$VERSION_CODENAME" main
fi
install_packages cmake ccache
else
brew install cmake ccache gcc
OPENSSL_ROOT_DIR="$(brew --prefix openssl@1.1)"
export OPENSSL_ROOT_DIR
export CC=gcc
export CXX=g++
fi
}
get_couchbase_version() {
@ -53,19 +36,17 @@ get_couchbase_version() {
echo couchbase-2.6.2
elif [ "${version:?}" = '7.2' ]; then
echo couchbase-3.0.4
else
elif [ "${version:?}" = '7.3' ]; then
echo couchbase-3.2.2
else
echo couchbase
fi
# elif [ "${version:?}" = '7.3' ]; then
# echo couchbase-3.2.2
# else
# echo couchbase
# fi
}
# Function to add couchbase.
add_couchbase() {
ext=$1
if [ "$(uname -s)" = "Linux" ]; then
if [ "$ext" = "couchbase" ]; then
ext=$(get_couchbase_version)
fi
@ -77,8 +58,21 @@ add_couchbase() {
enable_extension "couchbase" "extension"
if check_extension "couchbase"; then
add_log "${tick:?}" "couchbase" "Enabled"
else
if [ "$ext" = "couchbase" ]; then
ext="couchbase-$(get_pecl_version "couchbase" "stable")"
add_extension_from_source couchbase https://pecl.php.net couchbase couchbase "${ext##*-}" extension pecl >/dev/null 2>&1
else
pecl_install "${ext}" >/dev/null 2>&1
fi
add_extension_log "couchbase" "Installed and enabled"
fi
else
if [ -e "${ext_dir:?}"/libcouchbase_php_core.dylib ]; then
couchbase_prefix="${brew_prefix:?}"/opt/couchbase@"$version"
sudo mkdir -p "$couchbase_prefix"
sudo cp "${ext_dir:?}"/libcouchbase_php_core.dylib "$couchbase_prefix"
fi
add_brew_extension couchbase extension
fi
}