90 lines
2.1 KiB
Bash
Executable File
90 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Upgrade libpqxx to version 7.x on Ubuntu 22
|
|
# Führen Sie dieses Script auf dem Ubuntu 22 Server aus
|
|
|
|
set -euo pipefail
|
|
|
|
# Farben
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
|
log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
|
|
|
log_info "Upgrade libpqxx auf Ubuntu 22 für bessere C++23 Kompatibilität..."
|
|
|
|
# Prüfe aktuelle Version
|
|
log_info "Aktuelle libpqxx Version:"
|
|
dpkg -l | grep libpqxx || log_info "libpqxx nicht installiert"
|
|
|
|
# Installiere Build-Dependencies
|
|
log_info "Installiere Build-Dependencies..."
|
|
apt update
|
|
apt install -y \
|
|
build-essential \
|
|
cmake \
|
|
pkg-config \
|
|
git \
|
|
libpq-dev \
|
|
postgresql-server-dev-14
|
|
|
|
# Lade libpqxx 7.x herunter und kompiliere
|
|
log_info "Lade libpqxx 7.x herunter..."
|
|
cd /tmp
|
|
if [ -d "libpqxx" ]; then
|
|
rm -rf libpqxx
|
|
fi
|
|
|
|
git clone https://github.com/jtv/libpqxx.git
|
|
cd libpqxx
|
|
|
|
# Checkout Version 7.9.2 (stabile Version)
|
|
git checkout 7.9.2
|
|
|
|
# Kompiliere und installiere
|
|
log_info "Kompiliere libpqxx 7.x..."
|
|
mkdir build
|
|
cd build
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
|
|
make -j$(nproc)
|
|
make install
|
|
|
|
# Update library cache
|
|
ldconfig
|
|
|
|
log_success "libpqxx 7.x erfolgreich installiert!"
|
|
|
|
# Prüfe neue Version
|
|
log_info "Neue libpqxx Version:"
|
|
pkg-config --modversion libpqxx
|
|
|
|
log_info "Teste Kompilierung..."
|
|
cat > /tmp/test_pqxx.cpp << 'EOF'
|
|
#include <pqxx/pqxx>
|
|
#include <iostream>
|
|
|
|
int main() {
|
|
std::cout << "libpqxx Version: " << PQXX_VERSION << std::endl;
|
|
std::cout << "Major Version: " << PQXX_VERSION_MAJOR << std::endl;
|
|
return 0;
|
|
}
|
|
EOF
|
|
|
|
if g++ -o /tmp/test_pqxx /tmp/test_pqxx.cpp -lpqxx -lpq; then
|
|
log_success "Kompilierung erfolgreich!"
|
|
/tmp/test_pqxx
|
|
rm -f /tmp/test_pqxx /tmp/test_pqxx.cpp
|
|
else
|
|
log_error "Kompilierung fehlgeschlagen!"
|
|
rm -f /tmp/test_pqxx /tmp/test_pqxx.cpp
|
|
fi
|
|
|
|
log_success "libpqxx Upgrade abgeschlossen!"
|
|
log_info "Sie können jetzt das Projekt mit der neuesten libpqxx Version kompilieren."
|