~dobey/ubuntu-app-launch/ship-app-mock

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
project(ubuntu-app-launch C CXX)
cmake_minimum_required(VERSION 2.8.9)

##########################
# Version Info
##########################

set(API_VERSION 3)
set(ABI_VERSION 4)

##########################
# Options
##########################

option (enable_tests "Build tests" ON)

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")

set(PACKAGE ${CMAKE_PROJECT_NAME})

##########################
# Dependent Packages
##########################

find_package(PkgConfig REQUIRED)
find_package(GObjectIntrospection REQUIRED)
include(GNUInstallDirs)
include(CheckIncludeFile)
include(CheckFunctionExists)
include(UseGlibGeneration)
include(UseGdbusCodegen)
include(UseConstantBuilder)
include(UseLttngGenTp)

# Workaround for libexecdir on debian
if (EXISTS "/etc/debian_version") 
  set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
  set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
endif()

set(pkglibexecdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_FULL_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}")

execute_process(COMMAND dpkg-architecture -qDEB_BUILD_MULTIARCH
	OUTPUT_VARIABLE UBUNTU_APP_LAUNCH_ARCH
	OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(ubuntu_app_launch_arch "${UBUNTU_APP_LAUNCH_ARCH}")

add_compile_options(
# Because we believe in quality
	-Wall -Werror
	-g
	-pthread
)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

enable_testing()

pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})

pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0)
include_directories(${GOBJECT2_INCLUDE_DIRS})

pkg_check_modules(GIO2 REQUIRED gio-2.0 gio-unix-2.0)
include_directories(${GIO2_INCLUDE_DIRS})

pkg_check_modules(JSONGLIB REQUIRED json-glib-1.0>=1.1.2)
include_directories(${JSONGLIB_INCLUDE_DIRS})

pkg_check_modules(ZEITGEIST REQUIRED zeitgeist-2.0)
include_directories(${ZEITGEIST_INCLUDE_DIRS})

pkg_check_modules(CLICK REQUIRED click-0.4>=0.4.18)
include_directories(${CLICK_INCLUDE_DIRS})

pkg_check_modules(LIBUPSTART REQUIRED libupstart)
include_directories(${LIBUPSTART_INCLUDE_DIRS})

pkg_check_modules(DBUS REQUIRED dbus-1)
include_directories(${DBUS_INCLUDE_DIRS})

pkg_check_modules(DBUSTEST REQUIRED dbustest-1>=14.04.0)
include_directories(${DBUSTEST_INCLUDE_DIRS})

pkg_check_modules(LTTNG REQUIRED lttng-ust)
include_directories(${LTTNG_INCLUDE_DIRS})

pkg_check_modules(CGMANAGER REQUIRED libcgmanager)
include_directories(${CGMANAGER_INCLUDE_DIRS})

pkg_check_modules(MIR REQUIRED mirclient)
include_directories(${MIR_INCLUDE_DIRS})

pkg_check_modules(WHOOPSIE REQUIRED libwhoopsie)
include_directories(${WHOOPSIE_INCLUDE_DIRS})

pkg_check_modules(LIBERTINE REQUIRED libertine)
include_directories(${LIBERTINE_INCLUDE_DIRS})

pkg_check_modules(CURL libcurl>=7.47)
include_directories(${CURL_INCLUDE_DIRS})

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

add_definitions( -DXMIR_HELPER="${pkglibexecdir}/xmir-helper" )
add_definitions( -DSNAPPY_XMIR="${CMAKE_INSTALL_FULL_BINDIR}/snappy-xmir" )

####################
# Helpers
####################

add_library(helpers STATIC helpers.c helpers-shared.c)
target_link_libraries(helpers ${GIO2_LIBRARIES} ${JSONGLIB_LIBRARIES} ${CLICK_LIBRARIES} ${WHOOPSIE_LIBRARIES})

####################
# desktop-hook
####################

add_executable(desktop-hook desktop-hook.c)
set_target_properties(desktop-hook PROPERTIES OUTPUT_NAME "desktop-hook")
target_link_libraries(desktop-hook helpers ${CLICK_LIBRARIES} ${WHOOPSIE_LIBRARIES})
install(TARGETS desktop-hook RUNTIME DESTINATION "${pkglibexecdir}")

####################
# exec-line-exec
####################

add_lttng_gen_tp(NAME exec-line-exec-trace)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(exec-line-exec exec-line-exec.c "${CMAKE_CURRENT_BINARY_DIR}/exec-line-exec-trace.c")
set_target_properties(exec-line-exec PROPERTIES OUTPUT_NAME "exec-line-exec")
target_link_libraries(exec-line-exec helpers ${LTTNG_LIBRARIES})
install(TARGETS exec-line-exec RUNTIME DESTINATION "${pkglibexecdir}")

####################
# zg-report-app
####################

add_executable(zg-report-app zg-report-app.c)
set_target_properties(zg-report-app PROPERTIES OUTPUT_NAME "zg-report-app")
target_link_libraries(zg-report-app ubuntu-launcher ${ZEITGEIST_LIBRARIES} ${GOBJECT2_LIBRARIES} ${GLIB2_LIBRARIES})
install(TARGETS zg-report-app RUNTIME DESTINATION "${pkglibexecdir}")

####################
# application-job
####################

add_executable(application-job application-job.c)
set_target_properties(application-job PROPERTIES OUTPUT_NAME "application-job")
target_link_libraries(application-job ubuntu-launcher)
install(TARGETS application-job RUNTIME DESTINATION "${pkglibexecdir}")

####################
# application-failed
####################

add_executable(application-failed application-failed.c)
set_target_properties(application-failed PROPERTIES OUTPUT_NAME "application-failed")
target_link_libraries(application-failed ${GIO2_LIBRARIES})
install(TARGETS application-failed RUNTIME DESTINATION "${pkglibexecdir}")

####################
# xmir-helper
####################

add_executable(xmir-helper xmir-helper.c)
set_target_properties(xmir-helper PROPERTIES OUTPUT_NAME "xmir-helper")
install(TARGETS xmir-helper RUNTIME DESTINATION "${pkglibexecdir}")

####################
# untrusted-helper-type-end
####################

add_executable(untrusted-helper-type-end untrusted-helper-type-end.c)
set_target_properties(untrusted-helper-type-end PROPERTIES OUTPUT_NAME "untrusted-helper-type-end")
target_link_libraries(untrusted-helper-type-end ubuntu-launcher)
install(TARGETS untrusted-helper-type-end RUNTIME DESTINATION "${pkglibexecdir}")

####################
# cgroup-reap-all
####################

add_executable(cgroup-reap-all cgroup-reap-all.c)
set_target_properties(cgroup-reap-all PROPERTIES OUTPUT_NAME "cgroup-reap-all")
target_link_libraries(cgroup-reap-all helpers)
install(TARGETS cgroup-reap-all RUNTIME DESTINATION "${pkglibexecdir}")

####################
# oom-adjust-setuid-helper
####################

add_executable(oom-adjust-setuid-helper oom-adjust-setuid-helper.c)
set_target_properties(oom-adjust-setuid-helper PROPERTIES OUTPUT_NAME "oom-adjust-setuid-helper")
install(TARGETS oom-adjust-setuid-helper RUNTIME DESTINATION "${pkglibexecdir}")

####################
# socket-demangler
####################

add_executable(socket-demangler-helper socket-demangler.c)
set_target_properties(socket-demangler-helper PROPERTIES OUTPUT_NAME "socket-demangler")
target_link_libraries(socket-demangler-helper ${GIO2_LIBRARIES})
install(TARGETS socket-demangler-helper RUNTIME DESTINATION "${pkglibexecdir}")

####################
# snappy-xmir
####################

####################
# NOTE: This only can link to libraries that are in
# the base UBUNTU CORE image. Which is basically libc
# and not much else. Don't add libs.
####################

add_executable(snappy-xmir snappy-xmir.c)
set_target_properties(snappy-xmir PROPERTIES OUTPUT_NAME "snappy-xmir")
install(TARGETS snappy-xmir RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")

####################
# snappy-xmir-envvars
####################

add_executable(snappy-xmir-envvars snappy-xmir-envvars.c)
set_target_properties(snappy-xmir-envvars PROPERTIES OUTPUT_NAME "snappy-xmir-envvars")
# No libs, otherwise we have to worry about how to handle finding them
install(TARGETS snappy-xmir-envvars RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")


####################
# ubuntu-app-launch-desktop.click-hook
####################

configure_file("ubuntu-app-launch-desktop.click-hook.in" "${CMAKE_CURRENT_SOURCE_DIR}/debian/ubuntu-app-launch-desktop.click-hook" @ONLY)

add_subdirectory(libubuntu-app-launch)
add_subdirectory(upstart-jobs)
add_subdirectory(tools)
add_subdirectory(ubuntu-app-test)

# testing & coverage
if (${enable_tests})
  enable_testing ()
  add_subdirectory(tests)
endif ()

find_package(CoverageReport)
set(filter-list)
list(APPEND filter-list "/usr/include")
list(APPEND filter-list "${CMAKE_SOURCE_DIR}/tests/*")
if (NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
  list(APPEND filter-list "${CMAKE_BINARY_DIR}/*")
endif()
ENABLE_COVERAGE_REPORT(
  TARGETS
  	ubuntu-launcher
	launcher-static
  TESTS
  	application-icon-finder-test
	application-info-desktop-test
	cgroup-reap-test
	exec-util-test
	failure-test
	helper-test
	helper-handshake-test
	jobs-base-test
	libual-test
	libual-cpp-test
	list-apps
	snapd-info-test
	zg-test
  FILTER
  	${filter-list}
)