• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/procd/CMakeLists.txt

  1 cmake_minimum_required(VERSION 2.6)
  2 
  3 PROJECT(procd C)
  4 INCLUDE(GNUInstallDirs)
  5 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
  6 
  7 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  8 
  9 IF(APPLE)
 10   INCLUDE_DIRECTORIES(/opt/local/include)
 11   LINK_DIRECTORIES(/opt/local/lib)
 12 ENDIF()
 13 
 14 
 15 ADD_LIBRARY(setlbf SHARED service/setlbf.c)
 16 INSTALL(TARGETS setlbf
 17         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
 18 )
 19 
 20 
 21 SET(SOURCES procd.c signal.c state.c hotplug-dispatch.c inittab.c rcS.c ubus.c
 22         system.c sysupgrade.c service/service.c service/instance.c
 23         service/validate.c service/trigger.c service/watch.c utils/utils.c)
 24 IF(NOT DISABLE_INIT)
 25   SET(SOURCES ${SOURCES} watchdog.c plug/coldplug.c plug/hotplug.c)
 26 ENDIF()
 27 
 28 FIND_LIBRARY(ubox NAMES ubox)
 29 FIND_LIBRARY(ubus NAMES ubus)
 30 FIND_LIBRARY(uci NAMES uci)
 31 FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
 32 FIND_LIBRARY(json_script NAMES json_script)
 33 FIND_LIBRARY(json NAMES json-c json)
 34 
 35 SET(LIBS ${ubox} ${ubus} ${json} ${blobmsg_json} ${json_script})
 36 
 37 IF(DEBUG)
 38   ADD_DEFINITIONS(-DUDEV_DEBUG -g3)
 39 ENDIF()
 40 
 41 IF(EARLY_PATH)
 42   ADD_DEFINITIONS(-DEARLY_PATH="${EARLY_PATH}")
 43 ENDIF()
 44 
 45 IF(SELINUX)
 46   include(FindPkgConfig)
 47   pkg_search_module(SELINUX REQUIRED libselinux)
 48   add_compile_definitions(WITH_SELINUX)
 49 ENDIF()
 50 
 51 add_subdirectory(upgraded)
 52 
 53 ADD_EXECUTABLE(procd ${SOURCES})
 54 TARGET_LINK_LIBRARIES(procd ${LIBS})
 55 INSTALL(TARGETS procd
 56         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 57 )
 58 
 59 FIND_PATH(ubox_include_dir libubox/uloop.h)
 60 INCLUDE_DIRECTORIES(${ubox_include_dir})
 61 
 62 IF(DISABLE_INIT)
 63 ADD_DEFINITIONS(-DDISABLE_INIT)
 64 ELSE()
 65 ADD_EXECUTABLE(init initd/init.c initd/early.c initd/preinit.c initd/mkdev.c sysupgrade.c watchdog.c
 66         utils/utils.c)
 67 TARGET_INCLUDE_DIRECTORIES(init PUBLIC ${SELINUX_INCLUDE_DIRS})
 68 TARGET_LINK_LIBRARIES(init ${LIBS} ${SELINUX_LIBRARIES})
 69 INSTALL(TARGETS init
 70         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 71 )
 72 
 73 ADD_EXECUTABLE(udevtrigger plug/udevtrigger.c)
 74 INSTALL(TARGETS udevtrigger
 75         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 76 )
 77 ENDIF()
 78 
 79 
 80 ADD_EXECUTABLE(askfirst utils/askfirst.c)
 81 INSTALL(TARGETS askfirst
 82         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 83 )
 84 
 85 ADD_CUSTOM_COMMAND(
 86         OUTPUT syscall-names.h
 87         COMMAND ./make_syscall_h.sh ${CMAKE_C_COMPILER} > ./syscall-names.h
 88         DEPENDS ./make_syscall_h.sh
 89 )
 90 ADD_CUSTOM_TARGET(syscall-names-h DEPENDS syscall-names.h)
 91 
 92 ADD_CUSTOM_COMMAND(
 93         OUTPUT capabilities-names.h
 94         COMMAND ./make_capabilities_h.sh ${CMAKE_C_COMPILER} > ./capabilities-names.h
 95         DEPENDS ./make_capabilities_h.sh
 96 )
 97 ADD_CUSTOM_TARGET(capabilities-names-h DEPENDS capabilities-names.h)
 98 
 99 IF(SECCOMP_SUPPORT)
100 ADD_DEFINITIONS(-DSECCOMP_SUPPORT)
101 ADD_LIBRARY(preload-seccomp SHARED jail/preload.c jail/seccomp.c jail/seccomp-oci.c)
102 TARGET_LINK_LIBRARIES(preload-seccomp dl ${ubox} ${blobmsg_json})
103 INSTALL(TARGETS preload-seccomp
104         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
105 )
106 ADD_DEPENDENCIES(preload-seccomp syscall-names-h)
107 SET(SOURCES_OCI_SECCOMP jail/seccomp-oci.c)
108 ENDIF()
109 
110 IF(JAIL_SUPPORT)
111 ADD_EXECUTABLE(ujail jail/jail.c jail/cgroups.c jail/cgroups-bpf.c jail/elf.c jail/fs.c jail/capabilities.c jail/netifd.c ${SOURCES_OCI_SECCOMP})
112 TARGET_LINK_LIBRARIES(ujail ${ubox} ${ubus} ${uci} ${blobmsg_json})
113 INSTALL(TARGETS ujail
114         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
115 )
116 ADD_DEPENDENCIES(ujail capabilities-names-h)
117 IF(SECCOMP_SUPPORT)
118   ADD_DEPENDENCIES(ujail syscall-names-h)
119 ENDIF()
120 
121 ADD_EXECUTABLE(uxc uxc.c)
122 TARGET_LINK_LIBRARIES(uxc ${ubox} ${ubus} ${blobmsg_json})
123 INSTALL(TARGETS uxc
124         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
125 )
126 endif()
127 
128 IF(UTRACE_SUPPORT)
129 ADD_EXECUTABLE(utrace trace/trace.c)
130 TARGET_LINK_LIBRARIES(utrace ${ubox} ${json} ${blobmsg_json})
131 INSTALL(TARGETS utrace
132         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
133 )
134 ADD_DEPENDENCIES(utrace syscall-names-h)
135 
136 ADD_LIBRARY(preload-trace SHARED trace/preload.c)
137 TARGET_LINK_LIBRARIES(preload-trace dl)
138 INSTALL(TARGETS preload-trace
139         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
140 )
141 endif()

This page was automatically generated by LXR 0.3.1.  •  OpenWrt