add tcl.attr to generate 'tcl(abi)' requires automatically

This commit is contained in:
Funda Wang
2025-08-02 02:34:28 +08:00
parent 812103e7f6
commit 6b6b6a62f8
2 changed files with 26 additions and 1 deletions

19
tcl.attr Normal file
View File

@@ -0,0 +1,19 @@
%__tcl_path ^(%{_datadir}|%{_libdir})/tcl[[:digit:]]+\\.[[:digit:]]+/.+
%__tcl_requires() %{lua:
-- Match buildroot paths of the form
-- /PATH/OF/BUILDROOT/usr/lib(64)/tclMAJOR.MINOR/ and
-- /PATH/OF/BUILDROOT/usr/share/tclMAJOR.MINOR/
-- generating a line of the form:
-- tcl(abi) = MAJOR.MINOR
local path = rpm.expand('%1')
local datadir = rpm.expand('%_datadir')
local libdir = rpm.expand('%_libdir')
for i, dir in ipairs({datadir, libdir}) do
if path:match(dir .. '/tcl%d+%.%d+/.*') then
local requires = path:gsub('.*' .. dir .. '/tcl(%d+%.%d+)/.*', 'tcl(abi) = %1')
print(requires)
break
end
end
}

View File

@@ -2,13 +2,14 @@
Name: tcl
Version: 8.6.16
Release: 1
Release: 2
Epoch: 1
Summary: The Tool Command Language implementation
License: TCL AND GPL-3.0-or-later WITH bison-exception-2.2 AND BSD-3-Clause
URL: https://sourceforge.net/projects/tcl/
Source0: https://downloads.sourceforge.net/sourceforge/tcl/tcl-core%{version}-src.tar.gz
Source1: macros.tcl
Source2: tcl.attr
BuildRequires: autoconf zlib-devel systemtap-sdt-devel gcc
Provides: tcl(abi) = %{MAJOR}
@@ -90,6 +91,7 @@ sed -i -e "s|$PWD/unix|%{_libdir}|; s|$PWD|%{_includedir}/%{name}-private|" %{bu
rm -rf %{buildroot}/%{_datadir}/%{name}%{MAJOR}/ldAix
install -D -m644 %{S:1} %{buildroot}%{_rpmmacrodir}/macros.tcl
install -D -m644 %{S:2} %{buildroot}%{_fileattrsdir}/tcl.attr
%check
pushd unix
@@ -106,6 +108,7 @@ popd
%{_libdir}/lib%{name}%{MAJOR}.so
%exclude %{_datadir}/%{name}%{MAJOR}/tclAppInit.c
%{_rpmmacrodir}/macros.tcl
%{_fileattrsdir}/tcl.attr
%files devel
%{_includedir}/*
@@ -121,6 +124,9 @@ popd
%{_mandir}/man?/*
%changelog
* Sat Aug 02 2025 Funda Wang <fundawang@yeah.net> - 1:8.6.16-2
- add tcl.attr to generate 'tcl(abi)' requires automatically
* Wed Dec 25 2024 Funda Wang <fundawang@yeah.net> - 1:8.6.16-1
- update to 8.6.16