- don't allow to build more that one package using %%_noauto* macros on the
[packages/rpm-build-macros.git] / rpm.macros
CommitLineData
9c404149
AM
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%configure { \
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 \
2a7cfd3f 16 --host=%{_target_platform} \
9c404149
AM
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# The GNUconfigure macro does the following:
34# update config.guess and config.sub.
35# regenerate all autoconf/automake files
36# optionally change to a directory (make the directory if requested).
37# run configure with correct prefix, platform, and CFLAGS.
38# optionally restore current directory.
39#
40# Based on autogen.sh from GNOME and orginal GNUconfigure
41#
42%GNUconfigure(MCs:) \
43 %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
44 dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
45 for coin in `echo ${dirs}` \
46do \
47 dr=`dirname ${coin}`; \
48if test -f ${dr}/NO-AUTO-GEN; then \
49 : \
50else \
51 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
52 ( cd ${dr}; \
53 aclocalinclude="${ACLOCAL_FLAGS}"; \
54 for k in ${macrodirs}; do \
55 if test -d ${k}; then \
56 aclocalinclude="${aclocalinclude} -I ${k}"; \
57 ##else \
58 ## echo "**Warning**: No such directory \`${k}'. Ignored." \
59 fi \
60 done \
61 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
62 if grep "sed.*POTFILES" configure.in >/dev/null; then \
63 : do nothing -- we still have an old unmodified configure.in \
64 else \
65 test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
66 echo "no" | gettextize --force --copy; \
67 test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
68 fi \
69 fi \
70 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
71 %{__libtoolize} --force --copy; \
72 fi \
73 aclocal ${aclocalinclude}; \
74 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
75 %{__autoheader}; \
76 fi \
77 echo "Running automake --gnu ${am_opt} ..."; \
78 %{__automake} --add-missing --gnu ${am_opt}; \
79 %{__autoconf}; \
80 ); \
81 fi \
82done \
83 %{-C:${_mydir}}%{!-C:.}/%{configure} \
84 %{-C:cd ${_mydir}; unset _mydir}
85
86# Location of autoconf macros
87%_aclocaldir %(aclocal --print-ac-dir)
88
e987a186 89# Location of pkgconfig files
d7021551 90%_pkgconfigdir /usr/lib/pkgconfig
e987a186 91
9c404149
AM
92# Location of top applink dir
93%_applnkdir /usr/X11R6/share/applnk
94
95# Location pixmaps for applnk/desktop files
96%_pixmapsdir /usr/X11R6/share/pixmaps
97
e987a186
JB
98# Location of fonts directories
99%_fontsdir /usr/share/fonts
100
9c404149
AM
101# Current date
102%date %(LC_ALL="C" date +"%a %b %d %Y")
103
104# tmp directory
105%tmpdir %(echo "${TMPDIR:-/tmp}")
106
107# Example files, programs, scripts...
108%_examplesdir /usr/src/examples
109
110# If non-empty "debug" macro defined, add "dbg" suffix to release number
111%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
112
113#-----------------------------------------------------------------
114# find and gzip all files in %{_mandir} and %{infodir}
115#
116# Requires: xargs, find
117#
118#%no_install_post_compress_docs 1
119%__spec_install_post_compress_docs { \
120echo "Compress man and info pages."; \
121%{!?no_install_post_compress_docs: \
122 %{?verbose:set -x;} \
123 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
124 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
125 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
126 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
127 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
128 fi; \
129 done; \
130} }
131
132#-----------------------------------------------------------------
133# Strip executable binaries and shared object files
134#
135# Requires: find, awk, strip, cut, xargs
136#
137#%no_install_post_strip 1
138%__spec_install_post_strip {%{!?debug: \
139%{!?no_install_post_strip: \
140 %{?verbose:set -x;} \
141 echo "Strip executable binaries and shared object files."; \
142 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
143 elfexelist=`echo $filelist | xargs -r file | \
144 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
145 elfsharedlist=`echo $filelist | xargs -r file | \
146 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
147 if [ -n "$elfexelist" ]; then \
148 strip --remove-section=.note --remove-section=.comment $elfexelist; \
149 fi; \
150 if [ -n "$elfsharedlist" ]; then \
151 strip --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
152 fi; } \
153} }
154
155%_source_payload w9.gzdio
156%_binary_payload w9.bzdio
157
158#-----------------------------------------------------------------
159# post %install sequence:
160# - autodeps exceptions
161# - compress all man and info pages,
162# - strip all ELF executables and ELF shared objects if not %debug.
163
164###################################################################
165# Requires/Provides automation
166# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
7126cc1b
JK
167%__spec_prep_pre \
168_autoreqprov=n \
169%{?_noautoreqfiles:_autoreqprov=y}\
170%{?_noautoreq:_autoreqprov=y}\
171%{?_noautoreqdep:_autoreqprov=y}\
172%{?_noautoprovfiles:_autoreqprov=y}\
173%{?_noautoprov:_autoreqprov=y}\
174if [ "$_autoreqprov" = "y" ] ; then \
175 if [ -f %{_builddir}/__rpm_lock ] ; then \
176 echo "Some package using \%_noauto* macros is already being built" >&2 \
177 echo "If it is not true delete %{_builddir}/__rpm_lock" >&2 \
178 exit 1 \
179 else \
180 rm -f %{_builddir}/__rpm_*\
181 touch %{_builddir}/__rpm_lock \
182 fi \
183fi \
9c404149
AM
184%{nil}
185
186%__spec_install_post \
187%{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
188%{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
189%{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
190%{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
191%{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
192%{__spec_install_post_strip}\
193%{__spec_install_post_compress_docs}\
194%{__arch_install_post}\
195%{__os_install_post}\
196%{nil}
197
198%__spec_clean_pre %{___build_pre}\
7126cc1b
JK
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}\
206if [ "$_autoreqprov" = "y" ] ; then \
207 rm -f %{_builddir}/__rpm_* \
208fi \
9c404149
AM
209%{nil}
210
211
212#%_noautoreqfiles "%{_defaultdocdir}.*" "%{_examplesdir}.*"
213#%_noautoreq %{nil}
214#%_noautoreqdep %{nil}
215#%_noautoprovfiles %{nil}
216#%_noautoprov %{nil}
217
218
This page took 0.158258 seconds and 4 git commands to generate.