From 75f39cd4a8067a6f0503c2f1c83c6b1af733a6f2 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 21 Oct 2025 09:48:01 +0000 Subject: [PATCH] add debian package support Signed-off-by: Felix Fietkau --- .gitignore | 11 +++++++++ CMakeLists.txt | 8 ++++++ debian/control | 48 ++++++++++++++++++++++++++++++++++++ debian/copyright | 19 ++++++++++++++ debian/generate-changelog.sh | 15 +++++++++++ debian/libudebug-dev.install | 3 +++ debian/libudebug.install | 1 + debian/lintian-overrides | 1 + debian/rules | 20 +++++++++++++++ debian/source/format | 1 + debian/udebugd.install | 3 +++ 11 files changed, 130 insertions(+) create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/generate-changelog.sh create mode 100644 debian/libudebug-dev.install create mode 100644 debian/libudebug.install create mode 100644 debian/lintian-overrides create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/udebugd.install diff --git a/.gitignore b/.gitignore index a05f812..7acb577 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,14 @@ test-source test-receiver test-pcap install_manifest.txt +obj-* +debian/.debhelper/ +debian/debhelper-build-stamp +debian/*.debhelper.log +debian/*.substvars +debian/files +debian/libudebug/ +debian/libudebug-dev/ +debian/udebugd/ +debian/changelog +debian/tmp/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 856fc2c..207d17a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,3 +43,11 @@ INSTALL(TARGETS udebugd udebug INSTALL(TARGETS ucode_lib LIBRARY DESTINATION lib/ucode ) + +ADD_CUSTOM_TARGET(debian + COMMAND ${CMAKE_COMMAND} -E echo "Generating debian/changelog from git..." + COMMAND ${CMAKE_SOURCE_DIR}/debian/generate-changelog.sh + COMMAND dpkg-buildpackage -b -uc -us + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Building Debian package" +) diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..7196293 --- /dev/null +++ b/debian/control @@ -0,0 +1,48 @@ +Source: udebug +Maintainer: Felix Fietkau +Section: libs +Priority: optional +Standards-Version: 4.5.0 +Rules-Requires-Root: no +Build-Depends: debhelper-compat (= 12), cmake, pkgconf, libubox-dev +Homepage: https://git.openwrt.org/project/udebug.git +Vcs-Browser: https://git.openwrt.org/project/udebug.git +Vcs-Git: https://git.openwrt.org/project/udebug.git + +Package: libudebug +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Section: libs +Description: OpenWrt debug ring buffer library + Libudebug is a debug ring buffer library used by OpenWrt. It provides + facilities for debug message collection, filtering, and export to pcap + format for analysis. + . + This package contains the shared library libudebug. + +Package: libudebug-dev +Architecture: any +Multi-Arch: same +Depends: libudebug (= ${binary:Version}), libc6-dev|libc-dev, libubox-dev, ${misc:Depends} +Section: libdevel +Description: Development files for libudebug + Libudebug is a debug ring buffer library used by OpenWrt. It provides + facilities for debug message collection, filtering, and export to pcap + format for analysis. + . + This package contains the development files (headers and symlinks) + for libudebug. + +Package: udebugd +Architecture: any +Multi-Arch: foreign +Depends: libudebug (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: OpenWrt debug ring buffer daemon and utilities + Libudebug is a debug ring buffer library used by OpenWrt. It provides + facilities for debug message collection, filtering, and export to pcap + format for analysis. + . + This package contains the udebugd daemon, udebug-cli utility, and the + ucode module for accessing debug ring buffers. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..489061d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,19 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: udebug +Source: https://git.openwrt.org/project/udebug.git + +Files: * +Copyright: 2024- Felix Fietkau +License: ISC + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/debian/generate-changelog.sh b/debian/generate-changelog.sh new file mode 100755 index 0000000..762b22f --- /dev/null +++ b/debian/generate-changelog.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +cd "$(dirname "$0")/.." + +COMMIT_DATE=$(git log -1 --format='%cd' --date=format:'%Y%m%d' 2>/dev/null || echo '00000000') +COMMIT_HASH=$(git log -1 --format='%h' 2>/dev/null || echo 'unknown') +COMMIT_TIMESTAMP=$(git log -1 --format='%cd' --date=rfc2822 2>/dev/null || date -R) + +cat > debian/changelog < ${COMMIT_TIMESTAMP} +EOF diff --git a/debian/libudebug-dev.install b/debian/libudebug-dev.install new file mode 100644 index 0000000..5a84cdb --- /dev/null +++ b/debian/libudebug-dev.install @@ -0,0 +1,3 @@ +usr/include/udebug.h +usr/include/udebug-pcap.h +usr/lib/libudebug.so diff --git a/debian/libudebug.install b/debian/libudebug.install new file mode 100644 index 0000000..86f97ac --- /dev/null +++ b/debian/libudebug.install @@ -0,0 +1 @@ +usr/lib/libudebug.so.* diff --git a/debian/lintian-overrides b/debian/lintian-overrides new file mode 100644 index 0000000..7662288 --- /dev/null +++ b/debian/lintian-overrides @@ -0,0 +1 @@ +no-manual-page diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..4b8a112 --- /dev/null +++ b/debian/rules @@ -0,0 +1,20 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +BUILD_DIR = obj-$(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +%: + dh $@ --builddirectory=$(BUILD_DIR) + +override_dh_auto_clean: + dh_auto_clean --builddirectory=$(BUILD_DIR) + rm -rf $(BUILD_DIR) + +override_dh_auto_configure: + cmake -S . -B $(BUILD_DIR) \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DABIVERSION=$(shell dpkg-parsechangelog | sed -rne 's/^Version: 0\.0\.([0-9]+).*$$/\1/p') \ + -DRUNSTATEDIR=/run diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/udebugd.install b/debian/udebugd.install new file mode 100644 index 0000000..e6f0042 --- /dev/null +++ b/debian/udebugd.install @@ -0,0 +1,3 @@ +usr/sbin/udebugd +usr/sbin/udebug +usr/lib/ucode/udebug.so -- 2.30.2