From fd577c0f5e4630f65ee66a1ebc10bee18883028c Mon Sep 17 00:00:00 2001 From: VPRamon Date: Fri, 8 May 2026 18:46:28 +0200 Subject: [PATCH 1/2] fix: advance tempoch submodule (unix param rename) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tempoch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tempoch b/tempoch index 6ab45db..524148f 160000 --- a/tempoch +++ b/tempoch @@ -1 +1 @@ -Subproject commit 6ab45db71bee9d2047d180bab15f55fe3ed0c73c +Subproject commit 524148f4be204592ac806ce5b33a140c53cdd287 From e409002c9d5602aa86ef38360c03443db9f90ac4 Mon Sep 17 00:00:00 2001 From: VPRamon Date: Fri, 8 May 2026 19:05:33 +0200 Subject: [PATCH 2/2] feat: add CPack configuration for DEB and RPM packaging; update README with deployment instructions --- .github/workflows/ci.yml | 125 ++++++++++++++++++++++++++++++++++++++- CMakeLists.txt | 33 +++++++++++ README.md | 54 +++++++++++++++++ qtty-cpp | 2 +- 4 files changed, 212 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73d5acb..02fa0b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ concurrency: cancel-in-progress: true permissions: - contents: read + contents: write checks: write pull-requests: write @@ -256,3 +256,126 @@ jobs: - name: Publish to Job Summary shell: bash run: cat code-coverage-results.md >> "$GITHUB_STEP_SUMMARY" + + # --------------------------------------------------------------------------- + # Package: build .deb and .rpm via CPack + # --------------------------------------------------------------------------- + package: + name: Package (DEB + RPM) + needs: build-test-docs + runs-on: ubuntu-22.04 + env: + CARGO_TERM_COLOR: always + CMAKE_BUILD_PARALLEL_LEVEL: 2 + steps: + - name: Checkout (with submodules) + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Install system dependencies + shell: bash + run: | + set -euo pipefail + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + ninja-build \ + pkg-config \ + rpm + + - name: Set up Rust (stable) + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + + - name: Cache cargo + build artifacts + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + tempoch/target + tempoch/tempoch-ffi/target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Configure (CMake, Release) + shell: bash + run: | + set -euo pipefail + cmake -S . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DTEMPOCH_BUILD_DOCS=OFF + + - name: Build + shell: bash + run: cmake --build build --target test_tempoch + + - name: Install to staging prefix + shell: bash + run: cmake --install build --prefix build/staging + + - name: Copy shared libraries to staging + shell: bash + run: | + set -euo pipefail + mkdir -p build/staging/lib + cp tempoch/tempoch-ffi/target/release/libtempoch_ffi.so \ + build/staging/lib/ || true + + - name: Generate packages (CPack) + shell: bash + run: | + set -euo pipefail + cd build + cpack --config CPackConfig.cmake -G "DEB;RPM" -B packages + ls -lh packages/ + + - name: Upload DEB package + uses: actions/upload-artifact@v4 + with: + name: tempoch-cpp-deb + path: build/packages/*.deb + retention-days: 30 + + - name: Upload RPM package + uses: actions/upload-artifact@v4 + with: + name: tempoch-cpp-rpm + path: build/packages/*.rpm + retention-days: 30 + + # --------------------------------------------------------------------------- + # Release: create GitHub Release and attach packages (tag pushes only) + # --------------------------------------------------------------------------- + release: + name: GitHub Release + needs: package + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - name: Download DEB artifact + uses: actions/download-artifact@v4 + with: + name: tempoch-cpp-deb + path: dist/ + + - name: Download RPM artifact + uses: actions/download-artifact@v4 + with: + name: tempoch-cpp-rpm + path: dist/ + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: dist/* + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 81d43c8..8b44584 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,3 +233,36 @@ install(EXPORT tempoch_cppTargets NAMESPACE tempoch:: DESTINATION lib/cmake/tempoch_cpp ) + +# --------------------------------------------------------------------------- +# Packaging (CPack — DEB and RPM) +# --------------------------------------------------------------------------- +set(CPACK_PACKAGE_NAME "tempoch-cpp") +set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") +set(CPACK_PACKAGE_VENDOR "Siderust") +set(CPACK_PACKAGE_CONTACT "VPRamon ") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "C++ wrapper for the tempoch astronomical time library") +set(CPACK_PACKAGE_DESCRIPTION + "tempoch-cpp provides a header-only C++17 API over the tempoch Rust\n" + "time library via the tempoch-ffi C ABI. It bundles the pre-built\n" + "shared library (tempoch_ffi) together with the C++ headers and CMake\n" + "package config.") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/Siderust/tempoch-cpp") + +# -- DEB ----------------------------------------------------------------------- +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "VPRamon ") +set(CPACK_DEBIAN_PACKAGE_SECTION "libs") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.17), libstdc++6 (>= 9)") +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) + +# -- RPM ----------------------------------------------------------------------- +set(CPACK_RPM_PACKAGE_LICENSE "AGPL-3.0") +set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries") +set(CPACK_RPM_PACKAGE_REQUIRES "glibc >= 2.17, libstdc++ >= 9") +set(CPACK_RPM_FILE_NAME RPM-DEFAULT) + +set(CPACK_GENERATOR "DEB;RPM") + +include(CPack) diff --git a/README.md b/README.md index acb3471..53b3d1a 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,60 @@ find_package(tempoch_cpp REQUIRED) target_link_libraries(your_target PRIVATE tempoch::tempoch_cpp) ``` +## Deployment + +Packages for Debian/Ubuntu (`.deb`) and RHEL/Fedora/openSUSE (`.rpm`) are built +with CPack. + +### Prerequisites + +```bash +# Debian/Ubuntu +sudo apt-get install cmake ninja-build rpm + +# RHEL/Fedora +sudo dnf install cmake ninja-build dpkg +``` + +### Build the packages + +```bash +git clone --recurse-submodules +cd tempoch-cpp + +cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DTEMPOCH_BUILD_DOCS=OFF +cmake --build build --parallel + +# Install headers + cmake config to a staging prefix +cmake --install build --prefix build/staging + +# Generate .deb and .rpm in build/packages/ +cd build +cpack --config CPackConfig.cmake -G "DEB;RPM" -B packages +ls packages/ +``` + +### Install on the target system + +```bash +# Debian/Ubuntu +sudo dpkg -i packages/tempoch-cpp-*.deb + +# RHEL/Fedora/openSUSE +sudo rpm -i packages/tempoch-cpp-*.rpm +``` + +After installation, headers land in `/usr/local/include/tempoch/` and the +shared library in `/usr/local/lib/`. CMake consumers can then use: + +```cmake +find_package(tempoch_cpp REQUIRED) +target_link_libraries(your_target PRIVATE tempoch::tempoch_cpp) +``` + +> **Note:** Pre-built `.deb` and `.rpm` packages are also automatically attached +> to every [GitHub Release](https://github.com/Siderust/tempoch-cpp/releases). + ## License This repository wraps the upstream `tempoch` project (git submodule in `tempoch/`). See `tempoch/LICENSE` for licensing details. diff --git a/qtty-cpp b/qtty-cpp index fb9dd8f..2906a4a 160000 --- a/qtty-cpp +++ b/qtty-cpp @@ -1 +1 @@ -Subproject commit fb9dd8f0fa513b5ee37a594c10e6516819e83812 +Subproject commit 2906a4a93ba515633924483e55462d9cde2efad5