diff options
| author | xengineering <me@xengineering.eu> | 2026-05-23 23:48:15 +0200 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2026-05-23 23:48:15 +0200 |
| commit | 4db5f4ae91cc5b9139e3f2e1208e2ec032a89ebf (patch) | |
| tree | 2fce9036b48836e4ab6b994c2ec717136445137c | |
| parent | 0c2903126aa2df80d1ea40295df6365ea37b7651 (diff) | |
| download | finserv-4db5f4ae91cc5b9139e3f2e1208e2ec032a89ebf.tar finserv-4db5f4ae91cc5b9139e3f2e1208e2ec032a89ebf.tar.zst finserv-4db5f4ae91cc5b9139e3f2e1208e2ec032a89ebf.zip | |
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.
| -rw-r--r-- | frontend/meson.build | 2 | ||||
| -rw-r--r-- | handlers.go | 4 | ||||
| -rw-r--r-- | 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, +) |
