summaryrefslogtreecommitdiff
path: root/packaging/ttrace.spec
blob: 5ee3a9e287e17d11d8b59ddaaebc73b9fc94fac9 (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
Name:		ttrace
Summary:    T-trace for tizen
Version:	1.0.3
Release:    1
Group:      System/Libraries
License:    Apache-2.0
Source0:    %{name}-%{version}.tar.gz
SOURCE100:	packaging/ttrace.conf
SOURCE101:	packaging/sys-kernel-debug-tracing.mount
SOURCE102:	packaging/ttrace-marker.service
SOURCE103:	packaging/atrace-bootup.sh

BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(capi-base-common)
BuildRequires: pkgconfig(libsmack)
BuildRequires: cmake

%define keepstatic 1

# tizen_profile_name is for optional features that are not built in Tizen Public OBS.
%define TTRACE_PROFILE none
%if "%{?tizen_profile_name}" == "mobile"
%define TTRACE_PROFILE mobile
%else
%if "%{?tizen_profile_name}" == "tv"
%define TTRACE_PROFILE tv
%else
%if "%{?tizen_profile_name}" == "wearable"
%define TTRACE_PROFILE wearable
%endif
%endif
%endif

%define TTRACE_TIZEN_VERSION_MAJOR 2
%if 0%{?tizen_version_major} >= 3
%define TTRACE_TIZEN_VERSION_MAJOR 3
%endif

%description
T-trace library

%package devel
Summary:    T-trace for tizen
Group:      Development/Libraries
Requires:   %{name} = %{version}-%{release}

%description devel
T-trace library devel

%if 0%{?gcov:1}
%package gcov
Summary:  ttrace(gcov)
Group:    Development/Libraries
%description gcov
New T-trace library cov objects
%endif

%prep
%setup -q

%build
%if 0%{?gcov:1}
export CFLAGS+=" -fprofile-arcs -ftest-coverage"
export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
export FFLAGS+=" -fprofile-arcs -ftest-coverage"
export LDFLAGS+=" -lgcov"
%endif

export CFLAGS="$CFLAGS -g -Wall -std=gnu99"
export CXXFLAGS="$CXXFLAGS -std=c++0x -fPIE -pie -fno-exceptions"
%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \
      -DTTRACE_PROFILE=%{TTRACE_PROFILE} -DTTRACE_TIZEN_VERSION_MAJOR=%{TTRACE_TIZEN_VERSION_MAJOR}
make %{?jobs:-j%jobs}

%if 0%{?gcov:1}
mkdir -p gcov-obj
find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
%endif

%install
rm -rf %{buildroot}
%make_install
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}/usr/lib/tmpfiles.d
install -m 0644 %{SOURCE100} %{buildroot}/usr/lib/tmpfiles.d/ttrace.conf
install -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE102} %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_bindir}
cp %{SOURCE103} %{buildroot}%{_bindir}
%install_service sysinit.target.wants ttrace-marker.service
%install_service sysinit.target.wants sys-kernel-debug-tracing.mount

%if 0%{?gcov:1}
mkdir -p %{buildroot}%{_datadir}/gcov/obj
install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
%endif

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%manifest ttrace.manifest
%defattr(-,root,root,-)
%{_libdir}/libttrace.so.*
%{_unitdir}/ttrace-marker.service
%{_unitdir}/sys-kernel-debug-tracing.mount
%attr(755,root,users) %{_bindir}/atrace
%attr(755,root,users) %{_bindir}/atrace-1.1
%{_unitdir}/sysinit.target.wants/ttrace-marker.service
%{_unitdir}/sysinit.target.wants/sys-kernel-debug-tracing.mount
%attr(755,root,root) %{_bindir}/atrace-bootup.sh
/usr/lib/tmpfiles.d/ttrace.conf
%license LICENSE

%files devel
%defattr(-,root,root,-)
%{_includedir}/*.h
%{_libdir}/libttrace.so
%{_libdir}/libttrace.a
%{_libdir}/pkgconfig/*.pc

%if 0%{?gcov:1}
%files gcov
%{_datadir}/gcov/obj/*
%endif