From: Mateusz Moscicki Date: Tue, 16 Mar 2021 11:15:58 +0000 (+0100) Subject: Move the libbugreport library to the separate spec X-Git-Tag: submit/tizen/20210322.215101~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1efd48ed7e4fed822259342643ded05a9da6e8b;p=platform%2Fcore%2Fsystem%2Fcrash-worker.git Move the libbugreport library to the separate spec A separate spec is needed because diagnostics depends on libbugreport, while bugreport-service requires diagnostics. Change-Id: I809e21be045ca6d29d5851032d135a308e816c16 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index cea1e14..dbaf959 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,9 +22,7 @@ IF("${LIVEDUMPER}" STREQUAL "ON") ADD_SUBDIRECTORY(src/livedumper) ENDIF() -IF("${CRASH_SERVICE}" STREQUAL "ON") - ADD_SUBDIRECTORY(src/bugreport-service) -ENDIF() +ADD_SUBDIRECTORY(src/bugreport-service) IF("${DUMP_SYSTEMSTATE_SERVICE}" STREQUAL "ON") ADD_SUBDIRECTORY(src/dump_systemstate-service) diff --git a/packaging/crash-worker.spec b/packaging/crash-worker.spec index 11a85f6..043eaf8 100644 --- a/packaging/crash-worker.spec +++ b/packaging/crash-worker.spec @@ -5,13 +5,11 @@ %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 @@ -19,7 +17,6 @@ %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 @@ -45,6 +42,9 @@ BuildRequires: pkgconfig(libunwind-generic) 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 @@ -61,13 +61,11 @@ Requires(post): coreutils 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 @@ -116,13 +114,6 @@ Requires: zip 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} @@ -131,12 +122,6 @@ Requires: %{name}-support-livecoredump = %{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 @@ -216,7 +201,6 @@ export CFLAGS+=" -Werror" -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 \ @@ -345,7 +329,6 @@ fi %{_libdir}/pkgconfig/crash-manager.pc %endif -%if %{with bugreportservice} %files -n bugreport-service %license LICENSE %manifest crash-worker.manifest @@ -356,19 +339,6 @@ fi %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 @@ -406,10 +376,8 @@ fi %{_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 diff --git a/packaging/libbugreport.spec b/packaging/libbugreport.spec new file mode 100644 index 0000000..f1d7d83 --- /dev/null +++ b/packaging/libbugreport.spec @@ -0,0 +1,54 @@ +# "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 diff --git a/src/bugreport-service/CMakeLists.txt b/src/bugreport-service/CMakeLists.txt index 4d7c849..dbcf9bd 100644 --- a/src/bugreport-service/CMakeLists.txt +++ b/src/bugreport-service/CMakeLists.txt @@ -37,18 +37,10 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${CRASH_SERVICE_SRCS}) 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) @@ -66,12 +58,6 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin 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) diff --git a/src/bugreport/CMakeLists.txt b/src/bugreport/CMakeLists.txt new file mode 100644 index 0000000..e31a833 --- /dev/null +++ b/src/bugreport/CMakeLists.txt @@ -0,0 +1,41 @@ +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) + diff --git a/src/bugreport-service/bugreport.pc.in b/src/bugreport/bugreport.pc.in similarity index 100% rename from src/bugreport-service/bugreport.pc.in rename to src/bugreport/bugreport.pc.in diff --git a/src/bugreport-service/libbugreport-service.c b/src/bugreport/libbugreport-service.c similarity index 100% rename from src/bugreport-service/libbugreport-service.c rename to src/bugreport/libbugreport-service.c diff --git a/src/bugreport-service/libbugreport.h b/src/bugreport/libbugreport.h similarity index 100% rename from src/bugreport-service/libbugreport.h rename to src/bugreport/libbugreport.h diff --git a/tests/system/utils/CMakeLists.txt b/tests/system/utils/CMakeLists.txt index 45e08ab..f8b7d6a 100644 --- a/tests/system/utils/CMakeLists.txt +++ b/tests/system/utils/CMakeLists.txt @@ -13,9 +13,10 @@ add_executable(libbugreport-servicetest libbugreport-servicetest.c) INCLUDE(FindPkgConfig) pkg_check_modules(helper_pkgs REQUIRED gio-2.0 + bugreport dlog) -TARGET_LINK_LIBRARIES(libbugreport-servicetest libbugreport ${helper_pkgs_LDFLAGS}) +TARGET_LINK_LIBRARIES(libbugreport-servicetest bugreport ${helper_pkgs_LDFLAGS}) install(TARGETS kenny DESTINATION ${CRASH_SYSTEM_TESTS_PATH}/utils) install(TARGETS btee DESTINATION ${CRASH_SYSTEM_TESTS_PATH}/utils)