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

This page was automatically generated by LXR 0.3.1.  •  OpenWrt