You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
epel-rpm-macros/macros.epel-rpm-macros

108 lines
5.0 KiB

# epel macros
%epel 8
# Mono macros requested in rhbz 1295117
%mono_arches %{ix86} x86_64 sparc sparcv9 ia64 %{arm} alpha s390x ppc ppc64 ppc64le
%_monodir %{_prefix}/lib/mono
%_monogacdir %{_monodir}/gac
# Bash completions; not in bash to not intefere with install ordering
%bash_completion_dir %{_datadir}/bash-completion/completions/
# Use the non-underscored Python macros to refer to Python in spec, etc.
%python2 %__python2
# This macro is copied here from https://git.centos.org/rpms/python-rpm-macros/pull-request/1
# and is needed for the overrides in macros.zzz-epel-override.
# It will be removed once it lands in RHEL.
# https://bugzilla.redhat.com/show_bug.cgi?id=2090007
#
# RHEL 9+ and Fedora compatibility macro
# Only use in macro backports, not intended to be used in spec files!
# In the future, the %%python3_pkgversion macro has a dot, e.g. 3.9 or 3.11
# However, in RHEL 8 at least, it does not, e.g. 38, 39
# This is a helpful macro that determines the proper "Python version" string with dot
# from %%python3_pkgversion without actually having Python installed.
# For values other than 3X, it should expand to %%python3_pkgversion unchanged.
# Examples of %%python3_pkgversion -> %%_python3_pkgversion_with_dot:
# 3 -> 3
# 38 -> 3.8
# 39 -> 3.9
# 310 -> 3.10
# 3.12 -> 3.12
# 4 -> 4
# 412 -> 412
%_python3_pkgversion_with_dot %{lua:print((rpm.expand("%python3_pkgversion"):gsub('^3(%d)', '3.%1')))}
# Users can use %%python only if they redefined %%__python (e.g. to %%__python3)
%python() %{lua:\
__python = rpm.expand("%__python")\
if __python == "/usr/bin/python" then\
rpm.expand("%{error:Cannot use %%python if %%__python wasn't redefined to something other than /usr/bin/python.}")\
else\
print(__python)\
end\
}
# With $PATH and $PYTHONPATH set to the %%buildroot,
# try to import the given Python module(s).
# Useful as a smoke test in %%check when running tests is not feasible.
# Use spaces or commas as separators.
%py_check_import(e:tf:) %{expand:\\\
%{-e:echo 'WARNING: The -e option of %%%%py_check_import is not currently supported on EPEL.' >&2}
%{-t:echo 'WARNING: The -t option of %%%%py_check_import is not currently supported on EPEL.' >&2}
%{-f:echo 'WARNING: The -f option of %%%%py_check_import is not currently supported on EPEL.' >&2}
(cd %{_topdir} &&\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{__python} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
)
}
%py2_check_import(e:tf:) %{expand:\\\
%{-e:echo 'WARNING: The -e option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
%{-t:echo 'WARNING: The -t option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
%{-f:echo 'WARNING: The -f option of %%%%py2_check_import is not currently supported on EPEL.' >&2}
(cd %{_topdir} &&\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python2_sitearch}:%{buildroot}%{python2_sitelib}}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{__python2} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
)
}
%py3_check_import(e:tf:) %{expand:\\\
%{-e:echo 'WARNING: The -e option of %%%%py3_check_import is not currently supported on EPEL.' >&2}
%{-t:echo 'WARNING: The -t option of %%%%py3_check_import is not currently supported on EPEL.' >&2}
%{-f:echo 'WARNING: The -f option of %%%%py3_check_import is not currently supported on EPEL.' >&2}
(cd %{_topdir} &&\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{__python3} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
)
}
%python_disable_dependency_generator() \
%undefine __pythondist_requires \
%{nil}
# Define where Python wheels will be stored and the prefix of -wheel packages
# - In Fedora we want wheel subpackages named e.g. `python-pip-wheel` that
# install packages into `/usr/share/python-wheels`. Both names are not
# versioned, because they're used by all Python 3 stacks.
# - In RHEL we want wheel packages named e.g. `python3-pip-wheel` and
# `python3.11-pip-wheel` that install packages into similarly versioned
# locations. We want each Python stack in RHEL to have their own wheels,
# because the main python3 wheels (which we can't upgrade) will likely be
# quite old by the time we're adding new alternate Python stacks.
# - In ELN we want to follow Fedora, because builds for ELN and Fedora rawhide
# need to be interoperable.
%python_wheel_pkg_prefix python%{?rhel:%{!?eln:%{python3_pkgversion}}}
%python_wheel_dir %{_datadir}/%{python_wheel_pkg_prefix}-wheels
# qt5 macro removed from RHEL8 but needed to ensure qtwebengine, and
# its dependencies build on supported arches.
%qt5_qtwebengine_arches %{ix86} x86_64 %{arm} aarch64 mips mipsel mips64el