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