summaryrefslogtreecommitdiff
path: root/packaging/rpm-tizen_macros
blob: 9db0c4bdc2012a01daaea6ad4f50f5b5baa0a9ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# directories
%_infodir               %{_prefix}/share/info
%_mandir                %{_prefix}/share/man
%_sysconfdir            /etc
%_localstatedir         /var
%_defaultdocdir         %{_usr}/share/doc/packages

# _rootprefix can be set to (/,%{_prefix}) to customize systemd installation)
%_rootprefix %{_prefix}
%_unitdir_user %{_prefix}/lib/systemd/user
%_unitdir %{_rootprefix}/lib/systemd/system

# package build macros
# %make_install           make install DESTDIR=%{?buildroot}
# %makeinstall            make DESTDIR=%{?buildroot:%{buildroot}} install
%rb_arch                %(echo %{_host_cpu}-linux | sed -e "s/i686/i586/" -e "s/armv5tel/armv4l/" -e "s/hppa2.0/hppa/")
%rb_ver                 %(/usr/bin/ruby -e 'puts VERSION.sub(/\\\.\\\d$/, "")')

# external kernel module helper macro(s)
%kernel_devel_uname_r %(/bin/rpm -q --provides $(/bin/rpm -q --whatprovides kernel-devel-uname-r) | sed -ne 's,kernel-devel-uname-r = ,, p')
%kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel))
%kernel_name    %(/bin/rpm -q --queryformat '%{RPMTAG_NAME}' $(/bin/rpm -q --whatprovides kernel))

# this script calls all scripts in /usr/lib/rpm/brp-tizen.d
%__arch_install_post   /usr/lib/rpm/check-buildroot

%__strip_install_post    \
    %{!?__debug_package:/usr/lib/rpm/brp-strip %{__strip}} \
    /usr/lib/rpm/brp-strip-static-archive %{__strip} \
#    /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
%{nil}

%__os_install_post    \
    /usr/lib/rpm//brp-compress \
    %{!?_rpm_strip_disable:%{__strip_install_post}}\
    /usr/lib/rpm/brp-python-hardlink \
    %{!?disable_docs_package:/usr/lib/rpm/tizen/find-docs.sh %{buildroot}} \
%{nil}

#    /usr/lib/rpm/tizen/brp-implant-ident-static

%__spec_install_post\
    %{?__debug_package:%{__debug_install_post}}\
    %{__arch_install_post}\
    %{__os_install_post}\
%{nil}

# macro: %configure_kernel_source
#
#
%configure_kernel_source() \
	if test -d /usr/src/linux ; then \
	    pushd /usr/src/linux \
	    test -f .config || cp arch/%_arch/defconfig.default .config \
	    yes "" | make oldconfig \
	    make dep \
	    popd \
	fi \
	%nil

%install_info(:-:) \
    ALL_ARGS=(%{**}) \
    NUM_ARGS=${#ALL_ARGS[@]} \
    if test -x /sbin/install-info ; then \
	if test -e "${ALL_ARGS[$((NUM_ARGS-1))]}" ; then \
	    /sbin/install-info "${ALL_ARGS[@]}" \
	fi \
    fi ; 

%install_info_delete(:-:) \
    ALL_ARGS=(%{**}) \
    NUM_ARGS=${#ALL_ARGS[@]} \
    if test -x /sbin/install-info ; then \
	if ! test -e "${ALL_ARGS[$((NUM_ARGS-1))]}" ; then \
	    /sbin/install-info --quiet --delete "${ALL_ARGS[@]}" \
	fi ; \
    fi ; 

# find-supplements.ksyms parses this macro directly out of the spec file:
%supplements_kernel_module() \
    %{expand:%(if ! rpm -q kernel-syms > /dev/null; then echo "%fail Please add the kernel-syms package to BuildRequires"; fi)}

%do_profiling 1
%cflags_profile_generate -fprofile-generate
%cflags_profile_feedback -fprofile-use



# Tizen
#
%configure \
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
  ./configure --build=%{_build} --host=%{_host} \\\
        --program-prefix=%{?_program_prefix} \\\
        --prefix=%{_prefix} \\\
        --exec-prefix=%{_exec_prefix} \\\
        --bindir=%{_bindir} \\\
        --sbindir=%{_sbindir} \\\
        --sysconfdir=%{_sysconfdir} \\\
        --datadir=%{_datadir} \\\
        --includedir=%{_includedir} \\\
        --libdir=%{_libdir} \\\
        --libexecdir=%{_libexecdir} \\\
        --localstatedir=%{_localstatedir} \\\
        --sharedstatedir=%{_sharedstatedir} \\\
        --mandir=%{_mandir} \\\
        --infodir=%{_infodir}


%reconfigure \
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
  autoreconf -v --install --force || exit 1 \
  ./configure --build=%{_build} --host=%{_host} \\\
        --program-prefix=%{?_program_prefix} \\\
        --prefix=%{_prefix} \\\
        --exec-prefix=%{_exec_prefix} \\\
        --bindir=%{_bindir} \\\
        --sbindir=%{_sbindir} \\\
        --sysconfdir=%{_sysconfdir} \\\
        --datadir=%{_datadir} \\\
        --includedir=%{_includedir} \\\
        --libdir=%{_libdir} \\\
        --libexecdir=%{_libexecdir} \\\
        --localstatedir=%{_localstatedir} \\\
        --sharedstatedir=%{_sharedstatedir} \\\
        --mandir=%{_mandir} \\\
        --infodir=%{_infodir}

%autogen \
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
  ./autogen.sh --build=%{_build} --host=%{_host} \\\
        --program-prefix=%{?_program_prefix} \\\
        --prefix=%{_prefix} \\\
        --exec-prefix=%{_exec_prefix} \\\
        --bindir=%{_bindir} \\\
        --sbindir=%{_sbindir} \\\
        --sysconfdir=%{_sysconfdir} \\\
        --datadir=%{_datadir} \\\
        --includedir=%{_includedir} \\\
        --libdir=%{_libdir} \\\
        --libexecdir=%{_libexecdir} \\\
        --localstatedir=%{_localstatedir} \\\
        --sharedstatedir=%{_sharedstatedir} \\\
        --mandir=%{_mandir} \\\
        --infodir=%{_infodir}


%makeinstall \
  %{__make} \\\
        prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
        exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
        bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
        sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
        sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
        datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
        includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
        libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
        libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
        localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
        sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
        mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
        infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
  install


%make_install \
  %{__make} \\\
        DESTDIR=%{?buildroot:%{buildroot}} \\\
        INSTALL_ROOT=%{?buildroot:%{buildroot}} \\\
  install  \
  rm -f %{?buildroot:%{buildroot}}%{_infodir}/dir \
  find %{?buildroot:%{buildroot}} -regex ".*\\.la$" | xargs rm -f -- \
  %{!?keepstatic:find %{?buildroot:%{buildroot}} -regex ".*\\.a$" | xargs rm -f --}

%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
        && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
        [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS")

%lang_package(n:f:) \
%package %{-n:-n %{-n*}-}locale \
Summary: Translations and Locale for package %{name}\
Requires: %{-n:%{-n*}}%{!-n:%{name}} = %{version} \
Provides: %{-n:%{-n*}}%{!-n:%{name}}-lang-all = %{version} \
BuildArch:  noarch \
%description %{-n:-n %{-n*}-}locale\
This package provides translations for package %{name}.\
%files %{-n:-n %{-n*}-}locale -f %{-f:%{-f*}.lang} %{!-f:%{name}.lang}\
%defattr(-,root,root,-)\
%{nil}

%docs_package \
%package docs \
Summary: Documentation for package %{name}\
AutoReqProv: 0\
%description docs\
This package provides documentation for package %{name}.\
%files docs -f documentation.list\
%defattr(-,root,root,-)\
%{nil}

# Bad hack to set $LANG to C during all RPM builds
%prep \
%%prep\
LANG=C\
export LANG\
unset DISPLAY\
%{nil}

%build %%build\
LANG=C\
export LANG\
unset DISPLAY\
CFLAGS="%optflags" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
LDFLAGS="${LDFLAGS:-%{?global_LDFLAGS}}"; export LDFLAGS ; \
LD_AS_NEEDED=1; export LD_AS_NEEDED ; \
%{nil}

%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
%%install\
LANG=C\
export LANG\
unset DISPLAY\
rm -rf %{?buildroot:%{buildroot}} \
mkdir -p %{?buildroot:%{buildroot}} \
cat /tmp/ubsan.log* > /tmp/all_results.log || true \
cat /tmp/all_results.log | grep -E -v 'h:[0-9]|awkgram.y|y.tab.c|eina_inline_hash.x' || true \
%{nil}


%clean %%clean\
rm -rf %{?buildroot:%{buildroot}} \
%{nil}

%find_lang      /usr/lib/rpm/find-lang.sh %{buildroot}
%find_docs      /usr/lib/rpm/tizen/find-docs.sh %{buildroot}



#==============================================================================
# ---- default .desktop directories per the desktop-entry freedesktop.org spec

%_desktopdir    %{_datadir}/applications

#==============================================================================
# ---- Generic auto req/prov filtering macros
#
# http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering

# prevent anything matching from being scanned for provides
%filter_provides_in(P) %{expand: \
%global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
}

# prevent anything matching from being scanned for requires
%filter_requires_in(P) %{expand: \
%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
}

# filter anything matching out of the provides stream
%filter_from_provides() %{expand: \
%global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
}

# filter anything matching out of the requires stream
%filter_from_requires() %{expand: \
%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
}

# actually set up the filtering bits
%filter_setup %{expand: \
%global _use_internal_dependency_generator 0 \
%global __deploop() while read FILE; do /usr/lib/rpm/rpmdeps -%{1} ${FILE}; done | /bin/sort -u \
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
%global __find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}" \
}

%remove_docs \
  rm -rf %{?buildroot:%{buildroot}}%{_infodir} \
  rm -rf %{?buildroot:%{buildroot}}%{_defaultdocdir} \
  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc/%{name} \
  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc/%{name}-%{version} \
  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/gtk-doc \
  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/doc \
  rm -rf %{?buildroot:%{buildroot}}%{_datadir}/man \
  find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]" | xargs rm -f -- \
  find %{?buildroot:%{buildroot}} -regex ".*/man/../man./.*\.[0-9]" | xargs rm -f -- \
  find %{?buildroot:%{buildroot}} -regex ".*/man/man./.*\.[0-9]pm" | xargs rm -f --


%install_service() \
mkdir -p %{buildroot}/%{_unitdir}/%{1} \
ln -s ../%{2}  %{buildroot}/%{_unitdir}/%{1}/%{2}  \
%{nil}


%_fontsdir               %{_usr}/share/fonts
%_ttfontsdir             %{_fontsdir}/truetype
%_miscfontsdir           %{_fontsdir}/misc
%_fontsconfdir           %{_sysconfdir}/fonts
%_fontsconfddir          %{_fontsconfdir}/conf.d
%_fontsconfavaildir      %{_datadir}/%{name}/conf.avail

%devel_package \
%package devel \
Summary: Development files for package %{name}\
Group: Development\
%description devel\
This package provides header files and other developer releated files for package %{name}.\
%files devel \
%{_includedir}/*\
%{_libdir}/pkgconfig/*.pc\
%{_libdir}/*.so\
%{nil}

%devel_desc This package contains all necessary include files and libraries needed \
to develop applications that require %{name}.\
%{nil}