RuDB PostgreSQL 19 build notes
===============================

Canonical product identity is stored in config/rudb_version.conf.
Do not hardcode RuDB product version, build date, or PostgreSQL product major
in packaging scripts.

Validated integrated configure profile:

  REPO="$(pwd)"
  BUILD=/tmp/rudb-pg19-build
  INSTALL=/opt/rudb-19

  rm -rf "$BUILD"
  mkdir -p "$BUILD"
  cd "$BUILD"

  "$REPO/configure" \
    --prefix="$INSTALL" \
    --enable-tap-tests \
    --with-libxml \
    --with-libxslt \
    --with-ssl=openssl \
    --with-pcre2 \
    --with-lz4 \
    --with-zstd

  # libcurl (>= 7.61.0) is a mandatory build prerequisite: it is always
  # detected and linked, with no configure flag. Install the dev package
  # (e.g. libcurl4-openssl-dev) before configuring.

  # --with-lz4/--with-zstd are required from CFS phase 1 (compressed file
  # system codec); phase 0 validated configure plus core module builds only.

Core and contrib build/install:

  make -j"$(nproc)" all
  make -C contrib -j"$(nproc)" all
  sudo make install
  sudo make -C contrib install

Fresh cluster smoke:

  rm -rf /tmp/rudb-pg19-data
  "$INSTALL/bin/initdb" -D /tmp/rudb-pg19-data
  "$INSTALL/bin/pg_ctl" -D /tmp/rudb-pg19-data -l /tmp/rudb-pg19.log start
  "$INSTALL/bin/psql" -d postgres -c "select rudb_version(), rudb_build_number();"
  "$INSTALL/bin/pg_ctl" -D /tmp/rudb-pg19-data stop

Product convenience wrappers:

  ./full_build.sh
  ./full_build.sh --dev
  ./full_build.sh --alt
  ./full_build_db_create_run_tests.sh --test_name=<regression-test>

Package generators:

  distr/ASTRA/1.8/
  distr/UBUNTU/24/
  distr/ALT/11/

Package/service identity is derived from config/rudb_version.conf:
PostgreSQL major selects rudb-19 package/service/path naming; RuDB product
version and build date select the package Version field.

ONNX Runtime (DBMS_VECTOR provider 'database')
==============================================

Optional feature.  Builds the vendored ONNX Runtime 1.31.0 source
(onnxruntime/) once, then links libonnxruntime.so into the server via
configure.  Without the flag DBMS_VECTOR keeps the REST-only behavior and
provider 'database' raises "local ONNX inference is not supported in this
build".

Bootstrap (once per build host; needs cmake >= 3.26, ninja, python3, patch,
and network or a mirror for the few deps ORT cannot take from packages):

  ./build_onnxruntime.sh                 # installs into $INSTALL_PATH
  PREFIX=/some/dir ./build_onnxruntime.sh
  SKIP_INSTALL=1 ./build_onnxruntime.sh  # build only

Recommended system dev packages so ORT uses them via find_package instead of
building from source (Debian/Ubuntu names; on Astra/Alt/RHEL use the distro
equivalents - re2, protobuf/abseil, eigen3, flatbuffers, nlohmann-json,
msgsl, boost headers, cpuinfo):

  protobuf-compiler libprotobuf-dev libabsl-dev libre2-dev libeigen3-dev
  libflatbuffers-dev nlohmann-json3-dev libmsgsl-dev libboost-dev
  libcpuinfo-dev

If the system protobuf/abseil versions conflict with onnx 1.22, remove those
packages: ORT then builds them from source via cmake FetchContent (network
required).

Configure with the runtime:

  ./configure ... --with-onnxruntime=DIR    # DIR = prefix with include/ lib/
  # or, when installed under the RuDB install prefix, just:
  ./configure ... --with-onnxruntime
  # or via the wrapper:
  WITH_ONNXRUNTIME=/opt/rudb-19 ./full_build.sh

libonnxruntime.so lands in the RuDB libdir, which the server rpath already
covers; target machines need a libstdc++/glibc not older than the build
host's.

Verify after a fresh cluster (cluster rebuild/creation is a manual step):

  select dbms_vector_onnx_enabled();        -- t on runtime builds

Models for provider 'database' must embed the tokenizer (a string input, as
produced by Olive-fused exports, Oracle 23ai parity); LOAD_ONNX_MODEL
validates that contract at load time.

The canonical engineering validation procedure remains
agent/docs/RUDB_PG19_PORT/06_BUILD_AND_VALIDATION_RUNBOOK.md.
