abi-provides: extract/parse the header file only once
Don't depend on grep for bootstrapping issues. Per pull-request #2 discussion.
This commit is contained in:
parent
d21c2b8eb3
commit
45723c7a0a
34
gawk.spec
34
gawk.spec
|
@ -30,15 +30,6 @@
|
|||
# For more info: https://fedoraproject.org/wiki/Packaging:Guidelines#PIE
|
||||
%global _hardened_build 1
|
||||
|
||||
# Extract the API major & minor versions, so we can export them below:
|
||||
%global gawk_api_major %%(tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout | \
|
||||
grep -i -e "gawk_api_major.*[[:digit:]]" | \
|
||||
grep -o -e "[[:digit:]]")
|
||||
|
||||
%global gawk_api_minor %%(tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout | \
|
||||
grep -i -e "gawk_api_minor.*[[:digit:]]" | \
|
||||
grep -o -e "[[:digit:]]")
|
||||
|
||||
# =============================================================================
|
||||
|
||||
Name: gawk
|
||||
|
@ -58,7 +49,17 @@ Source3: LICENSE.BSD
|
|||
Provides: /bin/awk
|
||||
Provides: /bin/gawk
|
||||
|
||||
Provides: gawk(abi) = %{gawk_api_major}.%{gawk_api_minor}
|
||||
# Extraction of API major & minor versions, so we can export them below. Put
|
||||
# this below Source0 definition to have %%SOURCE0 defined.
|
||||
%{expand:%(
|
||||
tar xf %SOURCE0 '*/gawkapi.h' --to-stdout | \
|
||||
while read line; do
|
||||
set -- $line ;
|
||||
[[ $2 =~ gawk_api_.*_version ]] && echo "%%global $2 $3"
|
||||
done
|
||||
)}
|
||||
|
||||
Provides: gawk(abi) = %{gawk_api_major_version}.%{gawk_api_minor_version}
|
||||
|
||||
# Safeguard to allow this package to be installed only on UsrMove enabled
|
||||
# filesystem. More info: https://fedoraproject.org/wiki/Features/UsrMove
|
||||
|
@ -68,7 +69,6 @@ Requires(preun): info
|
|||
|
||||
BuildRequires: ghostscript-core
|
||||
BuildRequires: git
|
||||
BuildRequires: grep
|
||||
|
||||
# Extending GAWK possibilities:
|
||||
BuildRequires: libsigsegv-devel
|
||||
|
@ -227,19 +227,11 @@ install -m 0644 -p doc/gawkinet.{pdf,ps} %{buildroot}%{_docdir}/%{name}
|
|||
install -m 0755 -d %{buildroot}%{_rpmconfigdir}/macros.d
|
||||
|
||||
cat > %{buildroot}%{_rpmconfigdir}/macros.d/macros.gawk << _EOF
|
||||
# Current API version:
|
||||
%%gawk_api_version %{gawk_api_major}.%{gawk_api_minor}
|
||||
%%gawk_api_major %{gawk_api_major}
|
||||
%%gawk_api_minor %{gawk_api_minor}
|
||||
|
||||
# Next major API version which will be incopatible with current API:
|
||||
%%gawk_api_major_next $((%{gawk_api_major} + 1)).0
|
||||
|
||||
# This macro will make sure that your current gawk extension
|
||||
# is build against latest gawk API available in the buildroot:
|
||||
%%gawk_abi_requires \\
|
||||
Requires: gawk(abi) >= %%{gawk_api_version} \\
|
||||
Requires: gawk(abi) < %%{gawk_api_major_next} \\
|
||||
Requires: gawk(abi) >= %gawk_api_major_version.%gawk_api_minor_version \\
|
||||
Requires: gawk(abi) < $(( %gawk_api_major_version + 1 )) \\
|
||||
%%{nil}
|
||||
_EOF
|
||||
|
||||
|
|
Loading…
Reference in New Issue