summary refs log tree commit diff
path: root/.config/yamlfs
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-11-18 17:42:16 +0100
committerRobert Günzler <r@gnzler.io>2022-11-18 18:38:20 +0100
commitd6afa4cb7fbd919989b12277f1e67bbf883a2853 (patch)
tree2ce0de9cbcfccd401b276099f90645660eaaa73e /.config/yamlfs
parenta8127ecbecc0f0da64c0e6714e8553dda6e0e329 (diff)
yamlfs: update
Diffstat (limited to '.config/yamlfs')
-rw-r--r--.config/yamlfs/go-full.yaml2
-rw-r--r--.config/yamlfs/go.yaml22
-rw-r--r--.config/yamlfs/meson.yml203
3 files changed, 113 insertions, 114 deletions
diff --git a/.config/yamlfs/go-full.yaml b/.config/yamlfs/go-full.yaml
index 21fb36d..5728877 100644
--- a/.config/yamlfs/go-full.yaml
+++ b/.config/yamlfs/go-full.yaml
@@ -24,7 +24,7 @@ go.mod: |
   go {% $goversion %}
 
 Dockerfile: |
-  # syntax=docker/dockerfile:1.1-experimental
+  # syntax=docker/dockerfile:1.2
   # vim: ft=dockerfile
 
   ARG GO_VERSION={% $goversion %}
diff --git a/.config/yamlfs/go.yaml b/.config/yamlfs/go.yaml
index 34a1979..96f6599 100644
--- a/.config/yamlfs/go.yaml
+++ b/.config/yamlfs/go.yaml
@@ -1,3 +1,4 @@
+{% $man := .man %}
 cmd:
   {% .name %}:
     main.go: |
@@ -17,6 +18,9 @@ version:
     	Version = "0.0.0+unknown"
     )
 
+go.mod: |
+{% exec "sh" "-c" (printf "cd /tmp/;go mod init %s;cat go.mod;rm go.mod;" .pkg) | indent 4 %}
+
 Makefile: |
   .POSIX:
 
@@ -29,7 +33,7 @@ Makefile: |
   GO           ?= go
   GOLINT       ?= $(GO) vet # golangci-lint run --build-tags "$(GO_BUILDTAGS)"
   GOTEST       ?= $(GO) test # gotestsum --format=testname --
-  {% if .man -%}
+  {% if $man -%}
   SCDOC        ?= scdoc
   {%- end %}
   
@@ -38,7 +42,7 @@ Makefile: |
   GOTEST_FLAGS ?=
   GOLINT_FLAGS ?=
 
-  all: lint test build {% if .man %}man{% end %}
+  all: lint test build {% if $man %}man{% end %}
 
   .PHONY: build
   build: {% .name %}
@@ -47,7 +51,7 @@ Makefile: |
   {% .name %}: GO_VERSIONFLAGS += -X $(GO_PKG)/version.Version=$(VERSION)
   {% .name %}: GO_VERSIONFLAGS += -X $(GO_PKG)/version.Revision=$(REVISION)
   {% .name %}: GO_VERSIONFLAGS += -X $(GO_PKG)/version.Package=$(GO_PKG)
-  {% .name %}:
+  {% .name %}: $(shell find . -name '*.go')
   	$(GO) build -o $(DESTDIR)$(PREFIX)/$@ -tags '$(GO_BUILDTAGS)' -ldflags '$(GO_LDFLAGS) $(GO_VERSIONFLAGS)' ./cmd/$@
 
   .PHONY: lint
@@ -62,7 +66,7 @@ Makefile: |
   .PHONY: check
   check: test
 
-  {% if .man %}
+  {% if $man %}
   manpages = doc/{% .name %}.1
   $(manpages): %: %.scd
   $(manpages):
@@ -79,18 +83,18 @@ Makefile: |
   .PHONY: install
   install:
   	mkdir -p $(DESTDIR)$(BINDIR)
-  	{% if .man -%}
+	{% if $man -%}
   	mkdir -p $(DESTDIR)$(MANDIR)/man1
   	{%- end %}
   	cp -f {% .name %} $(DESTDIR)$(BINDIR)
-  	{% if .man -%}
+	{% if $man -%}
   	cp -f doc/{% .name %}.1 $(DESTDIR)$(MANDIR)/man1
   	{%- end %}
 
   .PHONY: uninstall
   uninstall:
   	rm -v $(DESTDIR)$(BINDIR)/{% .name %}
-  	{% if .man -%}
+	{% if $man -%}
   	rm -v $(DESTDIR)$(MANDIR)/man1/{% .name %}.1
   	{%- end %}
 
@@ -119,7 +123,7 @@ Makefile: |
 
   [{Makefile,go.mod,go.sum,*go}]
   indent_style = tab
-  indent_size = 8
+  indent_size = 4
 
   [*.md]
   trim_trailing_whitespace = false
@@ -132,7 +136,7 @@ README.md: |
 
   TODO
 
-{% if .man %}
+{% if $man %}
 doc:
   {% .name %}.1.scd: |
     {% .name %}(1)
diff --git a/.config/yamlfs/meson.yml b/.config/yamlfs/meson.yml
index a15c9e1..4204c86 100644
--- a/.config/yamlfs/meson.yml
+++ b/.config/yamlfs/meson.yml
@@ -1,105 +1,113 @@
+README.md: |-
+  # {% .name %}
+
+  TODO
+
 meson.build: |-
   project(
-      '{% .name %}',
-      'c',
-      version: '0.0.0+unknown',
-      license: 'MIT',
-      default_options: [
-        'c_std=c99',
-        'warning_level=2',
-        'werror=true',
-      ],
-      meson_version: '>= 0.47',
+  	'{% .name %}',
+  	'c',
+  	version: '0.0.0+unknown',
+  	license: 'MIT',
+  	meson_version: '>=0.50.0',
+  	default_options: [
+  		'c_std=c99',
+  		'warning_level=2',
+  		'werror=true',
+  	],
   )
 
   cc = meson.get_compiler('c')
   add_project_arguments(cc.get_supported_arguments([
-    '-D_POSIX_C_SOURCE=200809L',
-
-    '-Wundef',
-    '-Wlogical-op',
-    '-Wmissing-include-dirs',
-    '-Wold-style-definition',
-    '-Wpointer-arith',
-    '-Winit-self',
-    '-Wfloat-equal',
-    '-Wstrict-prototypes',
-    '-Wredundant-decls',
-    '-Wimplicit-fallthrough=2',
-    '-Wendif-labels',
-    '-Wstrict-aliasing=2',
-    '-Woverflow',
-    '-Wformat=2',
-  
-    '-Wno-missing-braces',
-    '-Wno-missing-field-initializers',
-    '-Wno-unused-parameter',
+  	'-D_POSIX_C_SOURCE 200112L',
+
+  	'-Wundef',
+  	'-Wlogical-op',
+  	'-Wmissing-include-dirs',
+  	'-Wold-style-definition',
+  	'-Wpointer-arith',
+  	'-Winit-self',
+  	'-Wfloat-equal',
+  	'-Wstrict-prototypes',
+  	'-Wredundant-decls',
+  	'-Wimplicit-fallthrough=2',
+  	'-Wendif-labels',
+  	'-Wstrict-aliasing=2',
+  	'-Woverflow',
+  	'-Wformat=2',
+
+  	'-Wno-missing-braces',
+  	'-Wno-missing-field-initializers',
+  	'-Wno-unused-parameter',
   ]), language: 'c')
 
   version = '"@0@ (" __DATE__ ")"'.format(meson.project_version())
   # embed version sourced from git ref
   git = find_program('git', native: true, required: false)
   if git.found()
-      git_commit_hash = run_command([
-        git, 'describe', '--always', '--tags'
-      ])
-      git_branch = run_command([
-        git, 'rev-parse', '--abbrev-ref', 'HEAD'
-      ])
-      if git_commit_hash.returncode() == 0 and git_branch.returncode() == 0
-        version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(
-          git_commit_hash.stdout().strip(),
-          git_branch.stdout().strip(),
-        )
-      endif
+  	git_commit_hash = run_command([
+  		git, 'describe', '--always', '--tags'
+  	])
+  	git_branch = run_command([
+  		git, 'rev-parse', '--abbrev-ref', 'HEAD'
+  	])
+  	if git_commit_hash.returncode() == 0 and git_branch.returncode() == 0
+  		version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(
+  			git_commit_hash.stdout().strip(),
+  			git_branch.stdout().strip(),
+  		)
+  	endif
   endif
   add_project_arguments('-DVERSION=@0@'.format(version), language: 'c')
 
   {%- if .man %}
 
   scdoc = dependency(
-    'scdoc',
-    version: '>=1.9.2',
-    native: true,
-    required: get_option('man-pages'),
+  	'scdoc',
+  	version: '>=1.9.2',
+  	native: true,
+  	required: get_option('man-pages'),
   )
   if scdoc.found()
-    scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
-    sh = find_program('sh', native: true)
-    mandir = get_option('mandir')
-    man_files = [
-      '{% .name %}.1.scd',
-    ]
-    foreach fn : man_files
-      topic = fn.split('.')[-3].split('/')[-1]
-      section = fn.split('.')[-2]
-      output = '@0@.@1@'.format(topic, section)
-
-      custom_target(
-        output,
-        input: fn,
-        output: output,
-        command: [
-          sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output)
-        ],
-        install: true,
-        install_dir: '@0@/man@1@'.format(mandir, section),
-    )
-    endforeach
+  	scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
+  	sh = find_program('sh', native: true)
+  	mandir = get_option('mandir')
+  	man_files = [
+  		'{% .name %}.1.scd',
+  	]
+  	foreach fn : man_files
+  		topic = fn.split('.')[-3].split('/')[-1]
+  		section = fn.split('.')[-2]
+  		output = '@0@.@1@'.format(topic, section)
+
+  		custom_target(
+  			output,
+  			input: fn,
+  			output: output,
+  			command: [
+  				sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output)
+  			],
+  			install: true,
+  			install_dir: '@0@/man@1@'.format(mandir, section),
+  		)
+  	endforeach
   endif
   {%- end %}
 
+  src_inc = include_directories('include')
+  src_files = [
+  	'src/main.c',
+  ]
+
   executable(
-    meson.project_name(),
-    files(
-      'src/main.c',
-    ),
-    include_directories: include_directories('include'),
-    dependencies: [],
-    install: true,
+  	meson.project_name(),
+  	files(src_files),
+  	dependencies: [],
+  	include_directories: [src_inc],
+  	install: true,
   )
 
-{% if .man %}
+{% if (eq .man "true") %}
 meson_options.txt: |
   option('man-pages', type: 'feature', value: 'auto', description: 'Generate man pages using scdoc')
 
@@ -121,36 +129,37 @@ meson_options.txt: |
   # OPTIONS
 
   *-h, -help*
-    Show help message and quit.
+  	Show help message and quit.
 
   # SEE ALSO
 
-    *{% .name %}*(5)
+  	*{% .name %}*(5)
 
   # AUTHORS
 
   Maintained by TODO author <mail>.
-  For more information, see {% .pkg %}.
+  For more information, see <website>.
 {% end %}
 
 src:
   main.c: |-
-    #define _POSIX_C_SOURCE 200809L
+    #define _POSIX_C_SOURCE 200112L
+
     #include <stdlib.h>
     #include <stdio.h>
 
     #include "{% .name %}.h"
 
     int main(int argc, char **argv) {
-        printf("%s version %s\n\n", *argv, VERSION);
+    	printf("%s version %s\n\n", *argv, VERSION);
 
-        printf("args (len: %d)", argc-1);
-        for (int i=1; i < argc; ++i) {
-            printf(" '%s'", argv[i]);
-        }
-        printf("\n");
+    	printf("args (len: %d)", argc-1);
+    	for (int i=1; i < argc; ++i) {
+    		printf(" '%s'", argv[i]);
+    	}
+    	printf("\n");
 
-        return 0;
+    	return 0;
     }
 
 include:
@@ -171,33 +180,19 @@ include:
 
 .editorconfig: |-
   ; http://editorconfig.org/
-
   root = true
 
   [*]
   charset = utf-8
   end_of_line = lf
-  indent_style = space
-
-  [*.{c,h,cmake,txt}]
   indent_style = tab
-  indent_size = 4
+  insert_final_newline = true
+  trim_trailing_whitespace = true
 
   [*.md]
   trim_trailing_whitespace = false
 
-  [meson.build]
-  indent_size = 2
-
-  [Dockerfile]
-  indent_size = 4
-
-README.md: |-
-  # {% .name %}
-
-  TODO
-
-{% if .docker %}
+{% if (eq .docker "true") %}
 Dockerfile: |-
   TODO
 {% end %}