File extra.rpm.macros of Package rpm-macros-extra

# RPM directories.
%_rpmlibdir %_prefix/lib/rpm
%_rpmmacrosdir %_sysconfdir/rpm

# Autotools.
%autoreconf		autoreconf -fisv

# Manpage directories.
%_man1dir		%_mandir/man1
%_man2dir		%_mandir/man2
%_man3dir		%_mandir/man3
%_man4dir		%_mandir/man4
%_man5dir		%_mandir/man5
%_man6dir		%_mandir/man6
%_man7dir		%_mandir/man7
%_man8dir		%_mandir/man8
%_man9dir		%_mandir/man9

# Desktop-related directories.
%_desktopdir	%_datadir/applications

# logrotate configs.
%_logrotatedir	%{_sysconfdir}/logrotate.d

# pkg-config directory.
%_pkgconfigdir	%{_libdir}/pkgconfig

# Set with/without default value.
%def_with() %{expand:%%{!?_with_%{1}: %%{!?_without_%{1}: %%global _with_%{1} --with-%{1}}}}
%def_without() %{expand:%%{!?_with_%{1}: %%{!?_without_%{1}: %%global _without_%{1} --without-%{1}}}}

# Set enable/disable default value.
%def_enable() %{expand:%%{!?_enable_%{1}: %%{!?_disable_%{1}: %%global _enable_%{1} --enable-%{1}}}}
%def_disable() %{expand:%%{!?_enable_%{1}: %%{!?_disable_%{1}: %%global _disable_%{1} --disable-%{1}}}}

# Set with/without value.
%force_with() %{expand:%%global _with_%{1} --with-%{1}}
%force_without() %{expand:%%global _without_%{1} --without-%{1}}

# Set enable/disable value.
%force_enable() %{expand:%%global _enable_%{1} --enable-%{1}}
%force_disable() %{expand:%%global _disable_%{1} --disable-%{1}}

# Check whether both _with_%{1} and _without_%{1} are defined.
%check_def() %{expand:%%{?_with_%{1}: %%{?_without_%{1}: %%{error: both _with_%{1} and _without_%{1} are defined}}}} \
	%{expand:%%{?_enable_%{1}: %%{?_disable_%{1}: %%{error: both _enable_%{1} and _disable_%{1} are defined}}}}

# Set enable/disable value and undefine disable/enable value.
%set_enable() %{expand:%%force_enable %{1}} %{expand:%%undefine _disable_%{1}}
%set_disable() %{expand:%%force_disable %{1}} %{expand:%%undefine _enable_%{1}}

# Set with/without value and undefine without/with value.
%set_with() %{expand:%%force_with %{1}} %{expand:%%undefine _without_%{1}}
%set_without() %{expand:%%force_without %{1}} %{expand:%%undefine _with_%{1}}

# ifdef/ifndef.
%ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%ifndef() %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}

# if_with/if_without.
%if_with() %if %{expand:%%{?_with_%{1}:1}%%{!?_with_%{1}:0}}
%if_without() %if %{expand:%%{?_without_%{1}:1}%%{!?_without_%{1}:0}}

# Check for enabled/disabled.
%enabled() %{expand:%%{?_enable_%{1}:1}%%{!?_enable_%{1}:0}}
%disabled() %{expand:%%{?_disable_%{1}:1}%%{!?_disable_%{1}:0}}

# if_enabled/if_disabled.
%if_enabled() %if %{expand:%%{?_enable_%{1}:1}%%{!?_enable_%{1}:0}}
%if_disabled() %if %{expand:%%{?_disable_%{1}:1}%%{!?_disable_%{1}:0}}

# substitute with/without/enable/disable macros.
%subst_with() %{expand:%%{?_with_%{1}:%%{_with_%{1}}}} %{expand:%%{?_without_%{1}:%%{_without_%{1}}}}
%subst_enable() %{expand:%%{?_enable_%{1}:%%{_enable_%{1}}}} %{expand:%%{?_disable_%{1}:%%{_disable_%{1}}}}
%subst_enable_to() %{expand:%%{?_enable_%{1}:--enable-%{2}}} %{expand:%%{?_disable_%{1}:--disable-%{2}}}
%subst_with_to() %{expand:%%{?_with_%{1}:--with-%{2}}} %{expand:%%{?_without_%{1}:--without-%{2}}}


%remove_optflags(a:f:t:p:w:W:d:g:O:A:C:D:E:H:i:M:n:P:U:u:l:s:X:B:I:L:b:V:m:x:c:S:E:o:v:) \
%global optflags %(opt="%optflags"; for f in %{**}; do opt="$(echo "$opt"|sed -e "s/ $f//g;s/$f //g")"; done; echo "$opt")

%add_optflags(a:f:t:p:w:W:d:g:O:A:C:D:E:H:i:M:n:P:U:u:l:s:X:B:I:L:b:V:m:x:c:S:E:o:v:) \
%global optflags %{optflags} %{**}


%__nprocs %(N=$(/usr/bin/getconf _NPROCESSORS_ONLN 2>/dev/null); echo ${N:-1})

%make_build make -j${NPROCS:-%__nprocs}

%makeinstall_std %make_install

## compiler optflags defaults

# core flags
%optflags_core -pipe

# default optimization level
%_optlevel 2

# general optimization flags
%optflags_optimization -O%{_optlevel} %optflags_notraceback

# warning flags
%optflags_warnings -Wall%{?_enable_Werror: -Werror}

# debug flags
%optflags_debug -g

# shared libraries flags
%optflags_shared -fPIC -DPIC

# break c++ programs which use exceptions
%optflags_nocpp -fno-exceptions -fno-rtti

# disables traceback, making debugging impossible
%optflags_notraceback -fomit-frame-pointer

# aggressive floating-point optimization,
# violate some ANSI or IEEE rules and/or specifications
%optflags_fastmath -ffast-math

# enable strict aliasing rules, applicable for well written code
%optflags_strict -fstrict-aliasing

%optflags_stack_protector -fstack-protector

%optflags_fortify_source -D_FORTIFY_SOURCE=2

# dummy macros
%add_verify_elf_skiplist #
%add_strip_skiplist #