Commit 12ac147e authored by jan.koester's avatar jan.koester
Browse files

test

parent 825a6cf3
Loading
Loading
Loading
Loading
+56 −5
Original line number Diff line number Diff line
@@ -24,6 +24,14 @@ LLVM_VERSION="18"
# Git repositories for custom libraries
GIT_BASE="https://git.tuxist.de/git"
declare -A LIBS=(
    # System/third-party dependencies (built from source with musl)
    [json-c]="https://github.com/json-c/json-c.git"
    [libyaml]="https://github.com/yaml/libyaml.git"
    [brotli]="https://github.com/google/brotli.git"
    [tinyxml2]="https://github.com/leethomason/tinyxml2.git"
    [sqlite]="https://github.com/sqlite/sqlite.git"
    [libpq]="https://github.com/postgres/postgres.git"
    # Custom libraries
    [libcmdplus]="$GIT_BASE/jan.koester/libcmdplus.git"
    [uuidplus]="$GIT_BASE/tuxist/uuidplus.git"
    [libnetplus]="$GIT_BASE/jan.koester/libnetplus.git"
@@ -88,15 +96,13 @@ setup_chroot() {
    mkdir -p "$CHROOT_DIR"
    debootstrap --variant=minbase --arch="$ARCH" trixie "$CHROOT_DIR" http://deb.debian.org/debian

    # Install minimal build dependencies in the chroot
    # Install minimal build tools in the chroot (no dev libs — we build everything from source)
    systemd-nspawn -D "$CHROOT_DIR" --pipe -- bash -c '
        apt-get update
        apt-get install -y --no-install-recommends \
            ca-certificates wget git cmake ninja-build pkg-config \
            libyaml-dev libjson-c-dev libbrotli-dev libtinyxml2-dev \
            libsqlite3-dev libpq-dev uuid-dev \
            ca-certificates wget git cmake ninja-build pkg-config autoconf automake libtool \
            xz-utils python3 file dpkg-dev fakeroot debhelper \
            libffmpeg-nvenc-dev ffmpeg
            bison flex libreadline-dev zlib1g-dev
    '
}

@@ -350,6 +356,51 @@ build_libraries() {
            touch .\${name}.done
        }

        # ── System/third-party dependencies ──
        build_lib json-c '${LIBS[json-c]}' '-DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF'
        build_lib libyaml '${LIBS[libyaml]}' '-DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DINSTALL_CMAKE_DIR=lib/cmake/yaml'
        build_lib brotli '${LIBS[brotli]}' '-DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF'
        build_lib tinyxml2 '${LIBS[tinyxml2]}' '-DBUILD_SHARED_LIBS=OFF -Dtinyxml2_BUILD_TESTING=OFF'

        # SQLite (autoconf-based, not cmake)
        if [ ! -f /build/libs/.sqlite.done ]; then
            echo \"  [build] sqlite\"
            if [ ! -d sqlite ]; then
                git clone --depth 1 '${LIBS[sqlite]}' sqlite
            fi
            cd sqlite
            CC=/usr/local/musl/bin/musl-clang ./configure --prefix=\$PREFIX --disable-shared --enable-static
            make -j\$(nproc)
            make install
            cd /build/libs
            touch .sqlite.done
        else
            echo \"  [skip] sqlite already built\"
        fi

        # PostgreSQL (only build libpq client library)
        if [ ! -f /build/libs/.libpq.done ]; then
            echo \"  [build] libpq\"
            if [ ! -d postgres ]; then
                git clone --depth 1 --branch REL_17_STABLE '${LIBS[libpq]}' postgres
            fi
            cd postgres
            CC=/usr/local/musl/bin/musl-clang CXX=/usr/local/musl/bin/musl-clang++ \
                ./configure --prefix=\$PREFIX --without-readline --without-zlib --without-icu
            cd src/interfaces/libpq
            make -j\$(nproc)
            make install
            cd /build/libs/postgres/src/include
            make install
            cd /build/libs/postgres/src/bin/pg_config
            make install
            cd /build/libs
            touch .libpq.done
        else
            echo \"  [skip] libpq already built\"
        fi

        # ── Custom libraries ──
        build_lib libcmdplus '${LIBS[libcmdplus]}'
        build_lib uuidplus '${LIBS[uuidplus]}'
        build_lib libnetplus '${LIBS[libnetplus]}'