From 4db5f4ae91cc5b9139e3f2e1208e2ec032a89ebf Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 23 May 2026 23:48:15 +0200 Subject: Add global Meson build system This commit fully introduces Meson as a build system for this repository. It makes sure the frontend page is built with Hugo before the Go executable is built and embeds the frontend. --- frontend/meson.build | 2 +- handlers.go | 4 ++-- meson.build | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/frontend/meson.build b/frontend/meson.build index e387145..b0c4b2f 100644 --- a/frontend/meson.build +++ b/frontend/meson.build @@ -12,7 +12,7 @@ endforeach subdir('layouts') -custom_target( +frontend = custom_target( output : 'public', command : [ hugo, diff --git a/handlers.go b/handlers.go index 1ca96d8..4e7bfe6 100644 --- a/handlers.go +++ b/handlers.go @@ -8,14 +8,14 @@ import ( "net/http" ) -//go:embed frontend/public +//go:embed build/frontend/public var frontendEmbed embed.FS func init() { router.HandleFunc("/api/version", version) // frontend must come last to make sure /api takes precedence - frontend, err := fs.Sub(frontendEmbed, "frontend/public") + frontend, err := fs.Sub(frontendEmbed, "build/frontend/public") if err != nil { log.Fatalf("No embedded frontend: %v", err) } diff --git a/meson.build b/meson.build index 451844c..5ee335b 100644 --- a/meson.build +++ b/meson.build @@ -3,4 +3,24 @@ project( version : files('VERSION.txt'), ) +go = find_program('go', required : true) + subdir('frontend') + +finserv_linux_amd64 = custom_target( + input : [ + meson.current_source_dir() / 'main.go', + meson.current_source_dir() / 'handlers.go', + ], + output : 'finserv-linux-amd64', + env : {'GOOS': 'linux', 'GOARCH': 'amd64'}, + command : [ + go, + 'build', + '-o', + '@OUTPUT@', + '@INPUT@', + ], + depends : frontend, + build_by_default : true, +) -- cgit v1.3