[packages/libpathrs] new

atler atler at pld-linux.org
Sat Jun 27 14:16:54 CEST 2026


commit afbe57e796ca8d2d94526d45ac7ea2d72a1b2da5
Author: Jan Palus <atler at pld-linux.org>
Date:   Sat Jun 27 14:15:45 2026 +0200

    new

 libpathrs.spec | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)
---
diff --git a/libpathrs.spec b/libpathrs.spec
new file mode 100644
index 0000000..30a095f
--- /dev/null
+++ b/libpathrs.spec
@@ -0,0 +1,111 @@
+#
+# Conditional build:
+%bcond_without	static_libs	# static library
+
+Summary:	C-friendly API to make path resolution safer on Linux
+Name:		libpathrs
+Version:	0.2.5
+Release:	1
+License:	MPL v2.0 or LGPL v3.0+
+Group:		Libraries
+Source0:	https://github.com/cyphar/libpathrs/releases/download/v%{version}/%{name}-%{version}.tar.xz
+# Source0-md5:	ce928cfcbbd6442e3f153cace5e8b276
+Source1:	https://github.com/cyphar/libpathrs/releases/download/v%{version}/libpathrs.vendor.tar.zst
+# Source1-md5:	bd3de6993b0a32f3da02ef98bdaf17e6
+URL:		https://github.com/cyphar/libpathrs
+BuildRequires:	cargo
+BuildRequires:	rpmbuild(macros) >= 2.069
+BuildRequires:	rust >= 1.64
+BuildRequires:	tar >= 1:1.31
+BuildRequires:	xz
+BuildRequires:	zstd
+%{?rust_req}
+ExclusiveArch:	%{rust_arches}
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This library implements a set of C-friendly APIs (written in Rust) to
+make path resolution within a potentially-untrusted directory safe on
+GNU/Linux. There are countless examples of security vulnerabilities
+caused by bad handling of paths; this library provides an easy-to-use
+set of VFS APIs to avoid those kinds of issues.
+
+%package devel
+Summary:	Header files for libpathrs
+Group:		Development/Libraries
+Requires:	%{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+Header files for libpathrs.
+
+%package static
+Summary:	Static libpathrs library
+Group:		Development/Libraries
+Requires:	%{name}-devel%{?_isa} = %{version}-%{release}
+
+%description static
+Static libpathrs library.
+
+%prep
+%setup -q -a1
+
+# use our offline registry
+export CARGO_HOME="$(pwd)/.cargo"
+
+mkdir -p "$CARGO_HOME"
+cat >.cargo/config <<EOF
+[source.crates-io]
+registry = 'https://github.com/rust-lang/crates.io-index'
+replace-with = 'vendored-sources'
+
+[source.vendored-sources]
+directory = '$PWD/vendor'
+EOF
+
+%build
+export CARGO_HOME="$(pwd)/.cargo"
+
+%if %{with static_libs}
+export LIBPATHRS_CAPI_BUILDMODE=staticlib
+%cargo_rustc --features capi --crate-type staticlib --frozen
+%endif
+
+export LIBPATHRS_CAPI_BUILDMODE=cdylib
+%cargo_rustc --features capi --crate-type cdylib --frozen
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+./install.sh \
+	DESTDIR="$RPM_BUILD_ROOT" \
+	--prefix="%{_prefix}" \
+	--exec-prefix="%{_exec_prefix}" \
+	--includedir="%{_includedir}" \
+	--libdir="%{_libdir}" \
+	--pkgconfigdir="%{_pkgconfigdir}" \
+	--rust-target=%{rust_target} \
+	%{!?with_static_libs:--disable-static}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post   -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc CHANGELOG.md MAINTAINERS README.md
+%{_libdir}/libpathrs.*.*.*
+%ghost %{_libdir}/libpathrs.so.0
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libpathrs.so
+%{_includedir}/pathrs.h
+%{_pkgconfigdir}/pathrs.pc
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libpathrs.a
+%endif
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libpathrs.git/commitdiff/afbe57e796ca8d2d94526d45ac7ea2d72a1b2da5



More information about the pld-cvs-commit mailing list