• 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 FIND_LIBRARY(udebug NAMES udebug)
 35 
 36 SET(LIBS ${ubox} ${ubus} ${json} ${blobmsg_json} ${json_script} ${udebug})
 37 
 38 IF(DEBUG)
 39   ADD_DEFINITIONS(-DUDEV_DEBUG -g3)
 40 ENDIF()
 41 
 42 IF(EARLY_PATH)
 43   ADD_DEFINITIONS(-DEARLY_PATH="${EARLY_PATH}")
 44 ENDIF()
 45 
 46 IF(SELINUX)
 47   include(FindPkgConfig)
 48   pkg_search_module(SELINUX REQUIRED libselinux)
 49   add_compile_definitions(WITH_SELINUX)
 50 ENDIF()
 51 
 52 add_subdirectory(upgraded)
 53 
 54 ADD_EXECUTABLE(procd ${SOURCES})
 55 TARGET_LINK_LIBRARIES(procd ${LIBS})
 56 SET_TARGET_PROPERTIES(procd PROPERTIES COMPILE_DEFINITIONS "HAS_UDEBUG")
 57 INSTALL(TARGETS procd
 58         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 59 )
 60 
 61 FIND_PATH(ubox_include_dir libubox/uloop.h)
 62 FIND_PATH(udebug_include_dir NAMES udebug.h)
 63 INCLUDE_DIRECTORIES(${ubox_include_dir} ${udebug_include_dir})
 64 
 65 IF(DISABLE_INIT)
 66 ADD_DEFINITIONS(-DDISABLE_INIT)
 67 ELSE()
 68 ADD_EXECUTABLE(init initd/init.c initd/early.c initd/preinit.c initd/mkdev.c sysupgrade.c watchdog.c
 69         utils/utils.c)
 70 TARGET_INCLUDE_DIRECTORIES(init PUBLIC ${SELINUX_INCLUDE_DIRS})
 71 TARGET_LINK_LIBRARIES(init ${LIBS} ${SELINUX_LIBRARIES})
 72 INSTALL(TARGETS init
 73         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 74 )
 75 
 76 ADD_EXECUTABLE(udevtrigger plug/udevtrigger.c)
 77 INSTALL(TARGETS udevtrigger
 78         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 79 )
 80 ENDIF()
 81 
 82 
 83 ADD_EXECUTABLE(askfirst utils/askfirst.c)
 84 INSTALL(TARGETS askfirst
 85         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 86 )
 87 
 88 ADD_CUSTOM_COMMAND(
 89         OUTPUT syscall-names.h
 90         COMMAND ./make_syscall_h.sh ${CMAKE_C_COMPILER} > ./syscall-names.h
 91         DEPENDS ./make_syscall_h.sh
 92 )
 93 ADD_CUSTOM_TARGET(syscall-names-h DEPENDS syscall-names.h)
 94 
 95 ADD_CUSTOM_COMMAND(
 96         OUTPUT capabilities-names.h
 97         COMMAND ./make_capabilities_h.sh ${CMAKE_C_COMPILER} > ./capabilities-names.h
 98         DEPENDS ./make_capabilities_h.sh
 99 )
100 ADD_CUSTOM_TARGET(capabilities-names-h DEPENDS capabilities-names.h)
101 
102 IF(SECCOMP_SUPPORT)
103 ADD_DEFINITIONS(-DSECCOMP_SUPPORT)
104 ADD_LIBRARY(preload-seccomp SHARED jail/preload.c jail/seccomp.c jail/seccomp-oci.c)
105 TARGET_LINK_LIBRARIES(preload-seccomp dl ${ubox} ${blobmsg_json})
106 INSTALL(TARGETS preload-seccomp
107         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
108 )
109 ADD_DEPENDENCIES(preload-seccomp syscall-names-h)
110 SET(SOURCES_OCI_SECCOMP jail/seccomp-oci.c)
111 ENDIF()
112 
113 IF(JAIL_SUPPORT)
114 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})
115 TARGET_LINK_LIBRARIES(ujail ${ubox} ${ubus} ${uci} ${blobmsg_json})
116 INSTALL(TARGETS ujail
117         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
118 )
119 ADD_DEPENDENCIES(ujail capabilities-names-h)
120 IF(SECCOMP_SUPPORT)
121   ADD_DEPENDENCIES(ujail syscall-names-h)
122 ENDIF()
123 
124 ADD_EXECUTABLE(uxc uxc.c)
125 TARGET_LINK_LIBRARIES(uxc ${ubox} ${ubus} ${blobmsg_json})
126 INSTALL(TARGETS uxc
127         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
128 )
129 endif()
130 
131 IF(UTRACE_SUPPORT)
132 ADD_EXECUTABLE(utrace trace/trace.c)
133 TARGET_LINK_LIBRARIES(utrace ${ubox} ${json} ${blobmsg_json})
134 INSTALL(TARGETS utrace
135         RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
136 )
137 ADD_DEPENDENCIES(utrace syscall-names-h)
138 
139 ADD_LIBRARY(preload-trace SHARED trace/preload.c)
140 TARGET_LINK_LIBRARIES(preload-trace dl)
141 INSTALL(TARGETS preload-trace
142         LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
143 )
144 endif()

This page was automatically generated by LXR 0.3.1.  •  OpenWrt