openpkg/rpmtool.pod

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
child 428
f880f219c566
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

michael@13 1 ##
michael@13 2 ## rpmtool.pod -- OpenPKG RPM Auxiliary Tool (Manual Page)
michael@13 3 ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@13 4 ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
michael@13 5 ##
michael@13 6 ## Permission to use, copy, modify, and distribute this software for
michael@13 7 ## any purpose with or without fee is hereby granted, provided that
michael@13 8 ## the above copyright notice and this permission notice appear in all
michael@13 9 ## copies.
michael@13 10 ##
michael@13 11 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@13 12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@13 13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@13 14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@13 15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@13 16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@13 17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@13 18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@13 19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@13 20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@13 21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@13 22 ## SUCH DAMAGE.
michael@13 23 ##
michael@13 24
michael@13 25 =pod
michael@13 26
michael@13 27 =head1 NAME
michael@13 28
michael@13 29 B<rpmtool> - RPM Auxiliary Tool
michael@13 30
michael@13 31 =head1 SYNOPSIS
michael@13 32
michael@13 33 B<rpmtool>
michael@13 34 I<command>
michael@13 35 [I<command-options>]
michael@13 36
michael@13 37 =head1 DESCRIPTION
michael@13 38
michael@13 39 This is an auxiliary tool to the RedHat Package Manager (RPM). It
michael@13 40 provides additional functionality for use in RPM I<spec> files while
michael@13 41 building packages. The following I<command>s are available:
michael@13 42
michael@13 43 =over 4
michael@13 44
michael@13 45 =item B<platform>
michael@13 46
michael@13 47 This command outputs a unique platform id in the format
michael@13 48 "<architecture>-<system><release>". For instance, the output on a
michael@13 49 FreeBSD platform can be "i386-freebsd4.2", the output on a Linux
michael@13 50 platform can be "i686-linux2.2.16", the output on a Solaris platform can
michael@13 51 be "sun4u-sunos5.8", etc.
michael@13 52
michael@13 53 Example:
michael@13 54
michael@13 55 case `rpmtool platform`; in
michael@13 56 *-freebsd[34].* ) ... ;;
michael@13 57 *-sunos5.[678] ) ... ;;
michael@13 58 *-linux2.[24].* ) ... ;;
michael@13 59 esac
michael@13 60
michael@13 61 =item B<mflags> [B<-O>] I<tool>
michael@13 62
michael@13 63 This command outputs additional flags for make(1) for
michael@13 64 use with the program I<tool>. It provides only standard flags which
michael@13 65 always can be used. In conjunction with B<-O> (optimization), it also provides
michael@13 66 reasonable job control for use on multi-processor platforms (for instance it
michael@13 67 outputs "-j4" on an SMP system with 2 CPUs if GNU make or BSD pmake is used).
michael@13 68
michael@13 69 Example:
michael@13 70
michael@13 71 make `rpmtool mflags -O make`
michael@13 72
michael@13 73 =item B<cflags> [B<-O>] I<tool>
michael@13 74
michael@13 75 This command outputs additional flags for cc(1) for use with the program
michael@13 76 I<tool>. It provides only standard flags which always can be used.
michael@13 77 conjunction with B<-O> it provides also optimization flags (for instance
michael@13 78 it outputs "-O2 -pipe" for GNU C/C++ compiler).
michael@13 79
michael@13 80 Example:
michael@13 81
michael@13 82 CC="$CC" CFLAGS=`rpmtool cflags -O $CC` ./configure ...
michael@13 83
michael@13 84 =item B<cppflags> [B<-p> I<prefix>] [[C<+|->I<subdir> ...]
michael@13 85
michael@13 86 This command output cpp(1) C<-I> options for the OpenPKG instance
michael@13 87 I<prefix>. It optionally can prefix or suffix with one or more I<subdir>
michael@13 88 related options, too. If I<subdir> is prefixed with C<+> (or not
michael@13 89 prefixed at all), the generated option is appended. If I<subdir> is
michael@13 90 prefixed with C<-> the generated option is prepended.
michael@13 91
michael@13 92 Example:
michael@13 93
michael@13 94 rpmtool cppflags -p /foo bar -baz +quux
michael@13 95
michael@13 96 =item B<ldflags> [B<-p> I<prefix>] [[C<+|->I<subdir> ...]
michael@13 97
michael@13 98 This command output ld(1) C<-L> options for the OpenPKG instance
michael@13 99 I<prefix>. It optionally can prefix or suffix with one or more I<subdir>
michael@13 100 related options, too. If I<subdir> is prefixed with C<+> (or not
michael@13 101 prefixed at all), the generated option is appended. If I<subdir> is
michael@13 102 prefixed with C<-> the generated option is prepended.
michael@13 103
michael@13 104 Example:
michael@13 105
michael@13 106 rpmtool ldflags -p /foo bar -baz +quux
michael@13 107
michael@13 108 =item B<files> [B<-v>] [B<-o> I<outfile>] [B<-r> I<build-root>] [I<entry> ...]
michael@13 109
michael@13 110 This is a dynamic variant of the RPM C<%files> section, i.e., it
michael@13 111 dynamically creates the contents of the C<%files> section for use with
michael@13 112 the C<%files -f> command. For this the file list entries are read from
michael@13 113 the command line (or from stdin if no arguments are given or a single
michael@13 114 argument C<-> is given) and written to stdout (if no B<-o> option is
michael@13 115 given or its I<outfile> argument is C<->) or to I<outfile>.
michael@13 116
michael@13 117 The trick of this approach is to be able to use additional features in
michael@13 118 the file list which RPM does not provide. The following features are
michael@13 119 provided:
michael@13 120
michael@13 121 =over 4
michael@13 122
michael@13 123 =item B<Trailing Tags>
michael@13 124
michael@13 125 RPM requires that all tags (like C<%attr(...)> or C<%dir>) preceed the
michael@13 126 path in a file list entry. This sometimes leads to ugly and unreadable
michael@13 127 file lists, because all paths cannot be left-aligned. With rpmtool(8)
michael@13 128 tags in the input file list can be at leading and trailing positions.
michael@13 129 The output file list will nevertheless have all tags in leading
michael@13 130 positions for RPM.
michael@13 131
michael@13 132 =item B<Syntactical Set Pattern>
michael@13 133
michael@13 134 RPM supports simple wildcard patterns like C</path/*> or C</path/[a-z]>,
michael@13 135 etc. Sometimes it is convenient, to also have (in addition to character
michael@13 136 sets) string sets like C</path/{foo,bar,quux}>. rpmtool(8) provides this
michael@13 137 by syntactically (without checking the filesystem) expanding those
michael@13 138 string sets.
michael@13 139
michael@13 140 =item B<Overriding Entries>
michael@13 141
michael@13 142 This is the most important feature and the reason why shtool(1)'s
michael@13 143 B<files> command was implemented. Although RPM allows one to specify a
michael@13 144 directory in a file list and then implicitly expands this recursively
michael@13 145 into its contents, it unfortunately does not allow one to later
michael@13 146 explcitly override particular entries (usually if an individual
michael@13 147 C<%attr(...)> tag is required). rpmtool(8) now supports overriding
michael@13 148 entries, i.e., if a path occurs multiple times, only the last occurance
michael@13 149 is kept.
michael@13 150
michael@13 151 =item B<Negation Tag>
michael@13 152
michael@13 153 This provides an additional tag C<%not> which can be used to explicitly
michael@13 154 exclude a previously implicitly added entry.
michael@13 155
michael@13 156 =back
michael@13 157
michael@13 158 Example:
michael@13 159
michael@13 160 %install
michael@13 161 :
michael@13 162 rpmtool files -o files -r$RPM_BUILD_ROOT \
michael@13 163 '%defattr(-,foo,foo)' \
michael@13 164 '%{prefix}' \
michael@13 165 '%attr(1755,root,foo) %{prefix}/bin/bar' \
michael@13 166 '%not %dir {%{prefix},%{prefix}/*,%{prefix}/man/*}' \
michael@13 167 '%not %{prefix}/info/dir'
michael@13 168
michael@13 169 %files -f files
michael@13 170
michael@13 171 =item B<msg> [B<-b>]
michael@13 172
michael@13 173 This displays the contents of F<stdin> as a boxed message. If option
michael@13 174 B<-b> is given it additionally beeps once before displaying the box.
michael@13 175
michael@13 176 =back
michael@13 177
michael@13 178 =head1 HISTORY
michael@13 179
michael@13 180 This tool was created in November 2000 for use in OpenPKG, the
michael@13 181 cross-platform RPM-based Unix software packaging facility.
michael@13 182
michael@13 183 =head1 AUTHOR
michael@13 184
michael@13 185 Ralf S. Engelschall
michael@13 186 rse@engelschall.com
michael@13 187 www.engelschall.com
michael@13 188
michael@13 189 =cut
michael@13 190

mercurial