From 137442f560fd8edbb9bc3504c7467214bb47e414 Mon Sep 17 00:00:00 2001 From: Yangtse Su Date: Wed, 14 Oct 2026 22:17:26 +0800 Subject: [PATCH] feat(debian): install rofd-ffi.pc in librofd-ffi-dev Consumers currently have to hardcode the library directory and guess the version: the released ABI has no pkg-config metadata, so e.g. Meson projects carry -Drofd_libdir/-Drofd_includedir by hand and cannot check the version they build against. Ship a rofd-ffi.pc from librofd-ffi-dev. The template is filled in at build time with the Debian version (the release identifier; the Cargo crate version lags the release train) and DEB_HOST_MULTIARCH, and declares Requires: cairo because rofd.h includes (matching the existing libcairo2-dev dependency) and -lrofd_ffi for the linker symlink the package already ships. Verification (on a non-Debian host, so dpkg-buildpackage itself was not run): - recipe indentation checked with cat -A (all recipe lines start with TAB) - substitution and metadata checked by running the same sed with @VERSION@=0.4.3 and @MULTIARCH@=x86_64-linux-gnu: Version: 0.4.3; Requires: cairo; Libs: -L/usr/lib/x86_64-linux-gnu -lrofd_ffi and `pkg-config --libs` yields -L/usr/lib/x86_64-linux-gnu -lrofd_ffi -lcairo - `pkg-config --validate` reports nothing for the generated file --- debian/rofd-ffi.pc.in | 13 +++++++++++++ debian/rules | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 debian/rofd-ffi.pc.in diff --git a/debian/rofd-ffi.pc.in b/debian/rofd-ffi.pc.in new file mode 100644 index 00000000..9e2349b6 --- /dev/null +++ b/debian/rofd-ffi.pc.in @@ -0,0 +1,13 @@ +prefix=/usr +exec_prefix=${prefix} +includedir=${prefix}/include +libdir=${prefix}/lib/@MULTIARCH@ + +Name: rofd-ffi +Description: Stable C ABI for the rofd OFD reader and renderer +URL: https://github.com/linuxdeepin/rofd +Version: @VERSION@ +# rofd.h includes , so consumers need cairo's headers and library +Requires: cairo +Cflags: -I${includedir} +Libs: -L${libdir} -lrofd_ffi diff --git a/debian/rules b/debian/rules index 3984e1b5..0704c0ad 100755 --- a/debian/rules +++ b/debian/rules @@ -11,6 +11,11 @@ export DH_VERBOSE = 1 export CARGO_HOME = $(CURDIR)/debian/.cargo-home export CARGO_NET_OFFLINE = true +# pkg-config metadata reports the Debian version (the release identifier), not +# the Cargo crate version: the crate version lags the release train, and +# consumers compare against it (e.g. dependency('rofd-ffi', version: '>= 0.4.2')). +ROFD_FFI_VERSION = $(shell dpkg-parsechangelog -SVersion) + %: dh $@ @@ -28,6 +33,11 @@ override_dh_auto_install: debian/librofd-ffi0/usr/lib/$(DEB_HOST_MULTIARCH)/librofd_ffi.so.0.4.0 install -D -m0644 crates/rofd-ffi/include/rofd.h \ debian/librofd-ffi-dev/usr/include/rofd.h + install -d debian/librofd-ffi-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig + sed -e 's/@VERSION@/$(ROFD_FFI_VERSION)/' \ + -e 's/@MULTIARCH@/$(DEB_HOST_MULTIARCH)/' \ + debian/rofd-ffi.pc.in \ + > debian/librofd-ffi-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/rofd-ffi.pc dh_link -plibrofd-ffi0 \ usr/lib/$(DEB_HOST_MULTIARCH)/librofd_ffi.so.0.4.0 \ usr/lib/$(DEB_HOST_MULTIARCH)/librofd_ffi.so.0