]> git.pld-linux.org Git - packages/rpm.git/blob - rpm.macros
use ./configure --host=%{_host} instead of ./configure %{_host} (prepare for new...
[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 %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 \
16         --host=%{_host} \
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}` \
46 do \
47   dr=`dirname ${coin}`; \
48 if test -f ${dr}/NO-AUTO-GEN; then \
49  : \
50 else \
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 \
82 done \
83   %{-C:${_mydir}}%{!-C:.}/%{configure} \
84   %{-C:cd ${_mydir}; unset _mydir}
85
86 # Location of autoconf macros
87 %_aclocaldir    %(aclocal --print-ac-dir)
88
89 # Location of top applink dir
90 %_applnkdir      /usr/X11R6/share/applnk
91
92 # Location pixmaps for applnk/desktop files
93 %_pixmapsdir    /usr/X11R6/share/pixmaps
94
95 # Current date
96 %date           %(LC_ALL="C" date +"%a %b %d %Y")
97
98 # tmp directory
99 %tmpdir         %(echo "${TMPDIR:-/tmp}")
100
101 # Example files, programs, scripts...
102 %_examplesdir   /usr/src/examples
103
104 # If non-empty "debug" macro defined, add "dbg" suffix to release number
105 %_rpmfilename           %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
106
107 #-----------------------------------------------------------------
108 # find and gzip all files in %{_mandir} and %{infodir}
109 #
110 # Requires: xargs, find
111 #
112 #%no_install_post_compress_docs 1
113 %__spec_install_post_compress_docs { \
114 echo "Compress man and info pages."; \
115 %{!?no_install_post_compress_docs: \
116         %{?verbose:set -x;} \
117         for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
118                 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
119                         find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
120                         find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
121                         find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
122                 fi; \
123         done; \
124 } }
125
126 #-----------------------------------------------------------------
127 # Strip executable binaries and shared object files
128 #
129 # Requires: find, awk, strip, cut, xargs
130 #
131 #%no_install_post_strip 1
132 %__spec_install_post_strip {%{!?debug: \
133 %{!?no_install_post_strip: \
134         %{?verbose:set -x;} \
135         echo "Strip executable binaries and shared object files."; \
136         filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*"`; \
137         elfexelist=`echo $filelist | xargs -r file | \
138                 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
139         elfsharedlist=`echo $filelist | xargs -r file | \
140                 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
141         if [ -n "$elfexelist" ]; then \
142                 strip --remove-section=.note  --remove-section=.comment $elfexelist; \
143         fi; \
144         if [ -n "$elfsharedlist" ]; then \
145                 strip --strip-unneeded --remove-section=.note  --remove-section=.comment $elfsharedlist; \
146         fi; } \
147 } }
148
149 %_source_payload        w9.gzdio
150 %_binary_payload        w9.bzdio
151
152 #-----------------------------------------------------------------
153 # post %install sequence:
154 # - autodeps exceptions
155 # - compress all man and info pages,
156 # - strip all ELF executables and ELF shared objects if not %debug.
157
158 ###################################################################
159 # Requires/Provides automation
160 # exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
161 %__spec_install_pre     %{___build_pre}\
162 rm -f %{_builddir}/__rpm_*\
163 %{nil}
164
165 %__spec_install_post \
166 %{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
167 %{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
168 %{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
169 %{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
170 %{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
171 %{__spec_install_post_strip}\
172 %{__spec_install_post_compress_docs}\
173 %{__arch_install_post}\
174 %{__os_install_post}\
175 %{nil}
176
177 %__spec_clean_pre       %{___build_pre}\
178 rm -f %{_builddir}/__rpm_*\
179 %{nil}
180
181
182 #%_noautoreqfiles       "%{_defaultdocdir}.*" "%{_examplesdir}.*"
183 #%_noautoreq            %{nil}
184 #%_noautoreqdep         %{nil}
185 #%_noautoprovfiles      %{nil}
186 #%_noautoprov           %{nil}
187
188
This page took 0.061771 seconds and 4 git commands to generate.