meson.build 16 KB

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