Modify eu-strip option to perform strip in post script of rpm package & add option...
[platform/upstream/rpm.git] / packaging / rpm-tizen_macros
1 # directories
2 %_infodir               %{_prefix}/share/info
3 %_mandir                %{_prefix}/share/man
4 %_sysconfdir            /etc
5 %_localstatedir         /var
6 %_defaultdocdir         %{_usr}/share/doc/packages
7
8 # _rootprefix can be set to (/,%{_prefix}) to customize systemd installation)
9 %_rootprefix %{_prefix}
10 %_unitdir_user %{_prefix}/lib/systemd/user
11 %_unitdir %{_rootprefix}/lib/systemd/system
12
13 # package build macros
14 # %make_install           make install DESTDIR=%{?buildroot}
15 # %makeinstall            make DESTDIR=%{?buildroot:%{buildroot}} install
16 %rb_arch                %(echo %{_host_cpu}-linux | sed -e "s/i686/i586/" -e "s/armv5tel/armv4l/" -e "s/hppa2.0/hppa/")
17 %rb_ver                 %(/usr/bin/ruby -e 'puts VERSION.sub(/\\\.\\\d$/, "")')
18
19 # external kernel module helper macro(s)
20 %kernel_devel_uname_r %(/bin/rpm -q --provides $(/bin/rpm -q --whatprovides kernel-devel-uname-r) | sed -ne 's,kernel-devel-uname-r = ,, p')
21 %kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel))
22 %kernel_name    %(/bin/rpm -q --queryformat '%{RPMTAG_NAME}' $(/bin/rpm -q --whatprovides kernel))
23
24 # this script calls all scripts in /usr/lib/rpm/brp-tizen.d
25 %__arch_install_post   /usr/lib/rpm/check-buildroot
26
27 %__strip_install_post    \
28     %{!?__debug_package:/usr/lib/rpm/brp-strip %{__strip}} \
29     /usr/lib/rpm/brp-strip-static-archive %{__strip} \
30 #    /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
31 %{nil}
32
33 %__os_install_post    \
34     /usr/lib/rpm//brp-compress \
35     %{!?_rpm_strip_disable:%{__strip_install_post}}\
36     /usr/lib/rpm/brp-python-hardlink \
37     %{!?disable_docs_package:/usr/lib/rpm/tizen/find-docs.sh %{buildroot}} \
38 %{nil}
39
40 #    /usr/lib/rpm/tizen/brp-implant-ident-static
41
42 %__spec_install_post\
43     %{?__debug_package:%{__debug_install_post}}\
44     %{__arch_install_post}\
45     %{__os_install_post}\
46 %{nil}
47
48 # macro: %configure_kernel_source
49 #
50 #
51 %configure_kernel_source() \
52         if test -d /usr/src/linux ; then \
53             pushd /usr/src/linux \
54             test -f .config || cp arch/%_arch/defconfig.default .config \
55             yes "" | make oldconfig \
56             make dep \
57             popd \
58         fi \
59         %nil
60
61 %install_info(:-:) \
62     ALL_ARGS=(%{**}) \
63     NUM_ARGS=${#ALL_ARGS[@]} \
64     if test -x /sbin/install-info ; then \
65         if test -e "${ALL_ARGS[$((NUM_ARGS-1))]}" ; then \
66             /sbin/install-info "${ALL_ARGS[@]}" \
67         fi \
68     fi ; 
69
70 %install_info_delete(:-:) \
71     ALL_ARGS=(%{**}) \
72     NUM_ARGS=${#ALL_ARGS[@]} \
73     if test -x /sbin/install-info ; then \
74         if ! test -e "${ALL_ARGS[$((NUM_ARGS-1))]}" ; then \
75             /sbin/install-info --quiet --delete "${ALL_ARGS[@]}" \
76         fi ; \
77     fi ; 
78
79 # find-supplements.ksyms parses this macro directly out of the spec file:
80 %supplements_kernel_module() \
81     %{expand:%(if ! rpm -q kernel-syms > /dev/null; then echo "%fail Please add the kernel-syms package to BuildRequires"; fi)}
82
83 %do_profiling 1
84 %cflags_profile_generate -fprofile-generate
85 %cflags_profile_feedback -fprofile-use
86
87
88
89 # Tizen
90 #
91 %configure \
92   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
93   CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
94   FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
95   ./configure --build=%{_build} --host=%{_host} \\\
96         --program-prefix=%{?_program_prefix} \\\
97         --prefix=%{_prefix} \\\
98         --exec-prefix=%{_exec_prefix} \\\
99         --bindir=%{_bindir} \\\
100         --sbindir=%{_sbindir} \\\
101         --sysconfdir=%{_sysconfdir} \\\
102         --datadir=%{_datadir} \\\
103         --includedir=%{_includedir} \\\
104         --libdir=%{_libdir} \\\
105         --libexecdir=%{_libexecdir} \\\
106         --localstatedir=%{_localstatedir} \\\
107         --sharedstatedir=%{_sharedstatedir} \\\
108         --mandir=%{_mandir} \\\
109         --infodir=%{_infodir}
110
111
112 %reconfigure \
113   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
114   CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
115   FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
116   autoreconf -v --install --force || exit 1 \
117   ./configure --build=%{_build} --host=%{_host} \\\
118         --program-prefix=%{?_program_prefix} \\\
119         --prefix=%{_prefix} \\\
120         --exec-prefix=%{_exec_prefix} \\\
121         --bindir=%{_bindir} \\\
122         --sbindir=%{_sbindir} \\\
123         --sysconfdir=%{_sysconfdir} \\\
124         --datadir=%{_datadir} \\\
125         --includedir=%{_includedir} \\\
126         --libdir=%{_libdir} \\\
127         --libexecdir=%{_libexecdir} \\\
128         --localstatedir=%{_localstatedir} \\\
129         --sharedstatedir=%{_sharedstatedir} \\\
130         --mandir=%{_mandir} \\\
131         --infodir=%{_infodir}
132
133 %autogen \
134   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
135   CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
136   FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
137   ./autogen.sh --build=%{_build} --host=%{_host} \\\
138         --program-prefix=%{?_program_prefix} \\\
139         --prefix=%{_prefix} \\\
140         --exec-prefix=%{_exec_prefix} \\\
141         --bindir=%{_bindir} \\\
142         --sbindir=%{_sbindir} \\\
143         --sysconfdir=%{_sysconfdir} \\\
144         --datadir=%{_datadir} \\\
145         --includedir=%{_includedir} \\\
146         --libdir=%{_libdir} \\\
147         --libexecdir=%{_libexecdir} \\\
148         --localstatedir=%{_localstatedir} \\\
149         --sharedstatedir=%{_sharedstatedir} \\\
150         --mandir=%{_mandir} \\\
151         --infodir=%{_infodir}
152
153
154 %makeinstall \
155   %{__make} \\\
156         prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
157         exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
158         bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
159         sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
160         sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
161         datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
162         includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
163         libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
164         libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
165         localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
166         sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
167         mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
168         infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
169   install
170
171
172 %make_install \
173   %{__make} \\\
174         DESTDIR=%{?buildroot:%{buildroot}} \\\
175         INSTALL_ROOT=%{?buildroot:%{buildroot}} \\\
176   install  \
177   rm -f %{?buildroot:%{buildroot}}%{_infodir}/dir \
178   find %{?buildroot:%{buildroot}} -regex ".*\\.la$" | xargs rm -f -- \
179   %{!?keepstatic:find %{?buildroot:%{buildroot}} -regex ".*\\.a$" | xargs rm -f --}
180
181 %_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
182         && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
183         [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS")
184
185 %lang_package(n:f:) \
186 %package %{-n:-n %{-n*}-}locale \
187 Summary: Translations and Locale for package %{name}\
188 Requires: %{-n:%{-n*}}%{!-n:%{name}} = %{version} \
189 Provides: %{-n:%{-n*}}%{!-n:%{name}}-lang-all = %{version} \
190 BuildArch:  noarch \
191 %description %{-n:-n %{-n*}-}locale\
192 This package provides translations for package %{name}.\
193 %files %{-n:-n %{-n*}-}locale -f %{-f:%{-f*}.lang} %{!-f:%{name}.lang}\
194 %defattr(-,root,root,-)\
195 %{nil}
196
197 %docs_package \
198 %package docs \
199 Summary: Documentation for package %{name}\
200 AutoReqProv: 0\
201 %description docs\
202 This package provides documentation for package %{name}.\
203 %files docs -f documentation.list\
204 %defattr(-,root,root,-)\
205 %{nil}
206
207 # Bad hack to set $LANG to C during all RPM builds
208 %prep \
209 %%prep\
210 LANG=C\
211 export LANG\
212 unset DISPLAY\
213 %{nil}
214
215 %build %%build\
216 LANG=C\
217 export LANG\
218 unset DISPLAY\
219 CFLAGS="%optflags" ; export CFLAGS ; \
220 CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
221 FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
222 LDFLAGS="${LDFLAGS:-%{?global_LDFLAGS}}"; export LDFLAGS ; \
223 LD_AS_NEEDED=1; export LD_AS_NEEDED ; \
224 %{nil}
225
226 %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
227 %%install\
228 LANG=C\
229 export LANG\
230 unset DISPLAY\
231 rm -rf %{?buildroot:%{buildroot}} \
232 mkdir -p %{?buildroot:%{buildroot}} \
233 %{nil}
234
235
236 %clean %%clean\
237 rm -rf %{?buildroot:%{buildroot}} \
238 %{nil}
239
240 %find_lang      /usr/lib/rpm/find-lang.sh %{buildroot}
241 %find_docs      /usr/lib/rpm/tizen/find-docs.sh %{buildroot}
242
243
244
245 #==============================================================================
246 # ---- default .desktop directories per the desktop-entry freedesktop.org spec
247
248 %_desktopdir    %{_datadir}/applications
249
250 #==============================================================================
251 # ---- Generic auto req/prov filtering macros
252 #
253 # http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering
254
255 # prevent anything matching from being scanned for provides
256 %filter_provides_in(P) %{expand: \
257 %global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
258 }
259
260 # prevent anything matching from being scanned for requires
261 %filter_requires_in(P) %{expand: \
262 %global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
263 }
264
265 # filter anything matching out of the provides stream
266 %filter_from_provides() %{expand: \
267 %global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
268 }
269
270 # filter anything matching out of the requires stream
271 %filter_from_requires() %{expand: \
272 %global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
273 }
274
275 # actually set up the filtering bits
276 %filter_setup %{expand: \
277 %global _use_internal_dependency_generator 0 \
278 %global __deploop() while read FILE; do /usr/lib/rpm/rpmdeps -%{1} ${FILE}; done | /bin/sort -u \
279 %global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
280 %global __find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}" \
281 }
282
283 %remove_docs \
284   rm -rf %{?buildroot:%{buildroot}}%{_infodir} \
285   rm -rf %{?buildroot:%{buildroot}}%{_defaultdocdir} \
286   rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc/%{name} \
287   rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc/%{name}-%{version} \
288   rm -rf %{?buildroot:%{buildroot}}%{_datadir}/gtk-doc \
289   rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc \
290   rm -rf %{?buildroot:%{buildroot}}%{_datadir}/man \
291   find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]" | xargs rm -f -- \
292   find %{?buildroot:%{buildroot}} -regex ".*/man/../man./.*\.[0-9]" | xargs rm -f -- \
293   find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]pm" | xargs rm -f --
294
295
296 %install_service() \
297 mkdir -p %{buildroot}/%{_unitdir}/%{1} \
298 ln -s ../%{2}  %{buildroot}/%{_unitdir}/%{1}/%{2}  \
299 %{nil}
300
301
302 %_fontsdir               %{_usr}/share/fonts
303 %_ttfontsdir             %{_fontsdir}/truetype
304 %_miscfontsdir           %{_fontsdir}/misc
305 %_fontsconfdir           %{_sysconfdir}/fonts
306 %_fontsconfddir          %{_fontsconfdir}/conf.d
307 %_fontsconfavaildir      %{_datadir}/%{name}/conf.avail
308
309 %devel_package \
310 %package devel \
311 Summary: Development files for package %{name}\
312 Group: Development\
313 %description devel\
314 This package provides header files and other developer releated files for package %{name}.\
315 %files devel \
316 %{_includedir}/*\
317 %{_libdir}/pkgconfig/*.pc\
318 %{_libdir}/*.so\
319 %{nil}
320
321 %devel_desc This package contains all necessary include files and libraries needed \
322 to develop applications that require %{name}.\
323 %{nil}
324