build and instruction fixes
This commit is contained in:
3 files changed
+99
-2
No files matched your search
@@ -1,5 +1,6 @@
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- package
|
||||
- wiki
|
||||
|
||||
@@ -26,6 +27,7 @@ build-docker:
|
||||
- changes:
|
||||
- docker/Dockerfile.build
|
||||
- scripts/mingw-w64-toolchain.cmake
|
||||
- scripts/install-deps-ubuntu.sh
|
||||
- if: $FORCE_REBUILD_IMAGE == "true"
|
||||
|
||||
# ── Linux native build ─────────────────────────────────────────────────────────
|
||||
@@ -68,12 +70,26 @@ build-windows:
|
||||
expire_in: 1 day
|
||||
when: on_success
|
||||
|
||||
# ── Linux tests ────────────────────────────────────────────────────────────────
|
||||
test-linux:
|
||||
stage: test
|
||||
image: "${DOCKER_IMAGE}"
|
||||
needs:
|
||||
- job: build-docker
|
||||
optional: true
|
||||
script:
|
||||
- cmake -B build-linux -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_PREFIX_PATH="${QT_LINUX_DIR}"
|
||||
- cmake --build build-linux
|
||||
- QT_QPA_PLATFORM=offscreen ctest --test-dir build-linux --output-on-failure
|
||||
|
||||
# ── Package Linux as AppImage ─────────────────────────────────────────────
|
||||
package-linux:
|
||||
stage: package
|
||||
image: "${DOCKER_IMAGE}"
|
||||
needs:
|
||||
- build-linux
|
||||
- test-linux
|
||||
script:
|
||||
- chmod +x packaging/package-linux.sh
|
||||
- packaging/package-linux.sh build-linux "${QT_LINUX_DIR}" dist
|
||||
|
||||
@@ -37,8 +37,6 @@ Full target format list (derived from actual library inventory):
|
||||
|
||||
## Build & Install
|
||||
|
||||
See [README.md](README.md) for setup instructions, dependency installation, and IDE-specific build guides.
|
||||
|
||||
### Windows Build Environment
|
||||
|
||||
The toolchain is at `C:\msys64\mingw64\bin\`. Call binaries directly with full paths, but prepend `/c/msys64/mingw64/bin` to `PATH` so the compiler and its runtime DLLs are resolvable:
|
||||
@@ -62,6 +60,58 @@ PATH="/c/msys64/mingw64/bin:$PATH" "C:/msys64/mingw64/bin/ctest.exe" --test-dir
|
||||
|
||||
Use Unix-style paths (`/c/msys64/...`) for `PATH` assignments — Windows-style paths are not recognised by the shell.
|
||||
|
||||
### Linux Build Environment
|
||||
|
||||
Base: **Ubuntu 24.04**. Ubuntu apt only ships Qt 6.4, which is too old; Qt 6.10.1 is installed via `aqtinstall`.
|
||||
|
||||
Run `scripts/install-deps-ubuntu.sh` to install all system packages and Qt, then:
|
||||
|
||||
```bash
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_PREFIX_PATH=/opt/qt/6.10.1/gcc_64
|
||||
|
||||
ninja -C build
|
||||
ctest --test-dir build --output-on-failure
|
||||
```
|
||||
|
||||
System packages installed by the script:
|
||||
|
||||
| Package | Purpose |
|
||||
|---|---|
|
||||
| `build-essential` | GCC/G++ compiler |
|
||||
| `cmake`, `ninja-build` | Build system |
|
||||
| `git` | Version control |
|
||||
| `libgl1-mesa-dev` | OpenGL headers (Qt) |
|
||||
| `libxkbcommon-dev` | XKB headers (Qt) |
|
||||
| `libuchardet-dev` | Encoding detection (TXT reader) |
|
||||
| `libminizip-dev` | ZIP/EPUB extraction |
|
||||
| `libdjvulibre-dev` | DjVu format |
|
||||
| `libwpd-dev` | Legacy .doc format |
|
||||
| `python3-venv` | For aqtinstall |
|
||||
|
||||
### CI Build Environment
|
||||
|
||||
GitLab CI (`.gitlab-ci.yml`), stages: `build` → `package` → `wiki`.
|
||||
|
||||
The CI Docker image is built from `docker/Dockerfile.build` (Ubuntu 24.04 base) and contains:
|
||||
- Native Linux toolchain + Qt 6.10.1 at `$QT_LINUX_DIR` (`/opt/qt/6.10.1/gcc_64`)
|
||||
- MinGW-w64 cross-compilation toolchain + Qt 6.10.1 for Windows at `$QT_WINDOWS_DIR` (`/opt/qt/6.10.1/mingw_64`)
|
||||
- Cross-compiled Windows sysroot at `$MINGW_SYSROOT` (`/opt/mingw-sysroot`) with libiconv and uchardet
|
||||
- AppImage packaging tools (linuxdeploy, appimagetool)
|
||||
|
||||
Windows builds are cross-compiled from Linux using `scripts/mingw-w64-toolchain.cmake`.
|
||||
|
||||
#### Adding a new C/C++ dependency
|
||||
|
||||
When `CMakeLists.txt` gains a new `find_package` or `pkg_check_modules` dependency, update **all** of the following:
|
||||
|
||||
| File | What to add |
|
||||
|---|---|
|
||||
| `scripts/install-deps-ubuntu.sh` | `apt` package for Linux host builds |
|
||||
| `scripts/install-deps-windows.sh` | `pacman` package for Windows host builds |
|
||||
| `docker/Dockerfile.build` | `apt` package for CI Linux build; cross-compiled lib for CI Windows cross-build if needed |
|
||||
|
||||
## Test-Driven Development
|
||||
|
||||
**All new backend logic must be test-driven.** Follow the red-green-refactor cycle strictly:
|
||||
|
||||
@@ -55,6 +55,37 @@ RUN git clone --depth 1 https://gitlab.freedesktop.org/uchardet/uchardet.git /tm
|
||||
cmake --install /tmp/uchardet-build && \
|
||||
rm -rf /tmp/uchardet /tmp/uchardet-build
|
||||
|
||||
# ── zlib + minizip for MinGW (static, cross-compiled) ─────────────────────────
|
||||
RUN wget -q https://zlib.net/zlib-1.3.1.tar.gz -O /tmp/zlib.tar.gz && \
|
||||
tar -xf /tmp/zlib.tar.gz -C /tmp && \
|
||||
\
|
||||
# Build zlib static lib using the MinGW-specific Makefile
|
||||
cd /tmp/zlib-1.3.1 && \
|
||||
make -f win32/Makefile.gcc \
|
||||
PREFIX=x86_64-w64-mingw32- \
|
||||
BINARY_PATH=/opt/mingw-sysroot/bin \
|
||||
INCLUDE_PATH=/opt/mingw-sysroot/include \
|
||||
LIBRARY_PATH=/opt/mingw-sysroot/lib \
|
||||
SHARED_MODE=0 install && \
|
||||
\
|
||||
# Build minizip static lib from contrib/minizip
|
||||
cd /tmp/zlib-1.3.1/contrib/minizip && \
|
||||
x86_64-w64-mingw32-gcc -c \
|
||||
-I/opt/mingw-sysroot/include \
|
||||
-DNOUNCRYPT -DNOCRYPT \
|
||||
ioapi.c unzip.c zip.c && \
|
||||
x86_64-w64-mingw32-ar rcs libminizip.a ioapi.o unzip.o zip.o && \
|
||||
cp libminizip.a /opt/mingw-sysroot/lib/ && \
|
||||
mkdir -p /opt/mingw-sysroot/include/minizip && \
|
||||
cp ioapi.h unzip.h zip.h /opt/mingw-sysroot/include/minizip/ && \
|
||||
\
|
||||
# Write pkg-config file
|
||||
mkdir -p /opt/mingw-sysroot/lib/pkgconfig && \
|
||||
printf 'prefix=/opt/mingw-sysroot\nlibdir=${prefix}/lib\nincludedir=${prefix}/include/minizip\n\nName: minizip\nDescription: Minizip zip/unzip library\nVersion: 1.3.1\nLibs: -L${libdir} -lminizip -lz\nCflags: -I${includedir}\n' \
|
||||
> /opt/mingw-sysroot/lib/pkgconfig/minizip.pc && \
|
||||
\
|
||||
rm -rf /tmp/zlib-1.3.1 /tmp/zlib.tar.gz
|
||||
|
||||
ENV QT_LINUX_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/gcc_64
|
||||
ENV QT_WINDOWS_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/mingw_64
|
||||
ENV MINGW_SYSROOT=/opt/mingw-sysroot
|
||||
|
||||
Reference in new issue
Block a user