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

%define mname extra
Name: rpm-macros-%mname
Version: 1.2.0
Release: 1
Summary: RPM helper macros to build packages
License: GPL-3.0+
Group: Development/Tools/Building
Source0: %mname.rpm.macros.in
Source2: opensuse.rpm.macros
Source3: rhel6.rpm.macros
Source4: fedora.rpm.macros
Source5: debian.rpm.macros
Source6: mageia.rpm.macros
Source7: service.rpm.macros
Source11: cmake.rpm.macros
Source12: tcl.rpm.macros
Source21: brp-strip-unneeded.sh
Source22: brp-redhat.sh
BuildArch: noarch
%if 0%{?suse_version} >= 1310
BuildRequires: systemd-rpm-macros
%endif
#if %{undefined _rpmmacrosdir}
%if "%{?vendor}" == "debbuild"
%define _rpmmacrosdir %_sysconfdir/debbuild
%else
%if 0%{?suse_version} >= 1500 || 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700 || 0%{?fedora_version}
%define _rpmmacrosdir %_rpmconfigdir/macros.d
%else
%define _rpmmacrosdir %_sysconfdir/rpm
%endif
%endif
#endif

%description
These helper macros provide possibility to build packages.


%prep
%setup -cT
install -m 0644 %{S:0} ./%mname.rpm.macros.in
install -m 0644 %{S:2} ./opensuse.rpm.macros
install -m 0644 %{S:3} ./rhel6.rpm.macros
install -m 0644 %{S:4} ./fedora.rpm.macros
install -m 0644 %{S:5} ./debian.rpm.macros
install -m 0644 %{S:6} ./mageia.rpm.macros
install -m 0644 %{S:7} ./service.rpm.macros
install -m 0644 %{S:11} ./cmake.rpm.macros
install -m 0644 %{S:12} ./tcl.rpm.macros
install -m 0644 %{S:21} ./brp-strip-unneeded.sh
install -m 0644 %{S:22} ./brp-redhat.sh


%build
sed \
%if 0%{?suse_version} >= 1500 || 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700 || 0%{?fedora_version}
	's|@RPMMACROSDIR@|%%_rpmconfigdir/macros.d|' \
%else
	's|@RPMMACROSDIR@|%%_sysconfdir/rpm|' \
%endif
	%mname.rpm.macros.in > %mname.rpm.macros


%install
install -d -m 0755 %buildroot%_rpmmacrosdir
install -m 0644 %mname.rpm.macros %buildroot%_rpmmacrosdir/macros.%mname

%if 0%{?suse_version} >= 1130
cat opensuse.rpm.macros >> %buildroot%_rpmmacrosdir/macros.%mname
install -d -m 0755 %buildroot%_rpmconfigdir/brp-suse.d
ln -sf brp-suse.d %buildroot%_rpmconfigdir/brp.d
install -p -m 0755 brp-strip-unneeded.sh %buildroot%_rpmconfigdir/brp.d/brp-16-strip-unneeded
%else
%if 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700 || 0%{?fedora_version}
cat fedora.rpm.macros >> %buildroot%_rpmmacrosdir/macros.%mname
sed -n '/^%%__os_install_post/,/^%%{nil}/p' %_rpmconfigdir/redhat/macros | \
	sed 's|^%%{nil}|    %_rpmconfigdir/brp-redhat \\\n&|' >> %buildroot%_rpmmacrosdir/macros.%mname
install -d -m 0755 %buildroot%_rpmconfigdir/brp-redhat.d
ln -sf brp-redhat.d %buildroot%_rpmconfigdir/brp.d
install -p -m 0755 brp-redhat.sh %buildroot%_rpmconfigdir/brp-redhat
install -p -m 0644 service.rpm.macros %buildroot%_rpmmacrosdir/macros.service
%else
%if 0%{?centos_version} >= 600 || 0%{?rhel_version} >= 600
cat rhel6.rpm.macros >> %buildroot%_rpmmacrosdir/macros.%mname
install -p -m 0644 cmake.rpm.macros %buildroot%_rpmmacrosdir/macros.cmake
%else
%if 0%{?mageia_version} <= 5
cat debian.rpm.macros >> %buildroot%_rpmmacrosdir/macros.%mname
%else
%if 0%{?debian_version} || 0%{?ubuntu_version}
cat mageia.rpm.macros >> %buildroot%_rpmmacrosdir/macros.%mname
%else
%if %{undefined __xz}
echo "%%_initddir %%_initrddir" >> %buildroot%_rpmmacrosdir/macros.%mname
%endif
%endif
%endif
%endif
%endif
%endif
%if 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora_version}
install -p -m 0644 tcl.rpm.macros %buildroot%_rpmmacrosdir/macros.tcl
%endif
%if 0%{?suse_version} != 0 && 0%{?suse_version} <= 1320 && 0%{?suse_version} != 1315
%{!?tmpfiles_create:echo '%%tmpfiles_create() %%_bindir/systemd-tmpfiles --create %%{?*} ||:' >> %buildroot%_rpmmacrosdir/macros.%mname}
%endif


%files
%defattr(-,root,root)
%_rpmmacrosdir/*
%if 0%{?suse_version} >= 1130 || 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700 || 0%{?fedora_version}
%_rpmconfigdir/brp*
%endif


%changelog
* Sun Jul 14 2019 Led <ledest@gmail.com> 1.2.0-1
- 1.2.0
  + redefine %%_rpmmacrosdir to %%_rpmconfigdir/macros.d

* Sun Aug 20 2017 Led <ledest@gmail.com> 1.1.0-1
- 1.1.0:
  + add brp-radhat script
  + add brp-radhat.d dir
  + add brp.d

* Wed Mar 01 2017 Led <ledest@gmail.com> 1.0.1-1
- 1.0.1:
  + add custom _rpmmacrosdir macro for debbuild
- install debbuild macros to %_sysconfdir/debbuild/

* Wed Mar 01 2017 Led <ledest@gmail.com> 1.0.0-2
- cosmetic fixes

* Wed Mar 01 2017 Led <ledest@gmail.com> 1.0.0-1
- 1.0.0:
  + remove rhel5.rpm.macros
  + remove sle.rpm.macros
  + remove noarch_package macro
  + add debian.rpm.macros

* Wed Mar 01 2017 Led <ledest@gmail.com> 0.14.1-1
- 0.14.1
- fix %%service_del_postun macro

* Sun Dec 18 2016 Led <ledest@gmail.com> 0.14.0-1
- 0.14.0
  + fix macros in service.rpm.macros
  + add _rundir macro to fedora.rpm.macros

* Sun Dec 18 2016 Led <ledest@gmail.com> 0.13.0-1
- 0.13.0
  + add tmpfiles_create macro

* Sun Dec 18 2016 Led <ledest@gmail.com> 0.12.0-1
- 0.12.0:
  + add macros.service for RHEL7/CentOS7/Fedora

* Sun Aug 14 2016 Led <ledest@gmail.com> 0.11.0-1
- 0.11.0:
  + add macros.tcl for RHEL/CentOS/Fedora

* Wed Aug 10 2016 Led <ledest@gmail.com> 0.10.0-1
- 0.10.0:
  + add macros for Mageia (by Tom Mbrt (derselbst@))

* Mon Apr 04 2016 Led <ledest@gmail.com> 0.9.0-1
- 0.9.0:
  + remove systemd macros

* Mon Apr 04 2016 Led <ledest@gmail.com> 0.8.0-1
- 0.8.0:
- add macros for EL/CentOS >= 7 and Fedora (from openSUSE):
  + %%py_ver

* Mon Apr 04 2016 Led <ledest@gmail.com> 0.7.0-1
- 0.7.0:
- add macros for EL/CentOS >= 7 and Fedora (from openSUSE):
  + %%service_add_pre()
  + %%service_add_post()
  + %%service_del_preun()
  + %%service_del_postun()
  + %%stop_on_removal()
  + %%restart_on_update()
  + %%fillup_only()
- add macros for openSUSE (from EL/CentOS 7):
  + %%systemd_pre()
  + %%systemd_post()
  + %%systemd_preun()
  + %%systemd_postun()

* Mon Nov 03 2014 Led <ledest@gmail.com> 0.6.16-1
- added %%_desktopdir macro

* Thu Oct 09 2014 Led <ledest@gmail.com> 0.6.15-1
- added brp-16-strip-unneeded for SUSE

* Thu Sep 25 2014 Led <ledest@gmail.com> 0.6.14-2
- fix typo

* Wed Sep 24 2014 Led <ledest@gmail.com> 0.6.14-1
- cleaned up cmake.macros
- updated fedora.rpm.macros

* Wed Sep 24 2014 Led <ledest@gmail.com> 0.6.13-1
- added cmake.macros

* Mon Sep 01 2014 Led <ledest@gmail.com> 0.6.12-1
- added %%_pkgconfigdir macro

* Mon Sep 01 2014 Led <ledest@gmail.com> 0.6.11-1
- added %%_logrotatedir macro

* Sun Aug 31 2014 Led <ledest@gmail.com> 0.6.10-1
- added %%__nprocs macro
- redefined %%make_build macro
- adde %%add_verify_elf_skiplist and %%add_strip_skiplist dummy macros

* Fri Aug 29 2014 Led <ledest@gmail.com> 0.6.9-1
- added %%autoreconf macro

* Wed Aug 13 2014 Led <ledest@gmail.com> 0.6.8-1
- fixed build for Fedora

* Wed Aug 13 2014 Led <ledest@gmail.com> 0.6.7-1
- removed obsoleted macros
- added %%_man?dir macros
- simplified macros

* Wed Mar 27 2013 Led <led@massivesolutions.co.uk> 0.6.6-1
- updated macros for Fedora

* Wed Mar 20 2013 Led <led@massivesolutions.co.uk> 0.6.5-1
- added macros for Fedora

* Fri Feb 01 2013 Led <led@massivesolutions.co.uk> 0.6.4-1
- cosmetic fix for bootstraping

* Sun Apr 01 2012 Led <led@massivesolutions.co.uk> 0.6.3-1
- added %%_initddir macro for CentOS 5

* Wed Mar 14 2012 Led <led@massivesolutions.co.uk> 0.6.2-1
- added macros for RHEL 5 and CentOS 5

* Mon Mar 12 2012 Led <led@massivesolutions.co.uk> 0.6.1-1
- simplified macros

* Mon Mar 12 2012 Led <led@massivesolutions.co.uk> 0.6-1
- leave only one extra macros file

* Tue Mar 06 2012 Led <led@massivesolutions.co.uk> 0.5-1
- added macros for RHEL 6 and CentOS 6

* Fri Mar 02 2012 Led <led@massivesolutions.co.uk> 0.5-0
- added separate custom macros files for SLE and openSUSE

* Fri Mar 02 2012 Led <led@massivesolutions.co.uk> 0.4-0
- added %%noarch_package macro

* Mon Feb 06 2012 Led <led@massivesolutions.co.uk> 0.3-0
- added %%_initdir and %%systemd_unitdir macros

* Sun Feb 05 2012 Led <led@massivesolutions.co.uk> 0.2-0
- added %%_rpmlibdir and %%_rpmmacrosdir macros
- fixed Group

* Wed Feb 01 2012 Led <led@massivesolutions.co.uk> 0.1-0
- initial build for openSUSE
openSUSE Build Service is sponsored by