meson.build 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. project('clanker-saddle', ['c', 'vala'],
  2. version: '1.1',
  3. )
  4. glib_dep = dependency('glib-2.0')
  5. gobject_dep = dependency('gobject-2.0')
  6. gio_dep = dependency('gio-2.0')
  7. json_glib_dep = dependency('json-glib-1.0')
  8. soup_dep = dependency('libsoup-3.0')
  9. libxml_dep = dependency('libxml-2.0')
  10. sqlite_dep = dependency('sqlite3')
  11. invercargill_dep = dependency('invercargill-1')
  12. invercargill_json_dep = dependency('invercargill-json')
  13. invercargill_sql_dep = dependency('invercargill-sql')
  14. invercargill_sql_inversion_dep = dependency('invercargill-sql-inversion')
  15. inversion_dep = dependency('inversion-0.1')
  16. astralis_dep = dependency('astralis-0.1')
  17. statum_dep = dependency('statum-0.1')
  18. spry_dep = dependency('spry-0.2')
  19. # The dev stack (spry 0.2 and co) lives in a non-standard prefix on
  20. # development machines (~/.local): meson's automatic build rpath makes
  21. # the BUILD-tree binary run, but `meson install` strips it, leaving the
  22. # installed binary unable to load libspry outside the build tree (the
  23. # canon_deploy bundle's deployed-boot check). Carry the dependency's
  24. # pkg-config libdir as the INSTALL rpath — inside a usm container the
  25. # same expression resolves the (harmless, existing) system libdir.
  26. devstack_libdir = spry_dep.get_variable(pkgconfig: 'libdir', default_value: '')
  27. # Statum build tools — statum-mkpstm compiles pages, statum-mkres embeds
  28. # resources. Resolved from PATH at setup time.
  29. statum_mkpstm = find_program('statum-mkpstm')
  30. statum_mkres = find_program('statum-mkres')
  31. # =============================================================================
  32. # Statum pages (statum-mkpstm): HTML → StatumPage subclass. Every page
  33. # composes the shared layout (main.html), which the tool discovers next to
  34. # the pages.
  35. # =============================================================================
  36. template_deps = files(
  37. 'src/pages/main.html',
  38. # Partials (plan 16 R3, arch 16): inlined into pages at compile
  39. # time via <pstm-fragment>; discovered next to the pages.
  40. 'src/pages/goal_branches.html',
  41. 'src/pages/goal_compare.html',
  42. 'src/pages/progress_feed.html',
  43. 'src/pages/task_log_feed.html',
  44. 'src/pages/block_answer.html',
  45. 'src/pages/block_reply.html',
  46. 'src/pages/breadcrumb.html',
  47. )
  48. # spry:pages-begin
  49. home_page = custom_target('home-page',
  50. input: 'src/pages/home.html',
  51. output: 'HomePage.vala',
  52. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'HomePage', '--ns', 'ClankerSaddle', '@INPUT@'],
  53. depend_files: template_deps
  54. )
  55. login_page = custom_target('login-page',
  56. input: 'src/pages/login.html',
  57. output: 'LoginPage.vala',
  58. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'LoginPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  59. depend_files: template_deps
  60. )
  61. projects_page = custom_target('projects-page',
  62. input: 'src/pages/projects.html',
  63. output: 'ProjectsPage.vala',
  64. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'ProjectsPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  65. depend_files: template_deps
  66. )
  67. project_detail_page = custom_target('project-detail-page',
  68. input: 'src/pages/project_detail.html',
  69. output: 'ProjectDetailPage.vala',
  70. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'ProjectDetailPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  71. depend_files: template_deps
  72. )
  73. tasks_page = custom_target('tasks-page',
  74. input: 'src/pages/tasks.html',
  75. output: 'TasksPage.vala',
  76. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'TasksPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  77. depend_files: template_deps
  78. )
  79. task_detail_page = custom_target('task-detail-page',
  80. input: 'src/pages/task_detail.html',
  81. output: 'TaskDetailPage.vala',
  82. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'TaskDetailPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  83. depend_files: template_deps
  84. )
  85. task_log_page = custom_target('task-log-page',
  86. input: 'src/pages/task_log.html',
  87. output: 'TaskLogPage.vala',
  88. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'TaskLogPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  89. depend_files: template_deps
  90. )
  91. goals_page = custom_target('goals-page',
  92. input: 'src/pages/goals.html',
  93. output: 'GoalsPage.vala',
  94. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'GoalsPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  95. depend_files: template_deps
  96. )
  97. goal_detail_page = custom_target('goal-detail-page',
  98. input: 'src/pages/goal_detail.html',
  99. output: 'GoalDetailPage.vala',
  100. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'GoalDetailPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  101. depend_files: template_deps
  102. )
  103. saddles_page = custom_target('saddles-page',
  104. input: 'src/pages/saddles.html',
  105. output: 'SaddlesPage.vala',
  106. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'SaddlesPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  107. depend_files: template_deps
  108. )
  109. stacks_page = custom_target('stacks-page',
  110. input: 'src/pages/stacks.html',
  111. output: 'StacksPage.vala',
  112. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'StacksPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  113. depend_files: template_deps
  114. )
  115. stack_detail_page = custom_target('stack-detail-page',
  116. input: 'src/pages/stack_detail.html',
  117. output: 'StackDetailPage.vala',
  118. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'StackDetailPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  119. depend_files: template_deps
  120. )
  121. rules_page = custom_target('rules-page',
  122. input: 'src/pages/rules.html',
  123. output: 'RulesPage.vala',
  124. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'RulesPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  125. depend_files: template_deps
  126. )
  127. discoveries_page = custom_target('discoveries-page',
  128. input: 'src/pages/discoveries.html',
  129. output: 'DiscoveriesPage.vala',
  130. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'DiscoveriesPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  131. depend_files: template_deps
  132. )
  133. chats_page = custom_target('chats-page',
  134. input: 'src/pages/chats.html',
  135. output: 'ChatsPage.vala',
  136. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'ChatsPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  137. depend_files: template_deps
  138. )
  139. chat_detail_page = custom_target('chat-detail-page',
  140. input: 'src/pages/chat_detail.html',
  141. output: 'ChatDetailPage.vala',
  142. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'ChatDetailPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  143. depend_files: template_deps
  144. )
  145. users_page = custom_target('users-page',
  146. input: 'src/pages/users.html',
  147. output: 'UsersPage.vala',
  148. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'UsersPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  149. depend_files: template_deps
  150. )
  151. model_settings_page = custom_target('model-settings-page',
  152. input: 'src/pages/model_settings.html',
  153. output: 'ModelSettingsPage.vala',
  154. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'ModelSettingsPage', '--ns', 'ClankerSaddle', '@INPUT@'],
  155. depend_files: template_deps
  156. )
  157. profile_page = custom_target('profile-page',
  158. input: 'src/pages/profile.html',
  159. output: 'ProfilePage.vala',
  160. command: [statum_mkpstm, '-o', '@OUTPUT@', '-n', 'ProfilePage', '--ns', 'ClankerSaddle', '@INPUT@'],
  161. depend_files: template_deps
  162. )
  163. # spry:pages-end
  164. # =============================================================================
  165. # Embedded resources (statum-mkres): the stylesheet precompressed at build
  166. # time and served from /_statum/resource/app.css.
  167. # =============================================================================
  168. app_css = custom_target('app-css',
  169. input: 'src/pages/app.css',
  170. output: 'AppCss.vala',
  171. command: [statum_mkres, '-o', '@OUTPUT@', '-n', 'app.css', '--class-name', 'AppCss',
  172. '--ns', 'ClankerSaddle', '-c', 'text/css', '@INPUT@'],
  173. )
  174. app_js = custom_target('app-js',
  175. input: 'src/pages/app.js',
  176. output: 'AppJs.vala',
  177. command: [statum_mkres, '-o', '@OUTPUT@', '-n', 'app.js', '--class-name', 'AppJs',
  178. '--ns', 'ClankerSaddle', '-c', 'text/javascript', '@INPUT@'],
  179. )
  180. task_log_js = custom_target('task-log-js-res',
  181. input: 'src/pages/task_log.js',
  182. output: 'TaskLogJs.vala',
  183. command: [statum_mkres, '-o', '@OUTPUT@', '-n', 'task_log.js', '--class-name', 'TaskLogJs',
  184. '--ns', 'ClankerSaddle', '-c', 'text/javascript', '@INPUT@'],
  185. )
  186. favicon_png = custom_target('favicon-png',
  187. input: 'src/clanker-saddle.png',
  188. output: 'FaviconResource.vala',
  189. command: [statum_mkres, '-o', '@OUTPUT@', '-n', 'clanker-saddle.png',
  190. '--class-name', 'FaviconResource', '--ns', 'ClankerSaddle',
  191. '-c', 'image/png', '@INPUT@'],
  192. )
  193. emblem_png = custom_target('emblem-png',
  194. input: 'src/clanker-saddle-emblem.png',
  195. output: 'EmblemResource.vala',
  196. command: [statum_mkres, '-o', '@OUTPUT@', '-n', 'clanker-saddle-emblem.png',
  197. '--class-name', 'EmblemResource', '--ns', 'ClankerSaddle',
  198. '-c', 'image/png', '@INPUT@'],
  199. )
  200. # =============================================================================
  201. # Sources
  202. # =============================================================================
  203. app_sources = files(
  204. # spry:sources-begin
  205. 'src/main.vala',
  206. 'src/Json.vala',
  207. 'src/Format.vala',
  208. 'src/Data/Entities.vala',
  209. 'src/Data/Migrations/M0001_Initial.vala',
  210. 'src/Data/Migrations/M0002_BatchImprovements.vala',
  211. 'src/Data/Migrations/M0003_EventIndexes.vala',
  212. 'src/Data/Migrations/M0004_ProjectUnderstandings.vala',
  213. 'src/Data/Migrations/M0005_Discoveries.vala',
  214. 'src/Data/Migrations/M0006_Advisor.vala',
  215. 'src/Data/Migrations/M0007_ParkingGuard.vala',
  216. 'src/Data/Migrations/M0008_AnswerWake.vala',
  217. 'src/Data/Migrations/M0009_TurnCapPark.vala',
  218. 'src/Data/Migrations/M0010_ModelConfig.vala',
  219. 'src/Data/Migrations/M0011_UserPreferences.vala',
  220. 'src/Data/Migrations/M0012_ProviderPushSubscriptions.vala',
  221. 'src/Services/ProjectService.vala',
  222. 'src/Services/TaskService.vala',
  223. 'src/Services/GoalService.vala',
  224. 'src/Services/SaddleService.vala',
  225. 'src/Services/EventService.vala',
  226. 'src/Services/LifecycleService.vala',
  227. 'src/Services/SaddlePollState.vala',
  228. 'src/Services/AnswerDeliveryHub.vala',
  229. 'src/Services/AllocationService.vala',
  230. 'src/Services/StatePulse.vala',
  231. 'src/Services/Dispatcher.vala',
  232. 'src/Services/RuleService.vala',
  233. 'src/Services/StackService.vala',
  234. 'src/Services/NoteService.vala',
  235. 'src/Services/UnderstandingService.vala',
  236. 'src/Services/DiscoveryService.vala',
  237. 'src/Services/CapabilityService.vala',
  238. 'src/Services/TimelineService.vala',
  239. 'src/Services/PushService.vala',
  240. 'src/Services/ChatService.vala',
  241. 'src/Services/ModelConfigService.vala',
  242. 'src/Services/UserPreferenceService.vala',
  243. 'src/Services/CanonService.vala',
  244. 'src/Services/AdvisorService.vala',
  245. 'src/Services/AdvisorCallback.vala',
  246. 'src/Api/SaddleApi.vala',
  247. 'src/Api/ProjectApi.vala',
  248. 'src/Api/AdvisorApi.vala',
  249. 'src/Api/EventLogApi.vala',
  250. 'src/Api/PushApi.vala',
  251. 'src/actions/Forms.vala',
  252. 'src/actions/LoginAction.vala',
  253. 'src/actions/ProjectActions.vala',
  254. 'src/actions/TaskActions.vala',
  255. 'src/actions/GoalActions.vala',
  256. 'src/actions/DashboardActions.vala',
  257. 'src/actions/SaddleActions.vala',
  258. 'src/actions/RuleActions.vala',
  259. 'src/actions/DiscoveryActions.vala',
  260. 'src/actions/AdvisorActions.vala',
  261. 'src/actions/StackActions.vala',
  262. 'src/actions/NoteActions.vala',
  263. 'src/actions/CapabilityActions.vala',
  264. 'src/actions/UserActions.vala',
  265. 'src/actions/ModelActions.vala',
  266. 'src/actions/ProfileActions.vala',
  267. 'src/actions/PushActions.vala',
  268. 'src/entrypoints/HomeEntrypoint.vala',
  269. 'src/entrypoints/LoginEntrypoint.vala',
  270. 'src/entrypoints/ProjectsEntrypoint.vala',
  271. 'src/entrypoints/TasksEntrypoint.vala',
  272. 'src/entrypoints/TaskDetailEntrypoint.vala',
  273. 'src/entrypoints/TaskLogEntrypoint.vala',
  274. 'src/entrypoints/GoalDetailEntrypoint.vala',
  275. 'src/entrypoints/SaddlesEntrypoint.vala',
  276. 'src/entrypoints/RulesEntrypoint.vala',
  277. 'src/entrypoints/DiscoveriesEntrypoint.vala',
  278. 'src/entrypoints/ChatsEntrypoint.vala',
  279. 'src/entrypoints/ChatDetailEntrypoint.vala',
  280. 'src/entrypoints/StacksEntrypoint.vala',
  281. 'src/entrypoints/UsersEntrypoint.vala',
  282. 'src/entrypoints/ModelSettingsEntrypoint.vala',
  283. 'src/entrypoints/ProfileEntrypoint.vala',
  284. # spry:sources-end
  285. )
  286. app_generated = [
  287. # spry:generated-begin
  288. home_page,
  289. login_page,
  290. projects_page,
  291. project_detail_page,
  292. tasks_page,
  293. task_detail_page,
  294. task_log_page,
  295. goals_page,
  296. goal_detail_page,
  297. saddles_page,
  298. rules_page,
  299. discoveries_page,
  300. chats_page,
  301. chat_detail_page,
  302. stacks_page,
  303. stack_detail_page,
  304. users_page,
  305. model_settings_page,
  306. profile_page,
  307. # spry:generated-end
  308. ]
  309. clanker_saddle_exe = executable('clanker-saddle',
  310. app_sources + app_generated + [app_css, app_js, task_log_js, favicon_png, emblem_png],
  311. vala_args: ['--vapidir=' + join_paths(meson.current_source_dir(), 'vapi')],
  312. dependencies: [
  313. spry_dep,
  314. statum_dep,
  315. astralis_dep,
  316. inversion_dep,
  317. invercargill_sql_inversion_dep,
  318. invercargill_sql_dep,
  319. invercargill_json_dep,
  320. invercargill_dep,
  321. sqlite_dep,
  322. libxml_dep,
  323. soup_dep,
  324. json_glib_dep,
  325. gio_dep,
  326. gobject_dep,
  327. glib_dep,
  328. ],
  329. install: true,
  330. install_rpath: devstack_libdir
  331. )
  332. # The canonical texts ride the install into
  333. # datadir/clanker-saddle/canon; the service resolves that layout at
  334. # run time with a source-tree fallback (the Saddle daemon mirror —
  335. # the web is the canon's owner now).
  336. canon_files = files(
  337. 'canon/gnu-manifesto.md',
  338. 'canon/free-software-definition.md',
  339. 'canon/open-source-misses-the-point.md',
  340. 'canon/right-to-read.md',
  341. 'canon/selling-free-software.md',
  342. 'canon/selling-exceptions.md',
  343. 'canon/words-to-avoid.md',
  344. 'canon/misinterpreting-copyright.md',
  345. 'canon/university-and-the-web.md',
  346. 'canon/plato-apology.md',
  347. 'canon/plato-republic-vi.md',
  348. 'canon/aristotle-nicomachean-ethics-i-ii.md',
  349. 'canon/aquinas-treatise-on-happiness.md',
  350. 'canon/lewis-abolition-of-man-i-ii.md',
  351. 'canon/magnifica-humanitas-summary.md')
  352. install_data(canon_files,
  353. install_dir: get_option('datadir') / 'clanker-saddle' / 'canon')
  354. # =============================================================================
  355. # Tests: the web-stack suite is a package (plan 16 R5, arch 18) —
  356. # test/web_stack_test.py is the entry shim meson invokes; the shared
  357. # machinery (fake saddle daemon, wire helpers, fixtures, the runner)
  358. # lives in test/harness.py and one module per scenario bundle
  359. # in test/bundles/. The default run is SEQUENTIAL (the unbounded
  360. # parallel fan-out OOM'd the machine; --parallel N opts back in with a
  361. # concurrency cap), so the timeout covers the summed bundle times.
  362. # =============================================================================
  363. python_test = import('python').find_installation('python3')
  364. test('web-stack', python_test,
  365. args: [files('test/web_stack_test.py'), clanker_saddle_exe],
  366. timeout: 3600,
  367. )
  368. # The event-log page's client JS: static source checks plus a python
  369. # port of the ingest/ordering/scroll-stick logic. Standalone by
  370. # design - it must run where the app binary cannot be built (the
  371. # statum toolchain is a build-time dependency that not every
  372. # container carries), so it reads src/pages/task_log.html directly
  373. # instead of driving a live server.
  374. test('task-log-js', python_test,
  375. args: [files('test/test_task_log_js.py')],
  376. timeout: 120,
  377. )