Bundled system libraries
========================

The rampart-install bundle may ship the following dynamic libraries in
<prefix>/lib/ so that the IVFPQ vector-index code in rampart-sql.so and
texislockd works on a vanilla install without an additional package
install step.  Which ones are actually bundled depends on the platform
the bundle was built on; not every name listed below is present in
every bundle.

  libopenblas.so.0     OpenBLAS BLAS/LAPACK runtime          (all platforms)
  libgfortran.so.5     GCC Fortran runtime                   (Linux, FreeBSD)
  libquadmath.so.0     GCC quad-precision math runtime       (Linux, FreeBSD)
  libgomp.so.1         GCC OpenMP runtime                    (Linux only)

Platforms not in the list above (e.g. macOS) draw on the system-provided
equivalent (Accelerate framework on macOS) and bundle nothing extra.

The libraries are dynamically linked, not statically embedded.
rampart-sql.so and texislockd are built with RPATH "$ORIGIN/../lib" so
the dynamic loader resolves these copies first; the user's system copies
(if any) are used as a fallback if the bundled file is removed.

Licenses
--------

  libopenblas      BSD-3-Clause
  libgfortran      GPL-3-or-later WITH GCC Runtime Library Exception
  libgomp          GPL-3-or-later WITH GCC Runtime Library Exception
  libquadmath      LGPL-2.1-or-later WITH GCC Runtime Library Exception

The GCC Runtime Library Exception accompanying libgfortran / libgomp /
libquadmath explicitly permits combining them with non-GPL code,
statically or dynamically.  rampart's MIT license, rampart-sql's
separately-licensed code, and any other module in the bundle are
therefore unaffected by the GPL terms of the runtime libraries.

Per-distribution authoritative copyright texts for each library (as
shipped by the build host's package manager: Debian apt, FreeBSD
ports, etc.) are placed adjacent to this file in <prefix>/licenses/
when the build was assembled.  These typically include the upstream
licenses verbatim plus any distro-specific notices.

Source code
-----------

The source code for these libraries is freely available:

  OpenBLAS      https://github.com/OpenMathLib/OpenBLAS

  libgfortran   https://gcc.gnu.org/git/?p=gcc.git
  libgomp       (subdirectories: libgfortran, libgomp, libquadmath)
  libquadmath

In accordance with GPL-3 Section 6, copies of the source corresponding
to the binaries shipped in any specific rampart-install bundle are
available on request from the rampart distributor for a period of three
years following the distribution of the bundle in question.  Contact
information is at https://rampart.dev/.


rampart-langtools package
=========================

rampart-langtools (and its rampart-langtools-cuda variant) ships
rampart-faiss.so + rampart-llamacpp.so + rampart-sentencepiece.so
+ rampart-clip.so + rampart-ocr.so.
These .so's are built with RPATH "$ORIGIN/../lib" so they pick up
the install bundle's libopenblas / libgfortran / libgomp / libquadmath
(see the first section of this file for their licenses).  No additional
runtime libraries are bundled inside the langtools package itself.

rampart-clip.so statically compiles in two additional third-party
sources (neither adds a runtime .so of its own):

  clip.cpp    the CLIP model definition, its two transformer towers,
              the CLIP BPE tokenizer and the bicubic image
              preprocessing -- ported onto the same ggml that
              rampart-llamacpp links, so ggml is NOT a second copy
                                        -> clip.cpp-license.txt  (MIT)

  stb_image   the single-header image decoder used to read JPEG / PNG /
              BMP / GIF / TGA / PSD / HDR / PIC / PNM, from a file or
              from a memory buffer      -> stb_image-license.txt
                                           (MIT or public domain --
                                            the user may choose either)

rampart-ocr.so statically compiles in two third-party sources (neither
adds a runtime .so of its own).  It contains no inference engine: the
PP-OCR models run on the ONNX Runtime inside rampart-onnx.so, reached
through a C ABI, so ORT is not a second copy here.

  stb_image   the same single-header image decoder rampart-clip uses,
              reading JPEG / PNG / BMP / GIF / TGA / PSD / HDR / PIC /
              PNM from a file or a memory buffer.  rampart-ocr compiles
              its own copy, whose symbols are kept private by a linker
              version script so the two copies cannot bind to each other
                                        -> stb_image-license.txt
                                           (MIT or public domain --
                                            the user may choose either)

  libtiff     TIFF decoding, which stb_image does not provide and which
              document work needs: multi-page Group 4 TIFF is a standard
              archive format for scanned material.  Vendored and static
              because there is usually no system copy to link -- the
              manylinux build ovens carry none, macOS ships none in
              /usr/lib (TIFF lives behind the ImageIO framework), and
              the headers are absent even where the runtime library is
              present.  Built with every optional third-party codec
              disabled (no JPEG-in-TIFF, JBIG, LZMA, ZSTD, WebP or
              LERC).  G3/G4, LZW and PackBits are internal to libtiff.
              It does link zlib, for Deflate-compressed TIFF.  That
              makes rampart-ocr the first module in THIS package to
              reference zlib directly (rampart-clip, -faiss and
              -llamacpp already load it transitively, via the bundled
              libgfortran.so.5), but it is no new requirement for the
              install as a whole: rampart-sql, rampart-curl and
              rampart-whatwg all link zlib directly already.  It is
              dynamically linked against the system copy rather than
              bundled, which is safe on every target -- the manylinux
              ovens carry libz.so and zlib.h, and macOS provides it
              through the SDK
                                        -> libtiff-license.txt
                                           (BSD-style / MIT-like)

The PP-OCR model files themselves are NOT bundled.  They are downloaded
on first use by rampart-models into ~/.rampart/models/ and are Apache-2.0
(PaddlePaddle PP-OCRv5, via an ONNX conversion).

Embedded data
-------------

rampart-sql.so (via the texis full-text engine it contains) compiles in
tables derived from the Unicode Character Database, used by the REX
\u character classes (\uword, \ualpha, ...) and the default full-text
index word expression:

  UnicodeData.txt   Unicode 17.0, from
                    https://www.unicode.org/Public/17.0.0/ucd/UnicodeData.txt
                    reduced to codepoint-range tables by
                    extern/texis/texisapi/genrexuni.py (rexuni.h)
                    Copyright (c) Unicode, Inc.
                                        -> ICU-license.txt  (Unicode-3.0)

The same Unicode License v3 covers the bundled ICU library
(extern/icu, ICU 76.1 / Unicode 16.0) behind rampart-intl.so, which is
why a single copy of the notice, ICU-license.txt, serves both.

The rampart-langtools-cuda variant additionally links against NVIDIA's
proprietary libcudart / libcublas / libcublasLt at runtime.  Those are
NOT redistributed by us; users must install the NVIDIA CUDA toolkit
themselves under NVIDIA's CUDA EULA.


rampart-onnx (part of the rampart-langtools package)
====================================================

rampart-onnx.so is a single, CPU+GPU module.  ONNX Runtime and
onnxruntime-extensions are compiled INTO it statically:

  ONNX Runtime            the inference engine
                          -> onnxruntime-license.txt  (MIT, Microsoft)
                          -> onnxruntime-third-party-notices.txt

  onnxruntime-extensions  the native tokenizers (WordPiece via
                          BertTokenizer, SentencePiece / BPE via the
                          Ortx C API)
                          -> onnxruntime-extensions-license.txt
                             (MIT, Microsoft)
                          -> onnxruntime-extensions-third-party-notices.txt

Both upstreams vendor a substantial number of further third-party
components (protobuf, abseil, flatbuffers, ONNX, Eigen, and others).
Those are NOT enumerated here -- each upstream's own
ThirdPartyNotices file, copied verbatim above, is the authoritative
list and carries the required notices.

GPU builds additionally REDISTRIBUTE ONNX Runtime shared libraries.
A cuNN build installs a runtime directory beside the module:

  <prefix>/modules/onnx-cu12/    (and/or onnx-cu13/)
      libonnxruntime.so.1.27.0   + the .so.1 / .so symlinks
      libonnxruntime_providers_shared.so
      libonnxruntime_providers_cuda.so

These are builds of ONNX Runtime itself and are covered by the same
onnxruntime-license.txt / onnxruntime-third-party-notices.txt above.
The module dlopen's whichever directory matches the host's CUDA driver;
if none does, it falls back to the CPU engine built into the module.

As with rampart-langtools-cuda, NVIDIA's proprietary libcudart /
libcublas / libcublasLt (and, for the CUDA execution provider, cuDNN)
are NOT redistributed by us -- users install the NVIDIA CUDA toolkit
themselves under NVIDIA's CUDA EULA.


rampart-graphicsmagick package
==============================

rampart-graphicsmagick.so requires a SYSTEM-installed GraphicsMagick
to be present at runtime; the package ships only the rampart binding
(rampart-graphicsmagick.so) and the JS wrapper (rampart-gm.js), not
any of GraphicsMagick's codec / format dependencies.

This separation keeps the distribution license-compatible with the
proprietary rampart-sql in the same install: the standard distro
builds of GraphicsMagick pull in libheif which transitively links
libx265 (GPL-2-or-later), and redistributing GPL-2 code in a bundle
alongside proprietary code can't be reconciled cleanly.  By relying
on the user's system GraphicsMagick install we leave the GPL
distribution choice to the user's OS package manager (apt, brew,
pkg, etc.) rather than making it ourselves.

Install instructions are printed by rampart-gm.js when the require
fails on a system without GraphicsMagick:

  macOS    : brew install graphicsmagick
  Debian   : sudo apt install libgraphicsmagick3 libgraphicsmagickwand-q16-2
  Fedora   : sudo dnf install GraphicsMagick
  FreeBSD  : sudo pkg install graphicsmagick
  Alpine   : sudo apk add graphicsmagick
