#!/usr/bin/env bash # Build script for DB Browser for SQLite (sqlitebrowser) # Self-contained: installs deps, clones (if needed), configures, builds, installs. # Runs as root, no sudo required. set -euo pipefail REPO_URL="https://github.com/sqlitebrowser/sqlitebrowser" SRC_DIR="/workspace/repo" BUILD_DIR="${SRC_DIR}/appbuild" INSTALL_PREFIX="/workspace/install" export DEBIAN_FRONTEND=noninteractive echo "=== Installing build dependencies ===" apt-get update -y || true apt-get install -y \ build-essential \ cmake \ ninja-build \ git \ qtbase5-dev \ qtbase5-dev-tools \ qttools5-dev \ qttools5-dev-tools \ libqt5svg5-dev \ libsqlite3-dev echo "=== Configuring (CMake / Ninja, Release) ===" rm -rf "${BUILD_DIR}" mkdir -p "${BUILD_DIR}" cd "${BUILD_DIR}" # FORCE_INTERNAL_QSCINTILLA=ON: build the bundled QScintilla so we don't depend # on a distro QScintilla package (which can be Qt4 and crash). QCustomPlot and # QHexEdit already default to their bundled/internal copies. # sqlcipher=0: use the plain system SQLite3 (no encryption support). cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \ -DFORCE_INTERNAL_QSCINTILLA=ON \ -Dsqlcipher=0 \ -Wno-dev \ "${SRC_DIR}" echo "=== Building ===" ninja echo "=== Installing to ${INSTALL_PREFIX} ===" ninja install # Make the whole install tree world-readable/executable so the app can be # launched by an unprivileged user in later pipeline stages (build.sh runs as # root, so freshly installed files are root-owned and may be 0700 otherwise). chmod -R a+rX "${INSTALL_PREFIX}" echo "=== Build complete ===" test -x "${INSTALL_PREFIX}/bin/sqlitebrowser" && echo "OK: ${INSTALL_PREFIX}/bin/sqlitebrowser"