[Rpm-maint] Fwd: Looking for documentation on rpm macros and some suggestions
Ritesh Sood
baralachala at gmail.com
Sat Mar 14 04:59:58 UTC 2009
I had sent the following mail to rpm-list at lists.rpm.org, but haven't
received a response. Perhaps rpm-maint is a more appropriate forum for
my queries.
> 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, but I'm not sure of the syntax):
>
> ----------- start .rpmmacros ------------------------
> %packager Ritesh Sood <riteshsood at gmail.com>
> %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, 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 jump through all
> those hoops. 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20090313/5865437a/attachment-0001.htm>
More information about the Rpm-maint
mailing list