]> git.pld-linux.org Git - packages/rpm.git/blob - rpm.macros
- new macro: %_kernelsrcdir
[packages/rpm.git] / rpm.macros
1 #-----------------------------------------------------------------
2 # CFLAGS and LDFLAGS used to build
3
4 %debugcflags    -O0 -g
5 %rpmcflags      %{?debug:%debugcflags}%{!?debug:%optflags}
6 %rpmldflags     %{!?debug:-s}
7
8 #-----------------------------------------------------------------
9 %configure2_13 { \
10  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
11  LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
12  CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
13  CXXFLAGS="${CXXFLAGS:-%rpmcflags}" ; export CXXFLAGS ; \
14  FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
15  ./configure \
16         --host=%{_target_platform} \
17         --prefix=%{_prefix} \
18         --exec-prefix=%{_exec_prefix} \
19         --bindir=%{_bindir} \
20         --sbindir=%{_sbindir} \
21         --sysconfdir=%{_sysconfdir} \
22         --datadir=%{_datadir} \
23         --includedir=%{_includedir} \
24         --libdir=%{_libdir} \
25         --libexecdir=%{_libexecdir} \
26         --localstatedir=%{_localstatedir} \
27         --sharedstatedir=%{_sharedstatedir} \
28         --mandir=%{_mandir} \
29         --infodir=%{_infodir} \
30 }
31
32 #----------------------------------------------------------------
33 %configure {./configure \
34         LDFLAGS="${LDFLAGS:-%rpmldflags}" \
35         CFLAGS="${CFLAGS:-%rpmcflags}" \
36         CXXFLAGS="${CXXFLAGS:-%rpmcflags}" \
37         FFLAGS="${FFLAGS:-%rpmcflags}" \
38         %{?__cc:CC=%{__cc}} \
39         %{?__cxx:CXX=%{__cxx}} \
40         --build=%{_target_platform} \
41         --prefix=%{_prefix} \
42         --exec-prefix=%{_exec_prefix} \
43         --bindir=%{_bindir} \
44         --sbindir=%{_sbindir} \
45         --sysconfdir=%{_sysconfdir} \
46         --datadir=%{_datadir} \
47         --includedir=%{_includedir} \
48         --libdir=%{_libdir} \
49         --libexecdir=%{_libexecdir} \
50         --localstatedir=%{_localstatedir} \
51         --sharedstatedir=%{_sharedstatedir} \
52         --mandir=%{_mandir} \
53         --infodir=%{_infodir} \
54 }
55
56 #------------------------------------------------------------------------------
57 # The GNUconfigure macro does the following:
58 #       update config.guess and config.sub.
59 #       regenerate all autoconf/automake files
60 #       optionally change to a directory (make the directory if requested).
61 #       run configure with correct prefix, platform, and CFLAGS.
62 #       optionally restore current directory.
63 #
64 # Based on autogen.sh from GNOME and orginal GNUconfigure
65 #
66 %GNUconfigure(MCs:)      \
67   %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
68   dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
69     for coin in `echo ${dirs}` \
70 do \
71   dr=`dirname ${coin}`; \
72 if test -f ${dr}/NO-AUTO-GEN; then \
73  : \
74 else \
75      macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
76     ( cd ${dr}; \
77       aclocalinclude="${ACLOCAL_FLAGS}"; \
78       for k in ${macrodirs}; do \
79         if test -d ${k}; then \
80           aclocalinclude="${aclocalinclude} -I ${k}"; \
81         ##else \
82         ##  echo "**Warning**: No such directory \`${k}'.  Ignored." \
83         fi \
84       done \
85       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
86         if grep "sed.*POTFILES" configure.in >/dev/null; then \
87           : do nothing -- we still have an old unmodified configure.in \
88         else \
89           test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
90           echo "no" | gettextize --force --copy; \
91           test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
92         fi \
93       fi \
94       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
95         %{__libtoolize} --force --copy; \
96       fi \
97       aclocal ${aclocalinclude}; \
98       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
99         %{__autoheader}; \
100       fi \
101       echo "Running automake --gnu ${am_opt} ..."; \
102       %{__automake} --add-missing --gnu ${am_opt}; \
103       %{__autoconf}; \
104     ); \
105   fi \
106 done \
107   %{-C:${_mydir}}%{!-C:.}/%{configure} \
108   %{-C:cd ${_mydir}; unset _mydir}
109
110 # Location of autoconf macros
111 %_aclocaldir    %(aclocal --print-ac-dir)
112
113 # Location of pkgconfig files
114 %_pkgconfigdir  /usr/lib/pkgconfig
115
116 # Location of top applink dir
117 %_applnkdir      /usr/X11R6/share/applnk
118
119 # Location pixmaps for applnk/desktop files
120 %_pixmapsdir    /usr/X11R6/share/pixmaps
121
122 # Location of fonts directories
123 %_fontsdir      /usr/share/fonts
124
125 # Current date
126 %date           %(LC_ALL="C" date +"%a %b %d %Y")
127
128 # tmp directory
129 %tmpdir         %(echo "${TMPDIR:-/tmp}")
130
131 # Example files, programs, scripts...
132 %_examplesdir   /usr/src/examples
133
134 # The directory holding Linux kernel sources
135 %_kernelsrcdir  /usr/src/linux
136
137 # If non-empty "debug" macro defined, add "dbg" suffix to release number
138 %_rpmfilename           %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
139
140 #-----------------------------------------------------------------
141 # find and gzip all files in %{_mandir} and %{infodir}
142 #
143 # Requires: xargs, find
144 #
145 #%no_install_post_compress_docs 1
146 %__spec_install_post_compress_docs { \
147 echo "Compress man and info pages."; \
148 %{!?no_install_post_compress_docs: \
149         %{?verbose:set -x;} \
150         for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
151                 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
152                         find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
153                         find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
154                         find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
155                 fi; \
156         done; \
157 } }
158
159 #-----------------------------------------------------------------
160 # Strip executable binaries and shared object files
161 #
162 # Requires: find, awk, strip, cut, xargs
163 #
164 #%no_install_post_strip 1
165 %__spec_install_post_strip {%{!?debug: \
166 %{!?no_install_post_strip: \
167         %{?verbose:set -x;} \
168         echo "Strip executable binaries and shared object files."; \
169         filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
170         elfexelist=`echo $filelist | xargs -r file | \
171                 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
172         elfsharedlist=`echo $filelist | xargs -r file | \
173                 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
174         if [ -n "$elfexelist" ]; then \
175                 strip --remove-section=.note  --remove-section=.comment $elfexelist; \
176         fi; \
177         if [ -n "$elfsharedlist" ]; then \
178                 strip --strip-unneeded --remove-section=.note  --remove-section=.comment $elfsharedlist; \
179         fi; } \
180 } }
181
182 %_source_payload        w9.gzdio
183 %_binary_payload        w9.bzdio
184
185 #-----------------------------------------------------------------
186 # post %install sequence:
187 # - autodeps exceptions
188 # - compress all man and info pages,
189 # - strip all ELF executables and ELF shared objects if not %debug.
190
191 ###################################################################
192 # Requires/Provides automation
193 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
194 %__spec_prep_pre \
195 _autoreqprov=n \
196 %{?_noautoreqfiles:_autoreqprov=y}\
197 %{?_noautoreq:_autoreqprov=y}\
198 %{?_noautoreqdep:_autoreqprov=y}\
199 %{?_noautoprovfiles:_autoreqprov=y}\
200 %{?_noautoprov:_autoreqprov=y}\
201 if [ "$_autoreqprov" = "y" ] ; then \
202     if [ -f %{_builddir}/__rpm_lock ] ; then \
203         echo "Some package using \%_noauto*  macros is already being built" >&2 \
204         echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
205         exit 1 \
206     else \
207         rm -f %{_builddir}/__rpm_*\
208         touch %{_builddir}/__rpm_lock \
209     fi \
210 fi \
211 %{nil}
212
213 %__spec_install_post \
214 %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
215 %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
216 %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
217 %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
218 %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
219 %{__spec_install_post_strip}\
220 %{__spec_install_post_compress_docs}\
221 %{__arch_install_post}\
222 %{__os_install_post}\
223 %{nil}
224
225 %__spec_clean_pre       %{___build_pre}\
226 _autoreqprov=n \
227 %{?_noautoreqfiles:_autoreqprov=y}\
228 %{?_noautoreq:_autoreqprov=y}\
229 %{?_noautoreqdep:_autoreqprov=y}\
230 %{?_noautoprovfiles:_autoreqprov=y}\
231 %{?_noautoprov:_autoreqprov=y}\
232 %{?_noautoreqfiles:_autoreqprov=y}\
233 if [ "$_autoreqprov" = "y" ] ; then \
234         rm -f %{_builddir}/__rpm_* \
235 fi \
236 %{nil}
237
238
239 #%_noautoreqfiles       "%{_defaultdocdir}.*" "%{_examplesdir}.*"
240 #%_noautoreq            %{nil}
241 #%_noautoreqdep         %{nil}
242 #%_noautoprovfiles      %{nil}
243 #%_noautoprov           %{nil}
This page took 0.053448 seconds and 4 git commands to generate.