Add perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
[tools/librpm-tizen.git] / macros.in
1 # $Id: macros.in,v 1.29 1999/05/05 19:01:01 jbj Exp $
2 #==============================================================================
3 # Macro naming conventions (preliminary):
4 #
5 #       Macros that begin with an underscore are "local" in the sense that
6 #       they (if used) will not be exported in rpm headers. Some macros
7 #       that don't start with an underscore (but look like they should)
8 #       are compatible with macros generated by rpm-2.5.x and will be made
9 #       more consistent in a future release.
10 #
11
12 #==============================================================================
13 # ---- filesystem macros.
14 #
15 %_usr                   @prefix@
16 %_usrsrc                %{_usr}/src
17 %_var                   @varprefix@
18
19 #==============================================================================
20 # ---- path macros
21 #       XXX The use of which here is overly simple (read: dumb).
22 #
23 %__bzip2                %{_bzip2bin}
24 %__cat                  @__CAT@
25 %__chgrp                @__CHGRP@
26 %__chmod                @__CHMOD@
27 %__chown                @__CHOWN@
28 %__cp                   @__CP@
29 %__cpio                 @__CPIO@
30 %__gzip                 %{_gzipbin}
31 %__id                   @__ID@
32 %__install              %(which install)
33 %__make                 @__MAKE@
34 %__mkdir                @__MKDIR@
35 %__mv                   @__MV@
36 %__patch                @__PATCH@
37 %__ranlib               %(which ranlib)
38 %__rm                   @__RM@
39 %__strip                %(which strip)
40 %__tar                  @__TAR@
41
42 # XXX avoid weird failures from which if tools are not installed
43 %__libtoolize           libtoolize
44 %__aclocal              aclocal
45 %__autoheader           autoheader
46 %__automake             automake
47 %__autoconf             autoconf
48
49 #==============================================================================
50 # ---- Required rpmrc macros.
51 #       Macros that used to be initialized as a side effect of rpmrc parsing.
52 #       These are the default values that can be overridden by other
53 #       (e.g. per-platform, per-system, per-packager) macro files.
54 #
55 %_builddir              %{_topdir}/BUILD
56 %_buildshell            /bin/sh
57 %_bzip2bin              @BZIP2BIN@
58 %_dbpath                %{_var}/lib/rpm
59 %_defaultdocdir         %{_usr}/doc
60 #
61 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
62 %_fixowner              [ `%{__id} -u` = '0' ] && %{__chown} -Rf root
63 %_fixgroup              [ `%{__id} -u` = '0' ] && %{__chgrp} -Rf @ROOT_GROUP@
64 %_fixperms              %{__chmod} -Rf @FIXPERMS@
65 #
66 %_gzipbin               @GZIPBIN@
67 %_instchangelog         5
68 %_pgpbin                @PGPBIN@
69 %_rpmdir                %{_topdir}/RPMS
70 #
71 # XXX Note escaped %% for use in headerSprintf
72 %_rpmfilename           %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
73 %_signature             none
74 %_sourcedir             %{_topdir}/SOURCES
75 %_specdir               %{_topdir}/SPECS
76 %_srcrpmdir             %{_topdir}/SRPMS
77 %_tmppath               %{_var}/tmp
78 %_topdir                %{_usrsrc}/redhat
79 #
80 #==============================================================================
81 # ---- Optional rpmrc macros.
82 #       Macros that used to be initialized as a side effect of rpmrc and/or
83 #       spec file parsing but were not set in the distributed configuration 
84 #       /usr/lib/rpm/rpmrc file.
85 #
86 #%buildroot
87 #%distribution
88 #%_excludedocs
89 #%_ftpport
90 #%_ftpproxy
91 #%_gpg_name
92 #%_gpg_path
93 #%_httpport
94 #%_httpproxy
95 #%_langpatt
96 #%_netsharedpath
97 #%packager
98 #%_pgp_name
99 #%_pgp_path
100 #%_provides
101 #%_timecheck
102 #%vendor
103
104 #==============================================================================
105 # ---- per-platform macros.
106 #       Macros that are specific to an individual platform. The values here
107 #       will be used if the per-platform macro file does not exist..
108 #
109 %_arch                  @RPMCANONARCH@
110 %_vendor                @RPMCANONVENDOR@
111 %_os                    @RPMCANONOS@
112 %_target_platform       %{_target_cpu}-%{_vendor}-%{_target_os}
113 #
114 # XXX use the rpmrc instantiated macro for now
115 #%optflags              -O2
116
117 #==============================================================================
118 # ---- script environment macros.
119 #       Macro(s) that establish the environment for running a script.
120 #
121 %_preScriptEnvironment  \
122         RPM_SOURCE_DIR=\"%{_sourcedir}\"\
123         RPM_BUILD_DIR=\"%{_builddir}\"\
124         RPM_OPT_FLAGS=\"%{optflags}\"\
125         RPM_ARCH=\"%{_arch}\"\
126         RPM_OS=\"%{_os}\"\
127         export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
128         RPM_DOC_DIR=\"%{_docdir}\"\
129         export RPM_DOC_DIR\
130         RPM_PACKAGE_NAME=\"%{name}\"\
131         RPM_PACKAGE_VERSION=\"%{version}\"\
132         RPM_PACKAGE_RELEASE=\"%{release}\"\
133         export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
134         %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
135         export RPM_BUILD_ROOT\
136         }
137
138 #==============================================================================
139 # ---- configure macros.
140 #       Macro(s) slavishly copied from config.status.
141 #       CAVEAT: Only _prefix is currently used (read: supported). Please
142 #       don't expect or rely on these macros keeping their current values
143 #       (or even being defined) in future versions of rpm.
144 #
145 %_prefix                @prefix@
146 %_exec_prefix           %{_prefix}
147 %_bindir                %{_exec_prefix}/bin
148 %_sbindir               %{_exec_prefix}/sbin
149 %_libexecdir            %{_exec_prefix}/libexec
150 %_datadir               %{_prefix}/share
151 %_sysconfdir            %{_prefix}/etc
152 %_sharedstatedir        %{_prefix}/com
153 %_localstatedir         %{_prefix}/var
154 %_libdir                %{_exec_prefix}/lib
155 %_includedir            %{_prefix}/include
156 %_oldincludedir         /usr/include
157 %_infodir               %{_prefix}/include
158 %_mandir                %{_prefix}/man
159
160 #==============================================================================
161 # ---- config.guess platform macros.
162 #       Macro(s) similar to the tokens used by configure.
163 #
164 %_build                 %{_host}
165 %_build_alias           %{_host_alias}
166 %_build_cpu             %{_host_cpu}
167 %_build_vendor          %{_host_vendor}
168 %_build_os              %{_host_os}
169 %_host                  @host@
170 %_host_alias            @host_alias@
171 %_host_cpu              @host_cpu@
172 %_host_vendor           @host_vendor@
173 %_host_os               @host_os@
174 %_target                %{_host}
175 %_target_alias          %{_host_alias}
176 %_target_cpu            %{_host_cpu}
177 %_target_vendor         %{_host_vendor}
178 %_target_os             %{_host_os}
179
180 #==============================================================================
181 # ---- specfile macros.
182 #       Macro(s) here can be used reliably for reproducible builds.
183 #       (Note: Above is the goal, below are the macros under development)
184 #
185 # The configure macro does the following:
186 #       optionally change to a subdirectory (not implemented).
187 #       attempt to update config.guess and config.sub.
188 #       run configure with correct prefix, platform, and CFLAGS.
189 #       optionally restore current directory (not implemented).
190 # The configure macro should be invoked as %configure (rather than %{configure})
191 # because the rest of the arguments will be expanded using %*. Another
192 # gotcha is that arguments, if present, should be on the same line as the
193 # %configure.
194 #
195 %configure      \
196   %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
197   CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
198
199 #------------------------------------------------------------------------------
200 # The GNUconfigure macro does the following:
201 #       update config.guess and config.sub.
202 #       regenerate all autoconf/automake files
203 #       optionally change to a directory (make the directory if requested).
204 #       run configure with correct prefix, platform, and CFLAGS.
205 #       optionally restore current directory.
206 #
207 %GNUconfigure(MC:)      \
208   %{__libtoolize} --copy --force \
209   %{__aclocal} \
210   %{__autoheader} \
211   %{__automake} \
212   %{__autoconf} \
213   %{-C:_mydir="`pwd`"; %{-M:%{__mkdir} -p %{-C*};} cd %{-C*};} \
214   CFLAGS="%{optflags}" %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} %* \
215   %{-C:cd ${_mydir}; unset _mydir}
216
217 #------------------------------------------------------------------------------
218 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
219 #
220 # For example, these can be used as (from ImageMagick.spec from PLD site)
221 #       [...]
222 #       BuildPrereq: perl
223 #       [...]
224 #       %package perl
225 #       Summary: libraries and modules for access to ImageMagick from perl
226 #       Group: Development/Languages/Perl
227 #       Requires: %{name} = %{version}
228 #       %requires_eq    perl
229 #       [...]
230 #       %install
231 #       rm -fr $RPM_BUILD_ROOT
232 #       install -d $RPM_BUILD_ROOT/%{perl_sitearch}
233 #       [...]
234 #       %files perl
235 #       %defattr(644,root,root,755)
236 #       %{perl_sitearch}/Image
237 #       %dir %{perl_sitearch}/auto/Image
238 #
239 %requires_eq()  %(LC_ALL="C" rpm -q \
240         --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| \
241         grep -v "is not")
242 %perl_sitearch  %(eval "`perl -V:installsitearch`"; echo $installsitearch)
243 %perl_archlib   %(eval "`perl -V:installarchlib`"; echo $installarchlib)