Following the previous chapter “Compiling Qt5-based Open-Source Application qBittorrent in Linyaps Container”, we now complete the final steps of Linyaps Packaging Basics by creating a comprehensive linglong.yaml to achieve:

  1. Automated source code retrieval
  2. Automatic patch application
  3. Automated compilation and installation

Preparation

According to the “Generic Resource Standards for Linyaps Packaging” in the basics chapter, graphical applications require icons and .desktop files to ensure desktop user experience.

To create a complete linglong.yaml for automated qBittorrent compilation, prepare the following materials:

  1. Non-binary generic resources: icons and .desktop files.
  2. Git repository information (URL, tag, commit) for qBittorrent.
  3. Git repository information for the third-party library libtorrent-rasterbar.

Generic Resource Preparation

From the previous compilation in the Linyaps container, we extract compliant resources:

ziggy@linyaps23:/project/src/qBittorrent-release-4.6.7-szbt2/build$ ls $PREFIX/share/applications/  
org.qbittorrent.qBittorrent.desktop  
ziggy@linyaps23:/project/src/qBittorrent-release-4.6.7-szbt2/build$ ls $PREFIX/share/icons/hicolor/128x128/apps/  
qbittorrent.png  

Organize these under the template_app directory:

template_app  
├── linglong.yaml  
└── template_app  
  ├── applications  
  │   └── org.qbittorrent.qBittorrent.desktop  
  ├── icons  
  │   └── hicolor  
  │       ├── 128x128  
  │       │   ├── apps  
  │       │   │   └── qbittorrent.png  
  │       │   └── status  
  │       │       └── qbittorrent-tray.png  
  │       └── scalable  
  │           ├── apps  
  │           │   └── qbittorrent.svg  
  │           └── status  
  │               ├── qbittorrent-tray-dark.svg  
  │               ├── qbittorrent-tray-light.svg  
  │               └── qbittorrent-tray.svg  

Desktop File Customization

Verify compliance with Linyaps standards:

[Desktop Entry]  
Categories=Network;FileTransfer;P2P;Qt;  
Exec=qbittorrent %U  
GenericName=BitTorrent client  
Comment=Download and share files over BitTorrent  
Icon=qbittorrent  

Key observations:

  1. Icon field matches the icon filename (compliant).
  2. Exec field must be updated to the absolute path of the binary within the Linyaps container.

Configuring linglong.yaml

Build upon the existing minimal configuration:

# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

version: "4.6.7.2"

package:
id: org.qbittorrent.qBittorrent
name: "qBittorrent"
version: 4.6.7.2
kind: app
description: |
  qBittorrent binary

base: org.deepin.foundation/23.0.0
runtime: org.deepin.Runtime/23.0.1

command:
- /opt/apps/org.qbittorrent.qBittorrent/files/bin/qbittorrent

sources:
- kind: local
  name: "qBittorrent"

build: |
mkdir -p ${PREFIX}/bin/ ${PREFIX}/share/

Build Rule Implementation & Testing

To ensure accuracy, we first integrate compilation commands without Git automation.

  1. Extract source code using the Host Terminal:
ziggy@linyaps23:/media/szbt/Data/ll-build/QT/qBittorrent-local$ tar -xvf qBittorrent-4.6.7-git-origin-src.tar.zst -C src/  
ziggy@linyaps23:/media/szbt/Data/ll-build/QT/qBittorrent-local$ tar -xvf libtorrent-rasterbar-2.0.9.tar.gz -C 3rd/  
  1. Update the build section with manual compilation steps (mapped to /project):
build: |  
mkdir -p ${PREFIX}/bin/ ${PREFIX}/share/  
## Build 3rd libs  
mkdir /project/3rd/libtorrent-rasterbar-2.0.9/build  
cd /project/3rd/libtorrent-rasterbar-2.0.9/build  
cmake -DCMAKE_BUILD_TYPE=Release \  
      -DCMAKE_INSTALL_PREFIX=$PREFIX ..  
make -j$(nproc)  
make install  

## Build main  
mkdir /project/src/qBittorrent-release-4.6.7-szbt2/build  
cd /project/src/qBittorrent-release-4.6.7-szbt2/build  
cmake -DCMAKE_BUILD_TYPE=Release \  
      -DCMAKE_INSTALL_PREFIX=$PREFIX ..  
make -j$(nproc)  
make install  

## Extract common resources  
cp -rf /project/template_app/* ${PREFIX}/share/  

Note: Manually clear directories before rebuilding since this configuration lacks auto-cleanup.

Local Build Test

Final linglong.yaml:

# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

version: "2"

package:
id: org.qbittorrent.qBittorrent
name: "qBittorrent"
version: 4.6.7.2
kind: app
description: |
  qBittorrent binary

base: org.deepin.foundation/23.0.0
runtime: org.deepin.Runtime/23.0.1

command:
- /opt/apps/org.qbittorrent.qBittorrent/files/bin/qbittorrent

source:
- kind: local
  name: "qBittorrent"

build: |
##Build 3rd libs
mkdir -p ${PREFIX}/bin/ ${PREFIX}/share/
mkdir /project/3rd/libtorrent-rasterbar-2.0.9/build
cd /project/3rd/libtorrent-rasterbar-2.0.9/build
cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=$PREFIX ..
make -j$(nproc)
make install
##Build main
mkdir /project/src/qBittorrent-release-4.6.7-szbt2/build
cd /project/src/qBittorrent-release-4.6.7-szbt2/build
cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_INSTALL_PREFIX=$PREFIX ..
make -j$(nproc)
make install
##Extract common res
cp -rf /project/template_app/* ${PREFIX}/share/

Execute the build:

ziggy@linyaps23:/media/szbt/Data/ll-build/QT/qBittorrent-local$ ll-builder build -v
ziggy@linyaps23:/media/szbt/Data/ll-build/QT/qBittorrent-local$ ll-builder export --layer

Cross-Distribution Testing

Verify compatibility on supported distributions:

deepin 23

openKylin 2.0

Ubuntu 2404

OpenEuler 2403

Conclusion: The Qt5-based qBittorrent application built via Linyaps runs seamlessly across multiple Linux distributions!