%define _without_tests on
%define _without_regdumper on
%define _without_livedumper on
-%define _with_bugreportservice on
%define _with_dumpsystemstateservice on
%else
%define _with_tests on
%define _with_regdumper on
%define _with_livedumper on
-%define _with_bugreportservice on
%define _with_dumpsystemstateservice on
%endif
%bcond_with tests
%bcond_with regdumper
%bcond_with livedumper
-%bcond_with bugreportservice
%bcond_with dumpsystemstateservice
# NOTE: To disable coredump set DumpCore=0 in configuration file
BuildRequires: libcap-devel
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(openssl1.1)
+%if %{with tests}
+BuildRequires: pkgconfig(bugreport)
+%endif
%if %{with dumpsystemstateservice}
BuildRequires: pkgconfig(dumpsys-system)
%endif
Requires(post): tar
Requires(post): gzip
+Requires: bugreport-service = %{version}-%{release}
Requires: %{name}-dumpsystemstate-util = %{version}-%{release}
%if %{with dumpsystemstateservice}
Requires: %{name}-dumpsystemstate-service = %{version}-%{release}
%endif
-%if %{with bugreportservice}
-Requires: bugreport-service = %{version}-%{release}
-%endif
%if %{with regdumper}
Requires: %{name}-support-regdump = %{version}-%{release}
%endif
Summary: package provides headers needed to develop programs using libcrash-manager
%description -n libcrash-manager-devel
-%if %{with bugreportservice}
-%package -n libbugreport
-Summary: libbugreport provides API to communicate with bugreport-service
-# remove following when libbugreport is added to building-blocks
-Provides: libcrash-service = %{version}-%{release}
-%description -n libbugreport
-
%package -n bugreport-service
Summary: bugreport provides dumpsys provider for diagnostics data
Requires: %{name}-dumpsystemstate-util = %{version}-%{release}
%endif
%description -n bugreport-service
-%package -n libbugreport-devel
-Summary: package provides headers needed to develop programs using bugreport-service
-%description -n libbugreport-devel
-%description -n libbugreport-devel
-%endif
-
%if %{with doc}
%package doc
Summary: Documentation package for crash-worker
-DCRASH_TESTS_PATH=%{_libexecdir}/crash-worker/tests \
-DCRASH_SYSTEM_TESTS_PATH=%{_libexecdir}/crash-worker/system-tests \
-DLIVEDUMPER=%{on_off livedumper} \
- -DCRASH_SERVICE=%{on_off bugreportservice} \
-DDUMP_SYSTEMSTATE_SERVICE=%{on_off dumpsystemstateservice} \
-DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
-DLOGGER=dlog \
%{_libdir}/pkgconfig/crash-manager.pc
%endif
-%if %{with bugreportservice}
%files -n bugreport-service
%license LICENSE
%manifest crash-worker.manifest
%attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.diagnostics.service
%attr(0644,root,root) %{_prefix}/lib/tmpfiles.d/diagnostics-run.conf
-%files -n libbugreport
-%license LICENSE
-%manifest crash-worker.manifest
-%{_libdir}/libbugreport.so.*
-
-%files -n libbugreport-devel
-%license LICENSE
-%manifest crash-worker.manifest
-%{_includedir}/libbugreport.h
-%{_libdir}/libbugreport.so
-%{_libdir}/pkgconfig/bugreport.pc
-%endif
-
%if %{with doc}
%files doc
%{_datadir}/doc/crash-worker
%{_libexecdir}/crash-worker/system-tests/extra_script/extra_script.sh
%{_libexecdir}/crash-worker/system-tests/full_core/full_core.sh
%{_libexecdir}/crash-worker/system-tests/info_file/info_file.sh
-%if %{with bugreportservice}
%{_libexecdir}/crash-worker/system-tests/libbugreport-service/libbugreport-service.sh
%{_libexecdir}/crash-worker/system-tests/libbugreport-service_systemstate/libbugreport-service_systemstate.sh
-%endif
%{_libexecdir}/crash-worker/system-tests/log_file/log_file.sh
%{_libexecdir}/crash-worker/system-tests/output_param/output_param.sh
%{_libexecdir}/crash-worker/system-tests/report_basic/report_basic.sh
--- /dev/null
+# "on_off foo" wil turn into "ON" or "OFF"
+%define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
+
+Name: libbugreport
+Summary: libbugreport provides API to communicate with bugreport-service
+Version: 1.0.0
+Release: 1
+Provides: libcrash-service = %{version}-%{release}
+Group: Framework/system
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1001: crash-worker.manifest
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: cmake
+
+%description
+
+%package -n libbugreport-devel
+Summary: package provides headers needed to develop programs using bugreport-service
+%description -n libbugreport-devel
+%description -n libbugreport-devel
+
+%prep
+%setup -q
+
+%build
+cp %{SOURCE1001} .
+
+export CFLAGS+=" -Werror"
+
+%cmake src/bugreport/ \
+ -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+ -DLOGGER=dlog \
+ -DDLOG_LOG_LEVEL=DLOG_INFO \
+ -DVERSION=%{version}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%files
+%license LICENSE
+%manifest crash-worker.manifest
+%{_libdir}/libbugreport.so.*
+
+%files -n libbugreport-devel
+%license LICENSE
+%manifest crash-worker.manifest
+%{_includedir}/libbugreport.h
+%{_libdir}/libbugreport.so
+%{_libdir}/pkgconfig/bugreport.pc
ADD_DEPENDENCIES(${PROJECT_NAME} crash-manager)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bugreport-service_pkgs_LDFLAGS} -pie -Wl,--as-needed -lrt -lcrash-manager)
-ADD_LIBRARY(libbugreport SHARED libbugreport-service.c)
-SET_TARGET_PROPERTIES(libbugreport PROPERTIES
- SOVERSION 1
- PUBLIC_HEADER libbugreport.h
- OUTPUT_NAME bugreport)
-
PROCESS_M4("${M4_DEFINES}"
"${CMAKE_CURRENT_SOURCE_DIR}/bugreport.service.m4"
"${CMAKE_CURRENT_SOURCE_DIR}/bugreport.service")
-CONFIGURE_FILE(bugreport.pc.in bugreport.pc @ONLY)
-
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.system.crash.livedump.service
DESTINATION /usr/share/dbus-1/system-services)
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-INSTALL(TARGETS libbugreport LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bugreport.pc
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/diagnostics/diagnostics-run.conf
DESTINATION /usr/lib/tmpfiles.d/
PERMISSIONS OWNER_READ OWNER_WRITE)
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(bugreport C)
+
+ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/../../include include/)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../../src/ ${CMAKE_SOURCE_DIR}/../../include)
+
+INCLUDE(GNUInstallDirs)
+
+INCLUDE(FindPkgConfig)
+
+pkg_check_modules(bugreport_pkgs REQUIRED
+ dlog
+ gio-2.0
+ gio-unix-2.0
+ )
+
+FOREACH(flag ${bugreport_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -Wno-unused-function -Wno-unused-const-variable")
+
+INCLUDE(${CMAKE_SOURCE_DIR}/../../cmake/ProcessM4.cmake)
+
+LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/crash-manager)
+
+ADD_LIBRARY(libbugreport SHARED libbugreport-service.c)
+SET_TARGET_PROPERTIES(libbugreport PROPERTIES
+ SOVERSION 1
+ PUBLIC_HEADER libbugreport.h
+ OUTPUT_NAME bugreport)
+
+CONFIGURE_FILE(bugreport.pc.in ${CMAKE_SOURCE_DIR}/bugreport.pc @ONLY)
+
+INSTALL(TARGETS libbugreport LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bugreport.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+