Procedure 2.1. Converting a conventional spec file into a Software Collection spec file
%scl_package
macro to the spec file. Place the macro in front of the spec file preamble as follows:
%{?scl:%scl_package package_name}
%pkg_name
macro in the spec file in case the package is not built for the Software Collection:
%{!?scl:%global pkg_name %{name}}
%pkg_name
macro to define the original name of the package wherever it is needed in the spec file that you can then use for building both the conventional package and the Software Collection.
Name
tag in the spec file preamble as follows:
Name: %{?scl_prefix}package_name
Requires
and BuildRequires
tags with %{?scl_prefix}
as follows:
Requires: %{?scl_prefix}ifconfig
Requires
or BuildRequires
. If you need to depend on a package that could be updated by the system, consider including that package in your Software Collection, or remember to rebuild your Software Collection when the system package updates.
BuildRequires
or Requires
tags in the spec file:
%{?scl:Requires: %scl_runtime}
Obsoletes
, Conflicts
and BuildConflicts
tags with %{?scl_prefix}
. This is to ensure that the Software Collection can be used to deploy new packages to older systems without having the packages specified, for example, by Obsolete
removed from the base system installation. For example:
Obsoletes: %{?scl_prefix}lesspipe < 1.0
Provides
tag with %{?scl_prefix}
, as in the following example:
Provides: %{?scl_prefix}more
-n
option, prefix their name with %{?scl_prefix}
, as in the following example:
%package -n %{?scl_prefix}more
%setup
macro in the %prep
section of the spec file so that the macro can deal with a different package name in the Software Collection environment:
%setup -q -n %{pkg_name}-%{version}
%setup
macro is required and that you must always use the macro with the -n
option to successfully build your Software Collection.
--- a/less.spec +++ b/less.spec @@ -1,10 +1,13 @@ +%{?scl:%scl_package less} +%{!?scl:%global pkg_name %{name}} + Summary: A text file browser similar to more, but better -Name: less +Name: %{?scl_prefix}less Version: 444 Release: 7%{?dist} License: GPLv3+ Group: Applications/Text -Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz +Source: http://www.greenwoodsoftware.com/less/%{pkg_name}-%{version}.tar.gz Source1: lesspipe.sh Source2: less.sh Source3: less.csh @@ -19,6 +22,7 @@ URL: http://www.greenwoodsoftware.com/less/ Requires: groff BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool -Obsoletes: lesspipe < 1.0 +Obsoletes: %{?scl_prefix}lesspipe < 1.0 +%{?scl:Requires: %scl_runtime} %description The less utility is a text file browser that resembles more, but has @@ -31,7 +35,7 @@ You should install less because it is a basic utility for viewing text files, and you'll use it frequently. %prep -%setup -q +%setup -q -n %{pkg_name}-%{version} %patch1 -p1 -b .Foption %patch2 -p1 -b .search %patch4 -p1 -b .time @@ -51,16 +55,16 @@ make CC="gcc $RPM_OPT_FLAGS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOU %install rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install -mkdir -p $RPM_BUILD_ROOT/etc/profile.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d install -p -c -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_bindir} -install -p -c -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d -install -p -c -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d -ls -la $RPM_BUILD_ROOT/etc/profile.d +install -p -c -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d +install -p -c -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d +ls -la $RPM_BUILD_ROOT%{_sysconfdir}/profile.d %files %defattr(-,root,root,-) %doc LICENSE -/etc/profile.d/* +%{_sysconfdir}/profile.d/* %{_bindir}/* %{_mandir}/man1/*