A standalone tool to generate Linglong (linyaps) .uab packages from CMake, Meson, Autotools, or qmake projects.
The tool generates a linglong.yaml configuration file for your project, then calls ll-builder build and ll-builder export to build the Linglong package.
The tool automatically detects the build system in your project directory:
- CMake —
CMakeLists.txtfound - Meson —
meson.buildfound - Autotools —
configure.ac,configure.in, orautogen.shfound - qmake —
.profile found
It generates appropriate default build commands for each build system.
ll-builder(fromlinglong-builderpackage)libyaml-cpp0.7(YAML generation and parsing)libcli11-dev(command-line argument parsing)nlohmann-json3-dev(JSON parsing)- CMake 3.16+, C++17 compiler
sudo apt install libyaml-cpp-dev libcli11-dev nlohmann-json3-dev cmake linglong-buildercmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
sudo cmake --build build --target installcd /path/to/your/project
# 1. Interactive configuration (default): you will be prompted for each setting
# Detected build tool, default build commands, and existing config (if any)
# will be shown. Press Enter to accept defaults.
linglong-build-tool init
# 2. Build the linglong package
linglong-build-tool pack# Generate linglong.yaml with default settings (no prompts)
linglong-build-tool init --default# Initialize from a JSON configuration file
linglong-build-tool init --config myconfig.jsonThe tool scans your project directory for build system files and generates appropriate default build commands:
| Build System | Detection File | Default Build Commands |
|---|---|---|
| CMake | CMakeLists.txt |
rm -rf build, cmake -B build, cmake --build build -j$(nproc), cmake --build build --target install |
| Meson | meson.build |
meson setup build, meson compile -C build, meson install -C build |
| Autotools | configure.ac / configure.in / autogen.sh |
./autogen.sh --prefix=$PREFIX, make -j$(nproc), make install |
| qmake | *.pro |
qmake -r .., make -j$(nproc), make install |
| Unknown | None of the above | Prompts user to enter custom build commands |
When the detected build tool is Meson, the tool automatically adds meson to build_depends in the generated linglong.yaml, since Meson is not pre-installed in the build container.
linglong-build-tool pack --build-only # build only, skip export
linglong-build-tool pack --export-only # export only, skip buildlinglong-build-tool pack -o /path/to/output.uablinglong-build-tool pack --architecture loongarch64| Option | Description | Default |
|---|---|---|
--default |
Initialize with default values without interactive prompts. | Off |
--config <path> |
Load configuration from a JSON file. | Off |
When run without options, the tool enters interactive mode. It displays all configurable parameters with their current values (loaded from an existing linglong.yaml if present, otherwise from defaults). Press Enter to accept a value, or type a new value. For fields like runtime, you will be asked whether to configure it first.
Parse and resolve build dependencies from CMakeLists.txt or meson.build files.
| Subcommand | Description |
|---|---|
check |
Parse dependencies and display APT package resolution results |
apply |
Resolve dependencies and write to linglong.yaml buildext section |
| Option | Description | Default |
|---|---|---|
--build-file <path> |
Path to build file (CMakeLists.txt or meson.build). Auto-detects if not specified. | Auto |
--format json|table |
Output format (for check subcommand). |
table |
--dry-run |
Preview changes without writing (for apply subcommand). |
Off |
- rosdep base.yaml — Community-maintained mapping of 1000+ packages (bundled snapshot)
- libapt-pkg-dev — APT cache C++ API fallback (read-only, no root required)
- Heuristic —
lib<name>-devguess for unknown packages
# Check dependencies from CMakeLists.txt
linglong-build-tool deps check --build-file CMakeLists.txt
# Check dependencies in JSON format
linglong-build-tool deps check --build-file CMakeLists.txt --format json
# Auto-detect build file and check dependencies
linglong-build-tool deps check
# Resolve and write to linglong.yaml
linglong-build-tool deps apply --build-file CMakeLists.txt
# Preview resolution without writing
linglong-build-tool deps apply --build-file CMakeLists.txt --dry-run| Option | Description | Default |
|---|---|---|
--build-only |
Only run ll-builder build, skip export. Use for debugging the build process. |
Off |
--export-only |
Only run ll-builder export, skip build. Requires a previous successful build. |
Off |
-o, --output <path> |
Output .uab file path. Defaults to {id}_{version}_{arch}.uab in the project directory. |
Auto |
--architecture <arch> |
Override architecture detection. | Auto-detected |
| Option | Description | Default |
|---|---|---|
-C, --directory <path> |
Working directory (project root). Defaults to the current directory. | . |
-v, --verbose |
Verbose output. Prints more debug information. | Off |
-h, --help |
Print help and exit. | - |
--version |
Print version and exit. | - |
The tool generates linglong.yaml directly in the project directory. The configuration is obtained through:
- Interactive mode (default) — prompts for each field, with defaults pre-filled from an existing
linglong.yaml(if present) or from built-in defaults. --defaultmode — generateslinglong.yamlwith built-in defaults, no interaction.--config <file>mode — reads configuration from a JSON file, then generateslinglong.yaml.
When using --config <path>, the JSON file should follow this structure:
{
"package_id": "org.example.app",
"package_version": "1.0.0.0",
"package_name": "app",
"package_description": "A demo app",
"base": "org.deepin.base/25.2.2",
"command": "app",
"runtime": "",
"build_depends": [],
"depends": [],
"build_commands": [
"rm -rf build || true",
"cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX}",
"cmake --build build -j$(nproc)",
"cmake --build build --target install"
],
"architecture": "x86_64",
"channel": "main"
}| Field | Required | Description |
|---|---|---|
package_id |
Yes | Package ID, reverse domain notation (e.g. org.example.app) |
package_version |
Yes | Version string, auto-padded to 4 parts (e.g. 1.0 -> 1.0.0.0) |
base |
Yes | Base environment, e.g. org.deepin.base/25.2.2 |
command |
app kind | Startup command for the application |
package_name |
No | Package name (defaults to package_id) |
package_kind |
No | Package kind, currently only app |
package_description |
No | Description text (defaults to package_name) |
runtime |
No | Runtime environment (optional, user chooses whether to configure) |
build_depends |
No | Build dependencies list (auto-populated for Meson) |
depends |
No | Runtime dependencies list |
build_commands |
No | Custom build commands (auto-detected based on build tool) |
architecture |
No | Target architecture (auto-detected via uname()) |
channel |
No | Distribution channel (defaults to main) |
linglong_build_tool/
├── CMakeLists.txt # Build file
├── LICENSE -> LICENSES/LGPL-3.0-or-later.txt
├── LICENSES/
│ └── LGPL-3.0-or-later.txt # LGPL-3.0 license
├── debian/ # Debian packaging
│ ├── changelog
│ ├── control
│ ├── copyright
│ ├── rules
│ ├── watch
│ └── source/
├── data/
│ └── rosdep-base.yaml # Rosdep dependency mapping snapshot
├── src/ # C++ source code
│ ├── main.cpp # Entry point, CLI parsing
│ ├── config.h # LinglongConfig struct
│ ├── config_reader.cpp/.h # JSON config reader/writer
│ ├── utils.h/.cpp # Utility functions (architecture detection,
│ │ # version normalization, build tool detection,
│ │ # default build commands/depends)
│ ├── yaml_generator.cpp/.h # linglong.yaml generator
│ ├── ll_builder.cpp/.h # ll-builder wrapper
│ ├── deps_parser.cpp/.h # CMake/Meson dependency parser
│ ├── deps_resolver.cpp/.h # Three-layer dependency resolver
│ ├── deps_command.cpp/.h # --deps command
│ ├── init_command.cpp/.h # --init command
│ └── pack_command.cpp/.h # --pack command
├── scripts/
│ ├── linglong-build-tool-completion.bash # Bash completion
│ ├── _linglong-build-tool # Zsh completion
│ ├── linglong-build-tool.fish # Fish completion
│ └── linglong-pack.sh # Fallback shell script
└── tests/ # Unit tests
├── CMakeLists.txt
├── test_config_reader.cpp
├── test_yaml_generator.cpp
└── test_ll_builder.cpp
cd build && ctest