Looking for documentation on rpm macros and some suggestions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm not a regular rpm builder, but have the need to build some at the moment. I've been successful in building the few rpm's that I need and now want to fine tune the process.

Please take a look at my .rpmmacros below. In particular, the addition to the %configure macro in the last line (which is more like what I want to do, am not sure of the syntax):

----------- start .rpmmacros ------------------------
%packager	Ritesh Sood <riteshsood@xxxxxxxxx>
%vendor       	Dept. of ECE, UC Davis (Internal Use)

%_topdir       	%(echo $HOME)/ECESysAdmin/Syslog-ng/RPM-Build

%configure \
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
  ./configure --host=%{_host} --build=%{_build} \\\
        ... (original code from /usr/lib/rpm/macros) ...
	%{?pkg_config_flags}
----------- end .rpmmacros ------------------------

The idea being that if I want to build the package ``pcre-ece" which requires configure time flags, the spec file would be something like

----------- start pcre-ece.spec ------------------------
%define name 		pcre-ece
%define orig_name	pcre
%define version 	7.8
%define release 	1

%define _prefix 	/usr/local
%define _docdir 	%{_datadir}/doc/%{orig_name}
%define pkg_config_flags --enable-unicode-properties --enable- pcregrep-libz --enable-pcregrep-libbz2
						--disable-pcretest-libreadline

Summary: 	Perl-compatible regular expression library
Name: 		%{name}
Version: 	%{version}
Release: 	%{release}
Source: 	%{orig_name}-%{version}.tar.bz2
URL: 		http://www.pcre.org/
License: 	BSD
Group: 		System Environment/Libraries
BuildRoot: 	%{_builddir}/%{orig_name}-root
Prereq: 	/sbin/ldconfig
BuildPrereq: 	sed
.
.
.
----------- end pcre-ece.spec ------------------------

Coming back to ``%{?pkg_config_flags}" in .rpmmacros above, the idea being that if the spec file defines ``pkg_config_flags", then it would be appended to the default expansion of the ``configure" macro; if not, nothing would be appended. The ``?" in the above is a conjectured syntax to achieve what i've stated above.

I'm not able to find good documentation on the syntax and rules of these macros (i'm familiar with those of ``make"). Neither at
    	http://rpm.org/wiki/Docs#PackagerDocumentation
nor in the books
	http://www.rpm.org/max-rpm-snapshot/
	http://docs.fedoraproject.org/drafts/rpm-guide-en/
Any help in finding documentation is much appreciated.

Secondly, it would be good to have the facility to append per-package flags to other macros. I found the following in one of Suse linux's RPM spec file
----------- start code ------------------------
%build
%{expand: %%define optflags %{optflags} -fPIC}
----------- end code ------------------------
So just to add the ``-fPIC" flag, poor guy has to write all that code. How about something like the following appearing in the ``configure" macro instead:
----------- start code ------------------------
CFLAGS="${CFLAGS:-%optflags:-%{?pkg_cflags}}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags:-%{?pkg_cxxflags}}" ; export CXXFLAGS ; \
----------- end code ------------------------
and while we're at it, might as well add
----------- start code ------------------------
LDFLAGS="${LDFLAGS:-%{?pkg_ldflags}}" ; export LDFLAGS ; \
----------- end code ------------------------
Again, the syntax is my guess as to what it might look like, but you get the idea.


Looking forward to feedback on the above suggestions.

Ritesh






_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux