2013-01-26 15:29:09 +01:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2013-09-10 19:41:29 +02:00
|
|
|
INCLUDE(CheckFunctionExists)
|
|
|
|
|
2013-09-02 17:09:57 +02:00
|
|
|
PROJECT(rpcd C)
|
2021-12-03 23:36:35 +01:00
|
|
|
ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
|
2013-10-10 06:30:31 +02:00
|
|
|
INCLUDE_DIRECTORIES(include)
|
2013-01-26 15:29:09 +01:00
|
|
|
|
2013-09-02 15:14:33 +02:00
|
|
|
OPTION(FILE_SUPPORT "File plugin support" ON)
|
|
|
|
OPTION(IWINFO_SUPPORT "libiwinfo plugin support" ON)
|
2015-08-20 22:49:43 +02:00
|
|
|
OPTION(RPCSYS_SUPPORT "rpc-sys plugin support" ON)
|
2021-12-02 21:00:40 +01:00
|
|
|
OPTION(UCODE_SUPPORT "ucode plugin support" ON)
|
2013-09-02 15:14:33 +02:00
|
|
|
|
2013-01-26 15:29:09 +01:00
|
|
|
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|
|
|
|
|
|
|
IF(APPLE)
|
|
|
|
INCLUDE_DIRECTORIES(/opt/local/include)
|
|
|
|
LINK_DIRECTORIES(/opt/local/lib)
|
|
|
|
ENDIF()
|
|
|
|
|
2013-09-10 19:41:29 +02:00
|
|
|
CHECK_FUNCTION_EXISTS(getspnam HAVE_SHADOW)
|
|
|
|
IF(HAVE_SHADOW)
|
|
|
|
ADD_DEFINITIONS(-DHAVE_SHADOW)
|
|
|
|
ENDIF()
|
|
|
|
|
2018-06-05 09:41:25 +02:00
|
|
|
FIND_LIBRARY(uci NAMES uci)
|
|
|
|
FIND_LIBRARY(ubus NAMES ubus)
|
|
|
|
FIND_LIBRARY(ubox NAMES ubox)
|
|
|
|
FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
|
2013-09-01 22:12:19 +02:00
|
|
|
FIND_LIBRARY(json NAMES json-c json)
|
2013-09-10 19:41:29 +02:00
|
|
|
FIND_LIBRARY(crypt NAMES crypt)
|
2015-02-26 16:34:31 +01:00
|
|
|
IF(crypt STREQUAL "crypt-NOTFOUND")
|
2013-09-10 19:41:29 +02:00
|
|
|
SET(crypt "")
|
|
|
|
ENDIF()
|
2013-09-01 22:12:19 +02:00
|
|
|
|
2016-07-11 23:03:49 +02:00
|
|
|
FIND_PATH(ubus_include_dir libubus.h)
|
|
|
|
INCLUDE_DIRECTORIES(${ubus_include_dir})
|
|
|
|
|
2016-12-03 18:34:44 +01:00
|
|
|
FIND_PATH(ubox_include_dir libubox/blobmsg_json.h)
|
|
|
|
INCLUDE_DIRECTORIES(${ubox_include_dir})
|
|
|
|
|
rc: new ubus object for handling /etc/init.d/ scripts
This commit adds "rc" ubus object with methods "list" and "exec" for
listing and calling init.d script appropriately. It's useful for all
kind of UIs (e.g. LuCI) and custom apps.
Example:
root@OpenWrt:~# ubus call rc list
{
"blockd": {
"start": 80,
"enabled": true,
"running": true
},
"dnsmasq": {
"start": 19,
"enabled": true,
"running": true
}
}
root@OpenWrt:~# ubus call rc init '{ "name": "blockd", "action": "disable" }'
root@OpenWrt:~# ubus call rc init '{ "name": "dnsmasq", "action": "stop" }'
root@OpenWrt:~# ubus call rc list
{
"blockd": {
"start": 80,
"enabled": false,
"running": true
},
"dnsmasq": {
"start": 19,
"enabled": true,
"running": false
}
}
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2020-06-23 20:46:19 +02:00
|
|
|
ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c rc.c plugin.c)
|
2018-06-05 09:41:25 +02:00
|
|
|
TARGET_LINK_LIBRARIES(rpcd ${ubox} ${ubus} ${uci} ${blobmsg_json} ${json} ${crypt} dl)
|
2013-09-02 15:14:33 +02:00
|
|
|
|
|
|
|
SET(PLUGINS "")
|
|
|
|
|
|
|
|
IF(FILE_SUPPORT)
|
|
|
|
SET(PLUGINS ${PLUGINS} file_plugin)
|
|
|
|
ADD_LIBRARY(file_plugin MODULE file.c)
|
2018-06-05 09:41:25 +02:00
|
|
|
TARGET_LINK_LIBRARIES(file_plugin ${ubox} ${ubus})
|
2013-09-02 15:14:33 +02:00
|
|
|
SET_TARGET_PROPERTIES(file_plugin PROPERTIES OUTPUT_NAME file PREFIX "")
|
|
|
|
ENDIF()
|
|
|
|
|
2015-08-20 22:49:43 +02:00
|
|
|
IF(RPCSYS_SUPPORT)
|
|
|
|
SET(PLUGINS ${PLUGINS} rpcsys_plugin)
|
|
|
|
ADD_LIBRARY(rpcsys_plugin MODULE sys.c)
|
2018-06-05 09:41:25 +02:00
|
|
|
TARGET_LINK_LIBRARIES(rpcsys_plugin ${ubox} ${ubus})
|
2015-08-20 22:49:43 +02:00
|
|
|
SET_TARGET_PROPERTIES(rpcsys_plugin PROPERTIES OUTPUT_NAME rpcsys PREFIX "")
|
|
|
|
ENDIF()
|
|
|
|
|
2021-12-02 21:00:40 +01:00
|
|
|
IF(IWINFO_SUPPORT)
|
2018-06-05 09:41:25 +02:00
|
|
|
FIND_LIBRARY(iwinfo NAMES iwinfo)
|
2013-09-02 15:14:33 +02:00
|
|
|
SET(PLUGINS ${PLUGINS} iwinfo_plugin)
|
|
|
|
ADD_LIBRARY(iwinfo_plugin MODULE iwinfo.c)
|
2018-06-05 09:41:25 +02:00
|
|
|
TARGET_LINK_LIBRARIES(iwinfo_plugin ${ubox} ${ubus} ${iwinfo})
|
2013-09-02 15:14:33 +02:00
|
|
|
SET_TARGET_PROPERTIES(iwinfo_plugin PROPERTIES OUTPUT_NAME iwinfo PREFIX "")
|
|
|
|
ENDIF()
|
2013-01-26 15:29:09 +01:00
|
|
|
|
2021-12-02 21:00:40 +01:00
|
|
|
IF(UCODE_SUPPORT)
|
|
|
|
FIND_LIBRARY(ucode NAMES ucode)
|
|
|
|
SET(PLUGINS ${PLUGINS} ucode_plugin)
|
|
|
|
ADD_LIBRARY(ucode_plugin MODULE ucode.c)
|
|
|
|
TARGET_LINK_LIBRARIES(ucode_plugin ${ucode})
|
|
|
|
SET_TARGET_PROPERTIES(ucode_plugin PROPERTIES OUTPUT_NAME ucode PREFIX "")
|
|
|
|
ENDIF()
|
|
|
|
|
2013-09-02 17:09:57 +02:00
|
|
|
INSTALL(TARGETS rpcd ${PLUGINS}
|
2013-01-26 15:29:09 +01:00
|
|
|
RUNTIME DESTINATION sbin
|
2021-12-03 23:36:35 +01:00
|
|
|
LIBRARY DESTINATION lib/rpcd
|
2013-01-26 15:29:09 +01:00
|
|
|
)
|