Add debug compilation mode
[platform/core/security/nice-lad.git] / packaging / nice-lad.spec
1 Name:       nice-lad
2 Summary:    Narcissistic, Incredible, Completely Exceptional Logger of Access Denials
3 Version:    0.1.0
4 Release:    1
5 Group:      Security/Access Control
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 Source1001:    %{name}.manifest
9 Source1002:    nice-lad-tests.manifest
10 BuildRequires: boost-devel
11 BuildRequires: cmake
12 BuildRequires: pkgconfig(audit)
13 BuildRequires: pkgconfig(libsystemd-journal)
14 BuildRequires: pkgconfig(security-manager)
15
16 %{?systemd_requires}
17
18 %if !%{defined build_type}
19 %define build_type RELEASE
20 %endif
21
22 %description
23 Narcissistic, Incredible, Completely Exceptional Logger of Access Denials.
24 The tool collects logs of access denials on platform (syscalls, Smack, Cynara
25 and Nether). It also reasonably populates audit's filters, so there is
26 no unneeded impact on performance. The tool works as a plugin for audit and is
27 only spawned on demand. nice-lad could be helpful for developers trying
28 to debug their applications.
29
30 %package tests
31 Summary:    Unit tests for nice-lad
32 BuildRequires: pkgconfig(gmock)
33
34 %description tests
35 Unit tests for nice-lad. A standalone application checking correctness
36 of nice-lad's components.
37
38 %prep
39 %setup -q
40 cp -a %{SOURCE1001} .
41 cp -a %{SOURCE1002} .
42
43 %build
44 %if 0%{?sec_build_binary_debug_enable:1}
45 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
46 %endif
47
48 %if 0%{!?build_type:1}
49 %define build_type RELEASE
50 %endif
51
52 %if %{?build_type} == "DEBUG"
53 export CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE"
54 %endif
55
56 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
57
58 %cmake . \
59         -DCMAKE_BUILD_TYPE=%{?build_type} \
60         -DBIN_DIR:PATH=%{_bindir} \
61         -DSBIN_DIR:PATH=%{_sbindir} \
62         -DSYS_CONFIG_DIR:PATH=%{_sysconfdir} \
63         -DCMAKE_VERBOSE_MAKEFILE=ON \
64         -DWITH_SECURITY_MANAGER=ON \
65         -DWITH_JOURNALD=ON
66 make %{?jobs:-j%jobs}
67
68 %install
69 rm -rf %{buildroot}
70 %make_install
71
72 %files
73 %manifest %{name}.manifest
74 %license LICENSE
75 %attr(755,root,root) %{_sbindir}/%{name}
76 %config %{_sysconfdir}/audisp/plugins.d/nice_lad.conf
77
78 %files -n nice-lad-tests
79 %manifest nice-lad-tests.manifest
80 %license LICENSE
81 %attr(755,root,root) %{_bindir}/nice-lad-tests
82