meson.build 14 KB

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