%distribution ROSA
%vendor ROSA
%bugurl http://bugzilla.rosalinux.ru
%disturl https://rosalinux.ru

# Disable automatic dependencies on parent directory and symlinks for now
%_check_symlink_deps 0
%_check_dirname_deps 0

%_srcdefattr (644,root,root)

%_docdir_fmt %%{NAME}

# automatic truncation of changelogs to 3 years
%_changelog_trimtime %{lua:print(os.time() - 3 * 365 * 86400)}

# mdvbz#64914
%_rpmgio .ufdio
%_rpmhome %getconfdir

%__urlgetfile(url, dest) wget %1 -O %2 || (rm -f %2 && exit 1)

# This will die as soon as remaining usage has been phased out...
%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}

# For the built rpm filename format...
%disttag %{!?distsuffix:rosa}%{?distsuffix}%{!?distrelease:%(sh -c '. /etc/os-release; echo \$VERSION_ID')}%{?distrelease}

# The output binary package file name template used when building binary packages.
# XXX: Note: escaped %% for use in headerSprintf()
%_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}-%%{DISTTAG}.%%{ARCH}.rpm

# Dynamic EVRD tags macro for use with versioned provides/requires in place of
# '%{version}-%{release}', ie. to automatically add distepoch or epoch if present
# Using uppercase letters here to use global epoch/version/release (of the SRPM, not of a specific subpackage)
# https://github.com/rpm-software-management/rpm/issues/1745
%EVRD %{?EPOCH:%{EPOCH}:}%{?VERSION:%{VERSION}}%{?RELEASE:-%{RELEASE}}

%rename() \
Obsoletes:	%{1} < %{?2}%{!?2:%{EVRD}} \
Provides:	%{1} = %{?2}%{!?2:%{EVRD}} \

%_default_patch_flags -U
%_default_patch_fuzz 0

%make %make_build

%makeinstall_std %make_install

%makeinstall_qt	make INSTALL_ROOT=%{?buildroot:%{buildroot}} install STRIP=true

%apply_patches %{autopatch -p1}

%__lua %{_bindir}/lua
%__rc %{_bindir}/rc
%__xar %{_bindir}/xar

# mdvbz#61851
%__tar_wildcards --wildcards

%_loop_detection_loglevel 4

%_logdir %{_localstatedir}/log
%_localedir %{_datadir}/locale

%_fmoddir %{_libdir}/gfortran/modules

# https://nixtux.ru/819
# use multithreaded XZ to compress binary packages
%_binary_payload w6T.xzdio
# compress source packages with level 2 xz because they usually
# contain already compressed tarballs
%_source_payload w2T.xzdio

# Use SHA-256 for FILEDIGESTS instead of default MD5
%_source_filedigest_algorithm 8
%_binary_filedigest_algorithm 8

%_duplicate_files_terminate_build 1

%_build_pkgcheck_set /usr/bin/rpmlint -f %{_sourcedir}/%{name}.rpmlintrc
%_build_pkgcheck_srpm /usr/bin/rpmlint -f %{_sourcedir}/%{name}.rpmlintrc
%_nonzero_exit_pkgcheck_terminate_build 1

%source_date_epoch_from_changelog 1

%_enable_debug_packages 1

# Default extension to use (for man & info files)
%_extension .xz
%_compress xz -0f --text -T0

# Macro: %{mklibname <name> [<major> [<minor>]] [-s] [-d]}
# - %{mklibname test}               => lib64test, on a lib64 platform
# - %{mklibname test 1 -d}      => libtest1-devel
# - %{mklibname test 1 -d 0 -s} => libtest1_0-static-devel
%mklibname(ds) %(echo "%{_lib}%{1}%{!-d:%(if echo %{1} | rev | cut -b1 | grep -q '[0-9]'; then echo -n _; fi)}%{?2:%{2}}%{?3:_%{3}}%{-s:-static}%{-d:-devel}" | sed -e 's,__,_,g' -e 's,_$,,g')

#==============================================================================
# ---- compiler flags.

# C compiler flags.  This is traditionally called CFLAGS in makefiles.
# Historically also available as %%{optflags}, and %%build sets the
# environment variable RPM_OPT_FLAGS to this value.
%build_cflags %{optflags}

# C++ compiler flags.  This is traditionally called CXXFLAGS in makefiles.
%build_cxxflags %{optflags}

# Fortran compiler flags.  Makefiles use both FFLAGS and FCFLAGS as
# the corresponding variable names.
%build_fflags %{optflags} -I%{_fmoddir}

%ldflags %{optflags} -Wl,-O2 %{?!_disable_ld_no_undefined: -Wl,--no-undefined} %{?!_disable_lto:-flto} %{?_hardened_flags}
%build_ldflags %{ldflags}

# LTO doesn't seem to work reliably at the moment...
%_disable_lto 1

# Deprecated names.  For backwards compatibility only.
%__global_cflags %{build_cflags}
%__global_cxxflags %{build_cxxflags}
%__global_fflags %{build_fflags}
%__global_fcflags %{build_fflags}
%__global_ldflags %{build_ldflags}

%set_build_flags \
  CC="${CC:-%__cc}" ; export CC ; \
  CXX="${CXX:-%__cxx}" ; export CXX ; \
  CFLAGS="${CFLAGS:-%build_cflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%build_cxxflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%build_fflags}" ; export FFLAGS ; \
  FCFLAGS="${FCFLAGS:-%build_fflags}" ; export FCFLAGS ; \
  %{?build_ldflags:LDFLAGS="${LDFLAGS:-%{build_ldflags}}"; export LDFLAGS ;} \
%if %{cross_compiling} \
    PKG_CONFIG_PATH=/usr/%{_target_platform}/sys-root%{_libdir}/pkgconfig:/usr/%{_target_platform}/sys-root%{_datadir}/pkgconfig:%{_libdir}/pkgconfig:%{_datadir}/pkgconfig:$PKG_CONFIG_PATH; export PKG_CONFIG_PATH; \
%ifnarch noarch \
    CROSSCOMPILE="%{?!noconftarget:--target=%{_target_platform}} %{?!noconfhost:--host=%{_target_platform}} %{?!noconfbuild:--build=%{_build}}" ; \
%endif \
%else \
%ifnarch noarch \
    CROSSCOMPILE="%{?!noconftarget:--target=%{_target_platform}} %{?!noconfbuild:--build=%{_target_platform}}" ; \
%endif \
%endif \
  %{?cross:CROSSCOMPILE="%{?!noconftarget:--target=%{cross}} %{?!noconfhost:--host=%{_target_platform}} %{?!noconfbuild:--build=%{_build}}" ; } \
  export CROSSCOMPILE ; \
  %{nil}

%setup_compile_flags %set_build_flags

%debugcflags %{?_enable_debug_packages:-gdwarf-4 -Wstrict-aliasing=2}

# common compilation flags

%_fortify_cflags -D_FORTIFY_SOURCE=2

# Enable -fPIC by default (as it was in ROSA/Mandriva's RPM5
# to avoid problems when an -fPIC-enabled shared object is linked against a static non-fPIC library,
# e.g. Heimdal sets -fPIC itself and tries to link against a static libcrypt.a
# https://wiki.gentoo.org/wiki/Project:AMD64/Fixing_-fPIC_Errors_Guide
%_fpic_cflags -fPIC

# cf http://wiki.mandriva.com/en/Development/Packaging/Problems#format_not_a_string_literal_and_no_format_arguments
%Werror_cflags -Wformat -Werror=format-security

%_ssp_cflags -fstack-protector-strong --param=ssp-buffer-size=4%{?_serverbuild_flags: %_serverbuild_flags}
%__common_cflags -O2 -fomit-frame-pointer %{debugcflags} -pipe %{Werror_cflags} %{?_fortify_cflags} %{?_fpic_cflags}
%__common_cflags_with_ssp %{__common_cflags} %{?_ssp_cflags}

# Servers opt flags.
# Also set the env variables for backward compatibility (#32050).
%serverbuild %define _serverbuild_flags -fstack-protector-all \
export CFLAGS="%{optflags}"; export CXXFLAGS="%{optflags}"; export RPM_OPT_FLAGS="%{optflags}" \
%{nil}

# Hardened Servers opt flags.
%serverbuild_hardened %define _hardened_flags -Wl,-z,now -pie \
%serverbuild \
export CFLAGS="%{optflags} -fPIE"; export CXXFLAGS="%{optflags} -fPIE"; export RPM_OPT_FLAGS="%{optflags} -fPIE" \
%{nil}

# Include minimal debug information in build binaries.
# Requires _enable_debug_packages.
#
%_enable_debug_packages 1
%_include_minidebuginfo 1
%_include_gdb_index     1
%_debugsource_packages  1
%_debuginfo_subpackages 1
# Put build ID files into debug packages to save some space and FS cluttering
# on normal systems. The problem Fedora tried to solve by putting the build ID
# files into the main package (coinstallability for debuginfo packages on symbol server)
# doesn't apply to us because we cannot run a debug symbol server.
%_build_id_links alldebug

#==============================================================================
# ---- GPG/PGP/PGP5 signature macros.
#	Macro(s) to hold the arguments passed to GPG/PGP for package
#	signing and verification.
#

#	Verify digest/signature flags for various rpm modes:
#	0x30300 (_RPMVSF_NODIGESTS)    --nohdrchk      if set, don't check digest(s)
#	0xc0c00 (_RPMVSF_NOSIGNATURES) --nosignature   if set, don't check signature(s)
#	0xf0000 (_RPMVSF_NOPAYLOAD)    --nolegacy      if set, check header+payload (if possible)
#	0x00f00 (_RPMVSF_NOHEADER)     --nohdrchk      if set, don't check rpmdb headers
%_vsflags_query 0xc0c00

# enable nofsync when rebuilding rpmdb
%__dbi_rebuild nofsync

#	Open all indices before doing chroot(2).
#
%_openall_before_chroot	1

%_repackage_all_erasures 0

# activate filetriggers (cf http://wiki.mandriva.com/en/Rpm_filetriggers)
%_filetriggers_dir /var/lib/rpm/filetriggers

%_sys_macros_dir %{_sysconfdir}/rpm/macros.d
%build_sysmacrospath() %{_sys_macros_dir}/%{?1:%{1}}%{?!1:%{name}}.macros

# when %_with_git_repository is set, these macros modify the behaviour of "%prep" step:
%_after_setup %{?_with_git_repository:GIT_URL="%{?git_url}" GIT_REPOSITORY_CACHE=%{?git_repository_cache} /usr/lib/rpm/git-repository--after-tarball}
%_patch %{?_with_git_repository:PKG_NAME=%{name} /usr/lib/rpm/git-repository--apply-patch}%{?!_with_git_repository:%__patch --fuzz=%{_default_patch_fuzz} %{_default_patch_flags}}

# used by "git-repository--after-tarball":
%git_repository_cache %{_topdir}/%{name}.git

# Various programs used in rpm scripts
%_update_desktop_database_bin %{_bindir}/update-desktop-database
%_update_mime_database_bin %{_bindir}/update-mime-database
%_update_icon_cache_bin %{_bindir}/gtk-update-icon-cache
%_gconftool_bin %{_bindir}/gconftool-2
%_scrollkeeper_bin %{_bindir}/scrollkeeper-update

#==============================================================================
# ---- Required rpmrc macros.
#	Macros that used to be initialized as a side effect of rpmrc parsing.
#	These are the default values that can be overridden by other
#	(e.g. per-platform, per-system, per-packager, per-package) macros.
#

%_arch_tag_suffix %([ "%{?_lib}" = "lib64" ] && echo "()(64bit)")
%arch_tagged() %{1}%{_arch_tag_suffix} %{?2:%{2} %{3}%{?!3:%{error:undefined 3rd argument in arch_tagged}}}

# Games macros
%_gamesdir	games
%_gamesbindir   %{_prefix}/%{_gamesdir}
%_gamesdatadir  %{_datadir}/%{_gamesdir}

# Icon directories
%_iconsdir %{_datadir}/icons
%_miconsdir %{_datadir}/icons/mini
%_liconsdir %{_datadir}/icons/large

%_xfontdir %_datadir/fonts

%_webconfdir %{_sysconfdir}/httpd/conf
%_webappconfdir %_webconfdir/webapps.d

# For Appdata metainfo
%_metainfodir %{_datadir}/metainfo

# For backwards compatibility
%_appdatadir %{_metainfodir}

#==============================================================================
# ---- Build configuration macros.
#
# Use internal dependency generator rather than external helpers?
%_use_internal_dependency_generator	1

# Update Window Managers session.
%_fndsession_bin %{_sbindir}/fndSession
%make_session %{nil}
%make_dm_session if [ -x %{_fndsession_bin} ]; then %{_fndsession_bin} || true ; fi \
%{nil}

# Rebuild icon cache
%update_icon_cache() if [ -x %{_update_icon_cache_bin} ]; then \
%{_update_icon_cache_bin} --force --quiet %{_iconsdir}/%{1} || true; fi \
%{nil}

%clean_icon_cache() if [ -x %{_update_icon_cache_bin} -a -r %{_iconsdir}/%{1}/index.theme ]; then \
%{_update_icon_cache_bin} --force --quiet %{_iconsdir}/%{1} || true ; fi \
%{nil}

# GConf schemas:
# installation is handled by filetriggers
%post_install_gconf_schemas() %{nil}
# but uninstall still need to be done in %preun:
%preun_uninstall_gconf_schemas() if [ "$1" = "0" -a -x %{_gconftool_bin} ]; then \
SCHEMAS="" \
for SCHEMA in %{*} ; do \
  SCHEMAS="$SCHEMAS %{_sysconfdir}/gconf/schemas/$SCHEMA.schemas" \
done \
GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} --makefile-uninstall-rule  $SCHEMAS > /dev/null || true ; fi \
%{nil}

# Mandriva Linux version
# - "9.1"    =>  910
# - "10.2.2" => 1022
# (user may copy the following line in specfile)
%mdkversion		%(cat /etc/os-release|grep VERSION_ID= |sed -e 's,.*=,,;s,\",,g;s,\\.,0,g')


#---------------------------------------------------------------------
#       Expanded at beginning of %install scriptlet.
#

%__spec_install_pre \
%{___build_pre}\
if [ %{_with install} -eq 1 ]; then\
    [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
    mkdir -p `dirname "$RPM_BUILD_ROOT"`\
    mkdir "$RPM_BUILD_ROOT"\
fi

#==============================================================================
# ---- Build policy macros.
#
#---------------------------------------------------------------------
#   Expanded at end of %install scriptlet.
#

%__os_install_post    \
    %{?__spec_helper_post}%{?!__spec_helper_post:/usr/share/spec-helper/spec-helper} \
    [ %{?_python_bytecompile_build} -eq 1 ] && %{__brp_python_bytecompile} \
    %{!?__brp_python_hardlink:/usr/lib/rpm/brp-python-hardlink} \
%{nil}

%__os_stringbuf_post    \
    %{?__spec_helper_stringbuf_post} \
%{nil}

#==============================================================================
# ---- specfile macros.
#	Macro(s) here can be used reliably for reproducible builds.
#	(Note: Above is the goal, below are the macros under development)
#

%__libtoolize_configure %{?__libtoolize:(cd $CONFIGURE_TOP; [ ! -f configure.in -a ! -f configure.ac ] || %{__libtoolize} --copy --force)}

%config_update \
  find . -name config.guess -o -name config.sub | while read i ; do \
           [ -f /usr/share/libtool/config/"$(basename \"$i\")" ] && /bin/rm -f "$i" && /bin/cp -fv /usr/share/libtool/config/"$(basename \"$i\")" "$i" ; \
  done ; \
  %{!?_disable_rebuild_configure:if [ -e configure.ac -a -e Makefile.am ]; then \
    find . -name configure.ac |xargs dirname |while read D; do \
      pushd $D; \
      if grep -qE '(LT_INIT|LIBTOOL)' configure.ac >/dev/null; then \
        libtoolize --force ; \
      fi ; \
      aclocal $((find . -name "*.m4" 2>/dev/null |grep -vE 'ac(local|include).m4' | xargs dirname) | grep -v '^\.$' |sort |uniq |cut -d/ -f2- |while read R; do [ -e $R/configure.ac ] || echo -n "-I$R "; done) ; \
      automake -a --foreign ; \
      autoconf ; \
      popd ; \
    done ; \
  fi ;} \
  %{nil}

%before_configure \
  %config_update \
  %set_build_flags \
  CONFIGURE_TOP="${CONFIGURE_TOP:-.}"

# This is an improved version of %configure (from PLD team).
%configure \
  %before_configure ; \
  %{?_enable_libtoolize:%{?__libtoolize_configure:%{__libtoolize_configure};}} \
  [ -f $CONFIGURE_TOP/configure.in -o -f $CONFIGURE_TOP/configure.ac ] && \
  CONFIGURE_XPATH="--x-includes=%{_prefix}/include --x-libraries=%{_prefix}/%{_lib}" \
  $CONFIGURE_TOP/configure $CROSSCOMPILE \\\
	--disable-static \\\
	--disable-silent-rules \\\
	--disable-dependency-tracking \\\
	--disable-rpath \\\
	--program-prefix=%{?_program_prefix} \\\
	--prefix=%{_prefix} \\\
	--exec-prefix=%{_exec_prefix} \\\
	--bindir=%{_bindir} \\\
	--sbindir=%{_sbindir} \\\
	--sysconfdir=%{_sysconfdir} \\\
	--datadir=%{_datadir} \\\
	--includedir=%{_includedir} \\\
	--libdir=%{_libdir} \\\
	--libexecdir=%{_libexecdir} \\\
	--localstatedir=%{_localstatedir} \\\
	--sharedstatedir=%{_sharedstatedir} \\\
	--mandir=%{_mandir} \\\
	--infodir=%{_infodir} \\\
    $CONFIGURE_XPATH

%configure2_5x \
  echo "%%configure2_5x is deprecated, please update the spec to use %%configure instead" >&2; \
  %configure

%old_makeinstall \
    make \\\
	prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
	exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
	bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
	sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
	sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
	datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
	includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
	libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
	libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
	localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
	sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
	mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
	infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
	install


%perl_convert_version() %(perl -Mversion -le '
	$x = "%{1}";
	$y = $x;
	$x =~ s/[[:alpha:]]*$//;
	$y =~ s/^$x//;
	$x =~ s/\D*$//;
	$v = version->new($x)->normal;
	$v =~ s/^v//;
	print "$v$y";
')

#--------------------------------------------------------------------------------
# Macro from conectiva

# Shorthand for %{defined with_...}
# macros provided by rpm 4.4, but buggy :(
%_with() %{expand: %%{?_with_%1:1} %%{!?_with_%1: %%{?_without_%1:0} %%{!?_without_%1: %%{?with_%1:%%{with_%1}} %%{!?with_%1: %%{?without_%1:!%%{without_%1}} %%{!?without_%1: %%{?2:%%2} %%{!?2:1} } } } } }
%_without() !%{expand: %%{with %1 %{?2:%2}}}

%_package_i18n(g:f:) \
%%package -n %{?1:%{1}}%{?!1:%{name}}-i18n\
Summary: Internationalization and locale data for %{?1:%{1}}%{?!1:%{name}}\
Group: %{?-g:%{-g*}}%{?!-g:%{group}}\
\
%%description -n %{?1:%{1}}%{?!1:%{name}}-i18n\
Internationalization and locale data for %{?1:%{1}}%{?!1:%{name}}\
\
%%files -n %{?1:%{1}}%{?!1:%{name}}-i18n %{?-f:%{-f}}%{?!-f:-f %{?1:%{1}}%{?!1:%{name}}.lang}\
%{nil}


#------------------------------------------------------------------------------
# Redefine RPM sections to allow jumping over them using "--without <section>".
# This an interesting alternative to --short-circuit.
# The following are mostly equivalent:
# % rpmbuild -bi --short-circuit foo.spec && rpmbuild -bb --short-circuit foo.spec
# % rpmbuild -bb --without build foo.spec

%prep %%prep \
[ %{_with prep} -eq 1 ] || exit 0 \
[ %{_with build} -eq 1 ] || exit 0 \
[ %{_with install} -eq 1 ] || exit 0 \
%{nil}

%build %%build \
[ %{_with install} -eq 1 ] || exit 0 \
[ %{_with build} -eq 1 ] || exit 0 \
%{nil}

%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}} \
%%install \
[ %{_with install} -eq 1 ] || exit 0 \
%{nil}

%check %%check \
[ %{_with check} -eq 1 ] || exit 0 \
%{nil}

%libpackage()\
%%package -n %{expand:%%mklibname %{1} %{2} %{?3:%{3}}}\
Summary: The %{1} library, a part of %{name}\
Group: System/Libraries\
%%description -n %{expand:%%mklibname %{1} %{2} %{?3:%{3}}}\
The %{1} library, a part of %{name}\
%%files -n %{expand:%%mklibname %{1} %{2} %{?3:%{3}}}\
%{_libdir}/lib%{1}%{?3:-%{2}}.so.%{?3:%{3}}%{?!3:%{2}}*\
%{nil}

%dependinglibpackage()\
%%package -n %{expand:%%mklibname %{1} %{2} %{?3:%{3}}}\
Summary: The %{1} library, a part of %{name}\
Group: System/Libraries\
Requires: %{name} = %{EVRD}\
%%description -n %{expand:%%mklibname %{1} %{2} %{?3:%{3}}}\
The %{1} library, a part of %{name}\
%%files -n %{expand:%%mklibname %{1} %{2} %{?3:%{3}}}\
%{_libdir}/lib%{1}%{?3:-%{2}}.so.%{?3:%{3}}%{?!3:%{2}}*\
%{nil}

# get dependencies from library that foo.so points to, very convenient if
# one wants to ie. generate requires/suggests against libraries that are
# dlopen()'ed.
# First argument specifies library name without .so extension and lib prefix,
# while the optional second argument can be used to specify different library
# path than %%{_libdir}
%dlopen_req() %{shrink:\
%([ -e %{?!2:%{_libdir}}%{?2}/lib%{1}.so ] && \
rpm -qf --fileprovide $(readlink -f %{?!2:%{_libdir}}%{?2}/lib%{1}.so) 2>/dev/null | \
grep $(readlink -f %{?!2:%{_libdir}}%{?2}/lib%{1}.so) | cut -f2 || echo %{name})}

# get soname of libfoo.so
# usage:
# %%{lib_soname intl} expands to libintl.so.8
#
# default library search path is %%{_libdir}, which you can override with an
# optional second argument:
# %%{lib_soname intl %%{uclibc_root}%%{_libdir}}

%lib_soname() %(\
[ -e %{?!2:%{_libdir}}%{?2}/lib%{1}.so ] && \
objdump -p %{?!2:%{_libdir}}%{?2}/lib%{1}.so | grep -e SONAME | sed -e 's#.*\\\(lib.*\\\)\$#\\\1#g'\
)

#------------------------------------------------------------------------------
# arch macros
# arch macro for all EFI-compatible architectures
%efi %{ix86} x86_64 znver1 ia64 aarch64

# macro that contains all arm archs, even 64 bit ones
%armx %arm aarch64

# Get the base architecture (e.g. i386 for any x86, arm for any arm)
#
%_base_arch() %(rpm --target='%1' -E '%%{_arch}' | tr -d '\n')

# 1 if cross-compiling, 0 if doing a regular build
# Note: In order to avoid ie. building for i586 on x86_64 being treated as if
# cross-compiling, a check to see if base arch is listed with 'setarch --list'
# is performed.
#

%cross_compiling %(rm -f /tmp/rpm_cc_test 2>/dev/null; echo 'int main() { return 0; }' | %{__cc} %{optflags} -x c - -o /tmp/rpm_cc_test &>/dev/null; if /tmp/rpm_cc_test 2>/dev/null; then echo -n 0; else echo -n 1; fi; rm -f /tmp/rpm_cc_test 2>/dev/null)

#------------------------------------------------------------------------------
# LEGACY RPM5 macro compatibility - packages using these need to be fixed!
%_usrlibrpm %{_rpmconfigdir}
%_etcrpm %{_sysconfdir}/rpm
%_sys_macros_dir %{_rpmmacrodir}
