]> git.pld-linux.org Git - packages/rpm.git/blob - rpm.macros
- added requires_releq_kernel_{up,smp}; requires_kernel_releq temporarily left for...
[packages/rpm.git] / rpm.macros
1 # PLD rpm macros
2
3 %_defaultdocdir  %{_usr}/share/doc
4 %_fixowner       [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root.@ROOT_GROUP@
5 %_fixgroup       true
6 %_topdir         %(echo $HOME)/rpm
7 %_exec_prefix    %{_prefix}
8 %_bindir         %{_exec_prefix}/bin
9 %_sbindir        %{_exec_prefix}/sbin
10 %_libexecdir     %{_exec_prefix}/lib
11 %_datadir        %{_prefix}/share
12 %_sharedstatedir %{_prefix}/com
13 %_lib            lib
14 %_libdir         %{_exec_prefix}/%{_lib}
15 %_includedir     %{_prefix}/include
16 %_oldincludedir  /usr/include
17 %_sysconfdir     /etc
18 %_localstatedir  /var
19 %_infodir        /usr/share/info
20 %_mandir         %{_prefix}/share/man
21 #-----------------------------------------------------------------
22 # CFLAGS and LDFLAGS used to build
23
24 %debugcflags    -O0 -g
25 %rpmcflags      %{?debug:%debugcflags}%{!?debug:%optflags}
26 %rpmldflags     %{!?debug:-s}
27
28 #-----------------------------------------------------------------
29 %configure2_13 { \
30  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
31  LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
32  CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
33  CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
34  FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
35  %{?__cc:CC=%{__cc} ; export CC ; } \
36  %{?__cxx:CXX=%{__cxx} ; export CXX ; } \
37  ./configure \
38         --host=%{_target_platform} \
39         --prefix=%{_prefix} \
40         --exec-prefix=%{_exec_prefix} \
41         --bindir=%{_bindir} \
42         --sbindir=%{_sbindir} \
43         --sysconfdir=%{_sysconfdir} \
44         --datadir=%{_datadir} \
45         --includedir=%{_includedir} \
46         --libdir=%{_libdir} \
47         --libexecdir=%{_libexecdir} \
48         --localstatedir=%{_localstatedir} \
49         --sharedstatedir=%{_sharedstatedir} \
50         --mandir=%{_mandir} \
51         --infodir=%{_infodir} \
52 }
53
54 #----------------------------------------------------------------
55 %configure {./configure \
56         LDFLAGS="${LDFLAGS:-%rpmldflags}" \
57         CFLAGS="${CFLAGS:-%rpmcflags}" \
58         CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
59         FFLAGS="${FFLAGS:-%rpmcflags}" \
60         %{?__cc:CC=%{__cc}} \
61         %{?__cxx:CXX=%{__cxx}} \
62         --build=%{_target_platform} \
63         --prefix=%{_prefix} \
64         --exec-prefix=%{_exec_prefix} \
65         --bindir=%{_bindir} \
66         --sbindir=%{_sbindir} \
67         --sysconfdir=%{_sysconfdir} \
68         --datadir=%{_datadir} \
69         --includedir=%{_includedir} \
70         --libdir=%{_libdir} \
71         --libexecdir=%{_libexecdir} \
72         --localstatedir=%{_localstatedir} \
73         --sharedstatedir=%{_sharedstatedir} \
74         --mandir=%{_mandir} \
75         --infodir=%{_infodir} \
76 }
77
78 # Location of autoconf macros
79 %_aclocaldir    %(aclocal --print-ac-dir)
80
81 # Location of pkgconfig files
82 %_pkgconfigdir  /usr/lib/pkgconfig
83
84 # Location of top applink dir
85 %_applnkdir      /usr/X11R6/share/applnk
86
87 # Location pixmaps for applnk/desktop files
88 %_pixmapsdir    /usr/X11R6/share/pixmaps
89
90 # Location of fonts directories
91 %_fontsdir      /usr/share/fonts
92
93 # Current date
94 %date           %(LC_ALL="C" date +"%a %b %d %Y")
95
96 # tmp directory
97 %tmpdir         %(echo "${TMPDIR:-/tmp}")
98
99 # Example files, programs, scripts...
100 %_examplesdir   /usr/src/examples
101
102 # The directory holding Linux kernel sources
103 %_kernelsrcdir  /usr/src/linux
104
105 # If non-empty "debug" macro defined, add "dbg" suffix to release number
106 %_rpmfilename           %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
107
108 # requires name = version-release
109 %requires_releq()  %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}-%%{RELEASE}' %1| grep -v "is not")
110 %requires_kernel_releq() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
111 %requires_releq_kernel_up() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-up = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
112 %requires_releq_kernel_smp() %(LC_ALL="C" rpm -q --queryformat 'Prereq:kernel-smp = %%{VERSION}-%%{RELEASE}' kernel-headers | grep -v "is not")
113
114 #-----------------------------------------------------------------
115 # find and gzip all files in %{_mandir} and %{infodir}
116 #
117 # Requires: xargs, find
118 #
119 #%no_install_post_compress_docs 1
120 %__spec_install_post_compress_docs { \
121 echo "Compress man and info pages."; \
122 %{!?no_install_post_compress_docs: \
123         %{?verbose:set -x;} \
124         for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
125                 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
126                         find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
127                         find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
128                         find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
129                 fi; \
130         done; \
131 } }
132
133 #-----------------------------------------------------------------
134 # Strip executable binaries and shared object files
135 #
136 # Requires: find, awk, strip, cut, xargs
137 #
138 #%no_install_post_strip 1
139 %__spec_install_post_strip {%{!?debug: \
140 %{!?no_install_post_strip: \
141         %{?verbose:set -x;} \
142         echo "Strip executable binaries and shared object files."; \
143         filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
144         elfexelist=`echo $filelist | xargs -r file | \
145                 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
146         elfsharedlist=`echo $filelist | xargs -r file | \
147                 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
148         if [ -n "$elfexelist" ]; then \
149                 strip --remove-section=.note  --remove-section=.comment $elfexelist; \
150         fi; \
151         if [ -n "$elfsharedlist" ]; then \
152                 strip --strip-unneeded --remove-section=.note  --remove-section=.comment $elfsharedlist; \
153         fi; } \
154 } }
155
156 %_source_payload        w9.gzdio
157 %_binary_payload        w9.bzdio
158
159 #-----------------------------------------------------------------
160 # post %install sequence:
161 # - autodeps exceptions
162 # - compress all man and info pages,
163 # - strip all ELF executables and ELF shared objects if not %debug.
164
165 ###################################################################
166 # Requires/Provides automation
167 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
168 %__spec_prep_pre \
169 _autoreqprov=n \
170 %{?_noautoreqfiles:_autoreqprov=y}\
171 %{?_noautoreq:_autoreqprov=y}\
172 %{?_noautoreqdep:_autoreqprov=y}\
173 %{?_noautoprovfiles:_autoreqprov=y}\
174 %{?_noautoprov:_autoreqprov=y}\
175 if [ "$_autoreqprov" = "y" ] ; then \
176     if [ -f %{_builddir}/__rpm_lock ] ; then \
177         echo "Some package using \%_noauto*  macros is already being built" >&2 \
178         echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
179         exit 1 \
180     else \
181         rm -f %{_builddir}/__rpm_*\
182         touch %{_builddir}/__rpm_lock \
183     fi \
184 fi \
185 %{nil}
186
187 %__os_install_post \
188 %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
189 %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
190 %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
191 %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
192 %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
193 %{__spec_install_post_strip}\
194 %{__spec_install_post_compress_docs}\
195 %{__arch_install_post}\
196 %{nil}
197
198 %__spec_clean_pre       %{___build_pre}\
199 _autoreqprov=n \
200 %{?_noautoreqfiles:_autoreqprov=y}\
201 %{?_noautoreq:_autoreqprov=y}\
202 %{?_noautoreqdep:_autoreqprov=y}\
203 %{?_noautoprovfiles:_autoreqprov=y}\
204 %{?_noautoprov:_autoreqprov=y}\
205 %{?_noautoreqfiles:_autoreqprov=y}\
206 if [ "$_autoreqprov" = "y" ] ; then \
207         rm -f %{_builddir}/__rpm_* \
208 fi \
209 %{nil}
210
211
212 #%_noautoreqfiles       "%{_defaultdocdir}.*" "%{_examplesdir}.*"
213 #%_noautoreq            %{nil}
214 #%_noautoreqdep         %{nil}
215 #%_noautoprovfiles      %{nil}
216 #%_noautoprov           %{nil}
This page took 0.038241 seconds and 4 git commands to generate.