meson.build 16 KB

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