Commit aacce7d5 authored by jan.koester's avatar jan.koester
Browse files

test

parent dbcdae96
Loading
Loading
Loading
Loading
+1 −1
Changes for debian/rules: 1 added line, 1 removed line.
Original line number Diff line number Diff line
#!/usr/bin/make -f

export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
NODE_BINARY := $(shell command -v node)
NODE_BINARY := $(shell command -v node || command -v nodejs)

%:
ifndef ROOTBUILD
+12 −3
Changes for editor/CMakeLists.txt: 12 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -83,9 +83,18 @@ install(DIRECTORY node/ DESTINATION ${CMAKE_INSTALL_DATADIR}/blogi-editor/node)
install(FILES config.yaml DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/blogi-editor)

if(WEBEDIT_ENABLE_EMBEDDED_NODE)
    if(EXISTS "${WEBEDIT_EMBEDDED_NODE_BINARY}")
        install(PROGRAMS "${WEBEDIT_EMBEDDED_NODE_BINARY}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/blogi-editor/node/bin RENAME node)
    set(_embedded_node_candidate "${WEBEDIT_EMBEDDED_NODE_BINARY}")

    if(NOT _embedded_node_candidate OR NOT EXISTS "${_embedded_node_candidate}")
        find_program(_embedded_node_candidate NAMES node nodejs)
        if(_embedded_node_candidate)
            message(STATUS "Using discovered Node.js binary for embedded runtime: ${_embedded_node_candidate}")
        endif()
    endif()

    if(_embedded_node_candidate AND EXISTS "${_embedded_node_candidate}")
        install(PROGRAMS "${_embedded_node_candidate}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/blogi-editor/node/bin RENAME node)
    else()
        message(FATAL_ERROR "WEBEDIT_ENABLE_EMBEDDED_NODE is ON but WEBEDIT_EMBEDDED_NODE_BINARY does not exist")
        message(WARNING "WEBEDIT_ENABLE_EMBEDDED_NODE is ON but no valid Node.js binary was found (WEBEDIT_EMBEDDED_NODE_BINARY / node / nodejs). Continuing without embedded Node.js.")
    endif()
endif()
+1 −0
Changes for editor/src/webedit_api.cpp: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@

#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
+70 −8
Changes for packaging/build-nspawn.sh: 70 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ declare -A LIBS=(
    [sqlite]="https://github.com/sqlite/sqlite.git"
    [libpq]="https://github.com/postgres/postgres.git"
    [libressl]="https://github.com/libressl/portable.git"
    [nodejs]="https://github.com/nodejs/node.git"
    # Custom libraries
    [libcmdplus]="$GIT_BASE/jan.koester/libcmdplus.git"
    [uuidplus]="$GIT_BASE/tuxist/uuidplus.git"
@@ -97,13 +98,24 @@ fi
# Phase 1: Create minimal Debian chroot
# ─────────────────────────────────────────────────────────────
setup_chroot() {
    ensure_chroot_packages() {
        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 autoconf automake libtool \
                xz-utils python3 file dpkg-dev fakeroot debhelper \
                bison flex libreadline-dev zlib1g-dev
        '
    }

    if [[ $CLEAN -eq 1 ]] && [[ -d "$CHROOT_DIR" ]]; then
        echo "==> Cleaning existing chroot..."
        rm -rf "$CHROOT_DIR"
    fi

    if [[ -d "$CHROOT_DIR/usr/bin" ]]; then
        echo "==> Chroot already exists, skipping bootstrap"
        echo "==> Chroot already exists, ensuring required packages are installed"
        ensure_chroot_packages
        return
    fi

@@ -112,13 +124,7 @@ setup_chroot() {
    debootstrap --variant=minbase --arch="$ARCH" trixie "$CHROOT_DIR" http://deb.debian.org/debian

    # 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 autoconf automake libtool \
            xz-utils python3 file dpkg-dev fakeroot debhelper \
            bison flex libreadline-dev zlib1g-dev
    '
    ensure_chroot_packages
}

# ─────────────────────────────────────────────────────────────
@@ -449,6 +455,28 @@ build_libraries() {
            echo \"  [skip] libressl already built\"
        fi

        # Node.js (built from source with musl wrappers)
        if [ ! -f /build/libs/.nodejs.done ]; then
            echo \"  [build] nodejs\"
            cd /build/libs
            if [ ! -d nodejs ]; then
                git clone --depth 1 --branch v22.x '${LIBS[nodejs]}' nodejs || git clone --depth 1 '${LIBS[nodejs]}' nodejs
            fi
            cd nodejs
            export CC=/usr/local/musl/bin/musl-clang
            export CXX=/usr/local/musl/bin/musl-clang++
            export AR=llvm-ar-${LLVM_VERSION}
            export RANLIB=llvm-ranlib-${LLVM_VERSION}
            ./configure --prefix=\$PREFIX --without-npm
            make -j\$(nproc)
            make install
            ln -sf /usr/local/bin/node /usr/local/bin/nodejs
            cd /build/libs
            touch .nodejs.done
        else
            echo \"  [skip] nodejs already built\"
        fi

        # ── Custom libraries ──
        build_lib libcmdplus '${LIBS[libcmdplus]}'
        build_lib uuidplus '${LIBS[uuidplus]}'
@@ -572,6 +600,40 @@ update_libraries() {
            cd /build/libs
        fi

        # Node.js (source build)
        if [ ! -d nodejs ]; then
            echo \"  [clone] nodejs\"
            git clone --depth 1 --branch v22.x '${LIBS[nodejs]}' nodejs || git clone --depth 1 '${LIBS[nodejs]}' nodejs
        else
            echo \"  [pull] nodejs\"
            cd nodejs
            git fetch --depth 1 origin
            LOCAL=\$(git rev-parse HEAD)
            REMOTE=\$(git rev-parse FETCH_HEAD)
            if [ \"\$LOCAL\" != \"\$REMOTE\" ]; then
                git reset --hard FETCH_HEAD
                rm -f /build/libs/.nodejs.done
            else
                echo \"  [skip] nodejs already up-to-date\"
            fi
            cd /build/libs
        fi

        if [ ! -f /build/libs/.nodejs.done ]; then
            echo \"  [rebuild] nodejs\"
            cd /build/libs/nodejs
            export CC=/usr/local/musl/bin/musl-clang
            export CXX=/usr/local/musl/bin/musl-clang++
            export AR=llvm-ar-${LLVM_VERSION}
            export RANLIB=llvm-ranlib-${LLVM_VERSION}
            ./configure --prefix=\$PREFIX --without-npm
            make -j\$(nproc)
            make install
            ln -sf /usr/local/bin/node /usr/local/bin/nodejs
            touch /build/libs/.nodejs.done
            cd /build/libs
        fi

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