Blob Blame History Raw
# epel macros

%epel 7

# 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

# A directory for rpm macros
%rpmmacrodir /usr/lib/rpm/macros.d

# Upstream RPM has this in Fedora, obsoleting the one above.
%_rpmmacrodir /usr/lib/rpm/macros.d

# A directory for appdata metainfo.  The EPEL value differs from that of F28+.
%_metainfodir %{_datadir}/appdata

# EL7 doesn't have macros.vim the vim-filesystem package, so copy the
# Fedora value over to EPEL.
%vimfiles_root %{_datadir}/vim/vimfiles

# Bash completions; not in bash to not intefere with install ordering
%bash_completion_dir /usr/share/bash-completion/completions/

# vpath macros, backported from Fedora
# directory where CMakeLists.txt/meson.build/etc. are placed
%_vpath_srcdir .

# directory (doesn't need to exist) where all generated build files will be placed
%_vpath_builddir %_target_platform

# ldconfig macros, backported from Fedora.
%ldconfig /sbin/ldconfig
%ldconfig_post %{?ldconfig:%post -p %ldconfig}
%ldconfig_postun %{?ldconfig:%postun -p %ldconfig}
%ldconfig_scriptlets(n:) %{?ldconfig:\
%ldconfig_post %{?*} %{-n:-n %{-n*}}\
%ldconfig_postun %{?*} %{-n:-n %{-n*}}\
}

# Various build flag macros, backported from Fedora
%build_cflags   %{optflags}
%build_cxxflags %{optflags}
%build_fflags   %{optflags} -I%{_fmoddir}
%build_ldflags  %{__global_ldflags}

%set_build_flags \
  CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
  FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
  LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS

# This only supports Python 3.5+ and will never work with Python 2.
# Hence, it has no Python version in the name.
%pycached() %{lua:
  path = rpm.expand("%{?*}")
  if (string.sub(path, "-3") ~= ".py") then
    rpm.expand("%{error:%%pycached can only be used with paths explicitly ending with .py}")
  else
    print(path)
    pyminor = path:match("/python3.(%d+)/") or "*"
    if ((pyminor ~= "*") and (tonumber(pyminor) < 5)) then
      rpm.expand("%{error:%%pycached does not support Python 3." .. pyminor .. "}")
    else
      dirname = path:match("(.*/)")
      modulename = path:match(".*/([^/]+).py")
      print("\\n" .. dirname .. "__pycache__/" .. modulename .. ".cpython-3" .. pyminor .. "{,.opt-?}.pyc")
    end
  end
}

# gpgverify verifies signed sources. There is documentation in the script.
%gpgverify %{_rpmconfigdir}/gpgverify

# This was defined in python-srpm-macros
# But it is not since that package got moved to RHEL 7.7+
%python3_other_pkgversion 34

# Use the non-underscored Python macros to refer to Python in spec, etc.
%python2 %__python2
%python3 %__python3

# Backport from 4.15
%_smp_build_ncpus %([ -z "$RPM_BUILD_NCPUS" ] \\\
  && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
  ncpus_max=%{?_smp_ncpus_max}; \\\
  if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
  echo "$RPM_BUILD_NCPUS";)
%_smp_mflags "-j%{_smp_build_ncpus}"