Package builder for the cpsi Package Manager
Important
This repository contains an unfinished, experimental implementation of cpsb originally created for Shary OS.
Development has moved to the new CPS Linux ecosystem:
https://github.com/CPS-Linux/cpsbuild
The new build system is not a continuation of this codebase. It is a complete rewrite with a different architecture, package format (.clos), recipe format (.cpsb), repository design, and packaging workflow.
The legacy *.hb format documented in this repository is no longer part of the modern CPS Linux packaging ecosystem.
This repository remains available solely for historical and educational purposes.
| Usage | Description |
|---|---|
cpsb make [FILE] |
Builds assuming the specified file is a *.hb file |
cpsb build |
Generates Blake3Sum for all packages based on *.hb files in the current directory and creates a package list that only cpsi and cpsb can understand |
cpsb version |
Outputs cpsb version information |
cpsb help |
Outputs cpsb help |
Using cpsb make [FILE] builds a package from the specified *.hb file.
The content of *.hb files is a shell script that describes specific functions.
cpsb expects the following functions to exist in *.hb files:
| Function Name | Expected Processing |
|---|---|
| build() | The process to build the package. Build processing must be described using the variables mentioned later |
| package() | Describes the process to install the package to PACKAGE_DIR mentioned later |
| pre_inst() | Processing executed before installing the package. This is executed by the cpsi package manager before installation |
| post_inst() | Processing executed after the package is installed. This is also executed by the cpsi package manager |
| pre_rm() | Processing executed before removing the package. This is also executed on the cpsi package manager side |
| post_rm() | Processing executed after removing the package. This is also executed on the cpsi package manager side |
cpsb also expects the following variables to exist in *.hb files.
All of these variables are required when running cpsb build or cpsb make [FILE], and cpsb will raise an error if they don't exist.
| Variable Name | Information to Fill In |
|---|---|
| NAME | Package name |
| DEPENDS | Packages that this package depends on |
| BUILD_DEPENDS | Dependencies required at build time |
| DESC | Package description |
| LICENSE | Package license |
| SOURCE | Package source code (cpsb downloads the file specified here) |
| VERSION | Package version |
| IS_BUILD | Whether this package is build-only |
Furthermore, cpsb provides the following variables to the shell script when running cpsb make [FILE]:
| Variable Name | Contents | Usage |
|---|---|---|
| PACKAGE_DIR | Directory used for packaging | The *.clos package generated by cpsb is in tar.zstd format. Please install the package to this directory. Compression and packaging are handled by cpsb. |
| BUILD_DIR | Working directory used for building | cpsb does not automatically move to a build-only directory. When extracting source code specified in the SOURCE variable, please use this directory as the extraction destination. If you don't use this, the current working directory may become cluttered.It is recommended to write cd "$BUILD_DIR" at the beginning of the build() function. |
| SOURCE_FILE | Path to the file retrieved from the URL specified in the SOURCE variable |
In most scripts, this file is extracted to BUILD_DIR in the build() function and built, then installed to PACKAGE_DIR in the package() function. |
(hb file for cpsi)
#!/usr/bin/env sh
NAME="cpsi"
DEPENDS=""
BUILD_DEPENDS="curl busybox"
DESC="Package Manager for Shary OS"
LICENSE="BSD-3-Clause License"
VERSION="0.1.0.1.0"
SOURCE="https://github.com/flora-cast/cpsi/archive/refs/tags/${VERSION}.tar.gz"
IS_BUILD="false"
build() {
mkdir -p "${BUILD_DIR}/src"
mkdir -p "${BUILD_DIR}/zig"
tar -xvf "${SOURCE_FILE}" -C "${BUILD_DIR}"
curl -SfL https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz -o "${BUILD_DIR}/zig.tar.xz"
tar -xvf "${BUILD_DIR}/zig.tar.xz" -C "${BUILD_DIR}/zig"
cd "${BUILD_DIR}/cpsi-${VERSION}" && PATH="${BUILD_DIR}/zig/zig-x86_64-linux-0.15.2:$PATH" make
}
package() {
cd "${BUILD_DIR}/cpsi-${VERSION}" && PREFIX="${PACKAGE_DIR}" make install
}
pre_inst() {
:
}
post_inst() {
:
}
pre_rm() {
:
}
post_rm() {
:
}
For detailed usage examples, please refer to the flora-cast official package list core repository.