From: Hyotaek Shim Date: Mon, 11 Apr 2022 05:44:11 +0000 (+0900) Subject: Initialization X-Git-Tag: submit/tizen/20220420.055631~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e95b2f2e96deb4897b70e88c5ecfb6cbc832133;p=platform%2Fcore%2Fapi%2Fresource.git Initialization Change-Id: I1d3207cf4e7c0a98bf2ff9823fae6541d5150712 Signed-off-by: Hyotaek Shim --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9306ae6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +cscope.files +cscope.out +tags diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2d34813 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,45 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.16) +PROJECT(capi-system-resource) + +SET(PKG_MODULES + dlog + vconf + capi-base-common + capi-system-info + libsyscommon +) + +INCLUDE(FindPkgConfig) +pkg_check_modules(${PROJECT_NAME} REQUIRED ${PKG_MODULES}) +FOREACH(flag ${${PROJECT_NAME}_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") + +aux_source_directory(src SOURCES) +ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES}) + +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_LDFLAGS}) + +SET_TARGET_PROPERTIES(${PROJECT_NAME} + PROPERTIES + VERSION ${FULLVER} + SOVERSION ${MAJORVER} + CLEAN_DIRECT_OUTPUT 1 +) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) + +SET(PC_NAME ${PROJECT_NAME}) +SET(PC_REQUIRED ${pc_dependents}) +SET(PC_LDFLAGS -l${PROJECT_NAME}) + +CONFIGURE_FILE( + ${PROJECT_NAME}.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc + @ONLY +) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) diff --git a/LICENSE.MIT b/LICENSE.MIT new file mode 100644 index 0000000..80b056d --- /dev/null +++ b/LICENSE.MIT @@ -0,0 +1,9 @@ +The MIT License + +Copyright (c) 2022 Samsung Electronics Co., Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/capi-system-resource.pc.in b/capi-system-resource.pc.in new file mode 100644 index 0000000..30f2af2 --- /dev/null +++ b/capi-system-resource.pc.in @@ -0,0 +1,14 @@ + +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=/usr +libdir=@LIB_INSTALL_DIR@ +includedir=/usr/include + +Name: @PC_NAME@ +Description: @PACKAGE_DESCRIPTION@ +Version: @VERSION@ +Requires: capi-base-common +Libs: -L${libdir} @PC_LDFLAGS@ +Cflags: -I${includedir} -I/usr/include/system diff --git a/include/resource.h b/include/resource.h new file mode 100644 index 0000000..022bc2c --- /dev/null +++ b/include/resource.h @@ -0,0 +1,34 @@ +/* MIT License + * + * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ + +#ifndef __TIZEN_SYSTEM_RESOURCE_H__ +#define __TIZEN_SYSTEM_RESOURCE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __TIZEN_SYSTEM_RESOURCE_H__ diff --git a/packaging/capi-system-resource.manifest b/packaging/capi-system-resource.manifest new file mode 100644 index 0000000..b631abe --- /dev/null +++ b/packaging/capi-system-resource.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/capi-system-resource.spec b/packaging/capi-system-resource.spec new file mode 100644 index 0000000..fcf6003 --- /dev/null +++ b/packaging/capi-system-resource.spec @@ -0,0 +1,52 @@ +Name: capi-system-resource +Summary: API library for system resource management and optimization +Version: 1.0.0 +Release: 0 +Group: System/API +License: MIT +Source0: %{name}-%{version}.tar.gz +Source1: capi-system-resource.manifest +BuildRequires: cmake +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(libsyscommon) + +%description +API library for system resource management and optimization + +%package devel +Summary: API library for system resource management and optimization (Devel) +Group: System/Development +Requires: %{name} = %{version}-%{release} + +%description devel +API library for system resource management and optimization (Devel) +%devel_desc + +%prep +%setup -q + +%build +cp %{SOURCE1} . +%cmake . -DVERSION=%{version} +%__make %{?jobs:-j%jobs} + +%install +%make_install + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%manifest %{name}.manifest +%license LICENSE.MIT +%{_libdir}/libcapi-system-resource.so.* + +%files devel +%manifest %{name}.manifest +%license LICENSE.MIT +%{_libdir}/pkgconfig/*.pc +%{_libdir}/libcapi-system-resource.so diff --git a/src/resource.c b/src/resource.c new file mode 100644 index 0000000..7cf60be --- /dev/null +++ b/src/resource.c @@ -0,0 +1,23 @@ +/* MIT License + * + * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. */ + +