]> git.pld-linux.org Git - packages/rpm-build-macros.git/blob - rpm.macros
- added missing translation to pl.po patch
[packages/rpm-build-macros.git] / rpm.macros
1 # PLD rpm macros
2
3 %__id           @__ID@
4 %__id_u         %{__id} -u 
5 %__chown_Rhf           @__CHOWN_RHF@
6 %__chgrp_Rhf           @__CHGRP_RHF@
7
8 %_fixowner       [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@
9 %_fixgroup       true
10 %_fixperms             %{__chmod} -Rf @FIXPERMS@
11 %_topdir         %(echo $HOME)/rpm
12 %_exec_prefix    %{_prefix}
13 %_bindir         %{_exec_prefix}/bin
14 %_sbindir        %{_exec_prefix}/sbin
15 %_libexecdir     %{_exec_prefix}/lib
16 %_datadir        %{_prefix}/share
17 %_sharedstatedir /var/lib
18 %_lib            lib
19 %_libdir         %{_exec_prefix}/%{_lib}
20 %_includedir     %{_prefix}/include
21 %_oldincludedir  /usr/include
22 %_sysconfdir     /etc
23 %_localstatedir  /var
24 %_infodir        /usr/share/info
25 %_mandir         %{_prefix}/share/man
26 %_defaultdocdir  %{_usr}/share/doc
27 #-----------------------------------------------------------------
28 # CFLAGS and LDFLAGS used to build
29
30 %debugcflags    -O0 -g -Wall
31 %rpmcflags      %{?debug:%debugcflags}%{!?debug:%optflags}
32 %rpmldflags     %{!?debug:-s}
33
34 # kernel compiler
35 %kgcc           gcc2
36 %kgcc_package   gcc2
37
38 # Build system path macros.
39 #
40 %__libtoolize           libtoolize --copy --force
41 %__gettextize           gettextize --copy --force
42 %__automake             automake -a -c -f --foreign
43 %__autoconf             autoconf %{?debug:-Wall}
44
45 #-----------------------------------------------------------------
46 %configure2_13 { \
47  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
48  LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
49  CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
50  CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
51  FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
52  CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
53  %{?__cc:CC=%{__cc} ; export CC ; } \
54  %{?__cxx:CXX=%{__cxx} ; export CXX ; } \
55  %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
56         --host=%{_target_platform} \
57         --prefix=%{_prefix} \
58         --exec-prefix=%{_exec_prefix} \
59         --bindir=%{_bindir} \
60         --sbindir=%{_sbindir} \
61         --sysconfdir=%{_sysconfdir} \
62         --datadir=%{_datadir} \
63         --includedir=%{_includedir} \
64         --libdir=%{_libdir} \
65         --libexecdir=%{_libexecdir} \
66         --localstatedir=%{_localstatedir} \
67         --sharedstatedir=%{_sharedstatedir} \
68         --mandir=%{_mandir} \
69         --infodir=%{_infodir} \
70 }
71
72 #----------------------------------------------------------------
73 %configure {./configure \
74         LDFLAGS="${LDFLAGS:-%rpmldflags}" \
75         CFLAGS="${CFLAGS:-%rpmcflags}" \
76         CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
77         FFLAGS="${FFLAGS:-%rpmcflags}" \
78         CPPFLAGS="${CPPFLAGS:-}" \
79         %{?__cc:CC=%{__cc}} \
80         %{?__cxx:CXX=%{__cxx}} \
81         --build=%{_target_platform} \
82         --prefix=%{_prefix} \
83         --exec-prefix=%{_exec_prefix} \
84         --bindir=%{_bindir} \
85         --sbindir=%{_sbindir} \
86         --sysconfdir=%{_sysconfdir} \
87         --datadir=%{_datadir} \
88         --includedir=%{_includedir} \
89         --libdir=%{_libdir} \
90         --libexecdir=%{_libexecdir} \
91         --localstatedir=%{_localstatedir} \
92         --sharedstatedir=%{_sharedstatedir} \
93         --mandir=%{_mandir} \
94         --infodir=%{_infodir} \
95 }
96
97 # Location of autoconf macros
98 %_aclocaldir    %(aclocal --print-ac-dir)
99
100 # Location of omf files
101 %_omf_dest_dir  %(scrollkeeper-config --omfdir)
102
103 # Location of pkgconfig files
104 %_pkgconfigdir  /usr/lib/pkgconfig
105
106 # Location of top applink dir
107 %_applnkdir      /usr/X11R6/share/applnk
108
109 # Location pixmaps for applnk/desktop files
110 %_pixmapsdir    /usr/X11R6/share/pixmaps
111
112 # Location of fonts directories
113 %_fontsdir      /usr/share/fonts
114
115 # Current date
116 %date           %(LC_ALL="C" date +"%a %b %d %Y")
117
118 # tmp directory
119 %tmpdir         %(echo "${TMPDIR:-/tmp}")
120
121 # Example files, programs, scripts...
122 %_examplesdir   /usr/src/examples
123
124 # The directory holding Linux kernel sources
125 %_kernelsrcdir  /usr/src/linux
126
127 # If non-empty "debug" macro defined, add "dbg" suffix to release number
128 %_rpmfilename           %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
129
130 # Requires name = version-release
131 %requires_releq()               %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
132 %requires_releq_kernel_up()     %(LC_ALL="C" rpm -qf --qf 'Prereq: kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -vE "(is not|no such)")
133 %requires_releq_kernel_smp()    %(LC_ALL="C" rpm -qf --qf 'Prereq: kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -vE "(is not|no such)")
134
135 # kernel version-release handling
136 %__kernel_ver    %(grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | cut -d'"' -f2)
137 %__kernel_rel    %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/version.h --queryformat "%{RELEASE}" | grep -v "is not")
138 %_kernel_ver     %(echo %{__kernel_ver}%{!?_without_dist_kernel:-%{__kernel_rel}})
139 %_kernel_ver_str %(echo %{_kernel_ver} | sed s/-/_/g)
140
141 # sgml macros
142 %xmlcat_add()            /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog
143 %xmlcat_del()            /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog
144 %xmlcat_add_rewrite      /usr/bin/xmlcatalog --noout --add rewriteSystem
145 %xmlcat_create()          /usr/bin/xmlcatalog --noout --create %1
146 %sgmlcat_add()           /usr/bin/install-catalog --add %1 %2 > /dev/null
147 %sgmlcat_del()           /usr/bin/install-catalog --remove %1 %2 > /dev/null
148 %docbook_sgmlcat_fix() { for l in \
149 '' \
150 '  -- default decl --' \
151 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
152 '  -- hacks for opensp --' \
153 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
154 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd"                  "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
155 '' \
156 ; do echo $l; done >> %1 \
157 }
158
159 #-----------------------------------------------------------------
160 # find and gzip all files in %{_mandir} and %{infodir}
161 #
162 # Requires: xargs, find
163 #
164 #%no_install_post_compress_docs 1
165 %__spec_install_post_compress_docs { \
166 echo "Compress man and info pages."; \
167 %{!?no_install_post_compress_docs: \
168         %{?verbose:set -x;} \
169         for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
170                 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
171                         find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
172                         find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
173                         find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
174                 fi; \
175         done; \
176 } }
177
178 #-----------------------------------------------------------------
179 # Strip executable binaries and shared object files
180 #
181 # Requires: find, awk, strip, cut, xargs
182 #
183 #%no_install_post_strip 1
184 %__spec_install_post_strip {%{!?debug: \
185 %{!?no_install_post_strip: \
186         %{?verbose:set -x;} \
187         echo "Strip executable binaries, archives and shared object files."; \
188         filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
189         elfexelist=`echo $filelist | xargs -r file | \
190                 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
191         elfsharedlist=`echo $filelist | xargs -r file | \
192                 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
193         elfarchiveslist=`echo $filelist | xargs -r file | \
194                 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
195         if [ -n "$elfexelist" ]; then \
196                 strip --remove-section=.note  --remove-section=.comment $elfexelist; \
197         fi; \
198         if [ -n "$elfsharedlist" ]; then \
199                 strip --strip-unneeded --remove-section=.note  --remove-section=.comment $elfsharedlist; \
200         fi; \
201         if [ -n "$elfarchiveslist" ]; then \
202                 strip --strip-debug --remove-section=.note  --remove-section=.comment $elfarchiveslist; \
203         fi; } \
204 } }
205
206 #-----------------------------------------------------------------
207 # Find and gzip all kernel modules
208 #
209 # Requires: find
210 #
211 #%no_install_post_compress_modules  1
212 %__spec_install_post_compress_modules { \
213 %{!?no_install_post_compress_modules: \
214 echo "Compress kernel modules if any."; \
215     %{?verbose:set -x;} \
216     if test -d $RPM_BUILD_ROOT/lib/modules ; then \
217        find $RPM_BUILD_ROOT/lib/modules -name \*.o -type f -print | \
218        xargs -r %{__gzip} -9nf; \
219            find $RPM_BUILD_ROOT/lib/modules -name \*.o -type l -printf "%p %l\n" | \
220            while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done \
221     fi; \
222 } }
223
224 %_source_payload        w9.gzdio
225 %_binary_payload        w9.bzdio
226
227 #-----------------------------------------------------------------
228 # post %install sequence:
229 # - autodeps exceptions
230 # - compress all man and info pages,
231 # - strip all ELF executables and ELF shared objects if not %debug.
232 # - compress kernel modules if any
233
234 ###################################################################
235 # Requires/Provides automation
236 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
237 %__spec_prep_pre \
238 _autoreqprov=n \
239 %{?_noautoreqfiles:_autoreqprov=y}\
240 %{?_noautoreq:_autoreqprov=y}\
241 %{?_noautoreqdep:_autoreqprov=y}\
242 %{?_noautoprovfiles:_autoreqprov=y}\
243 %{?_noautoprov:_autoreqprov=y}\
244 %{?_noautocompressdoc:_autoreqprov=y}\
245 if [ "$_autoreqprov" = "y" ] ; then \
246     if [ -f %{_builddir}/__rpm_lock ] ; then \
247         echo "Some package using \%_noauto*  macros is already being built" >&2 \
248         echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
249         exit 1 \
250     else \
251         rm -f %{_builddir}/__rpm_*\
252         touch %{_builddir}/__rpm_lock \
253     fi \
254 fi \
255 %{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\
256 %{nil}
257
258 %__os_install_post \
259 %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
260 %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
261 %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
262 %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
263 %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
264 %{__spec_install_post_strip}\
265 %{__spec_install_post_compress_docs}\
266 %{__spec_install_post_compress_modules}\
267 %{__arch_install_post}\
268 %{nil}
269
270 %__spec_clean_pre       %{___build_pre}\
271 _autoreqprov=n \
272 %{?_noautoreqfiles:_autoreqprov=y}\
273 %{?_noautoreq:_autoreqprov=y}\
274 %{?_noautoreqdep:_autoreqprov=y}\
275 %{?_noautoprovfiles:_autoreqprov=y}\
276 %{?_noautoprov:_autoreqprov=y}\
277 %{?_noautoreqfiles:_autoreqprov=y}\
278 %{?_noautocompressdoc:_autoreqprov=y}\
279 if [ "$_autoreqprov" = "y" ] ; then \
280         rm -f %{_builddir}/__rpm_* \
281 fi \
282 %{nil}
283
284
285 #%_noautoreqfiles       "%{_defaultdocdir}.*" "%{_examplesdir}.*"
286 #%_noautoreq            %{nil}
287 #%_noautoreqdep         %{nil}
288 #%_noautoprovfiles      %{nil}
289 #%_noautoprov           %{nil}
290 %_missing_doc_files_terminate_build     1%{nil}
291 %_unpackaged_files_terminate_build      %{nil}
This page took 0.429066 seconds and 4 git commands to generate.