# HG changeset patch
# Node ID 1ae3be956f33
# Parent  2cd429762a7d
diff --git a/meson.build b/meson.build
--- a/meson.build
+++ b/meson.build
@@ -24,7 +24,7 @@ version_conf.set('TALKATU_EXTRA_VERSION'
 version_conf.set('TALKATU_VERSION', meson.project_version())
 
 LOCALE_DIR = get_option('prefix') / get_option('localedir')
-add_project_arguments('-DLOCALEDIR="@0@"'.format(LOCALE_DIR), language : 'c')
+add_project_arguments(f'-DLOCALEDIR="@LOCALE_DIR@"', language : 'c')
 
 devenv = environment()
 
@@ -52,8 +52,7 @@ endif
 ###############################################################################
 GETTEXT_PACKAGE = 'talkatu'
 
-add_project_arguments('-DGETTEXT_PACKAGE="@0@"'.format(GETTEXT_PACKAGE),
-	language : 'c')
+add_project_arguments(f'-DGETTEXT_PACKAGE="@GETTEXT_PACKAGE@"', language : 'c')
 
 if get_option('nls')
 	i18n = import('i18n')
@@ -95,23 +94,10 @@ if compiler.has_argument('-Wformat')
 	endif
 endif
 
-# check if we're using gcc
-if compiler.get_id() == 'gcc' or host_machine.system() == 'darwin'
-	add_project_arguments(
-		'-DTALKATU_UNUSED=__attribute__((unused))',
-		'-ggdb',
-		language : 'c'
-	)
-else
-	add_project_arguments(
-		'-DTALKATU_UNUSED=',
-		language : 'c'
-	)
-endif
-
 toplevel_inc = include_directories('.')
 
 bpenv = environment()
+doc_targets = []
 
 ###############################################################################
 # Subdirectories
@@ -125,17 +111,13 @@ subdir('vapi')
 # doc alias target
 ###############################################################################
 if get_option('doc')
-	doc_targets = [talkatu_doc]
-
 	alias_target('doc', doc_targets)
 endif
 
 ###############################################################################
 # devenv
 ###############################################################################
-if meson.version().version_compare('>=0.58.0')
-    meson.add_devenv(devenv)
-endif
+meson.add_devenv(devenv)
 
 ###############################################################################
 # Install stuff
diff --git a/talkatu/meson.build b/talkatu/meson.build
--- a/talkatu/meson.build
+++ b/talkatu/meson.build
@@ -133,22 +133,14 @@ TALKATU_PUBLIC_BUILT_HEADERS += [talkatu
 ###############################################################################
 # talkatu.h
 ###############################################################################
-TALKATU_H_INCLUDES = ''
+TALKATU_H_INCLUDES = []
 
-foreach header : TALKATU_HEADERS
-	TALKATU_H_INCLUDES = '@0@\n#include <talkatu/@1@>'.format(
-		TALKATU_H_INCLUDES,
-		header)
-endforeach
-
-foreach header : ['talkatuenums.h', 'talkatuversion.h']
-	TALKATU_H_INCLUDES = '@0@\n#include <talkatu/@1@>'.format(
-		TALKATU_H_INCLUDES,
-		header)
+foreach header : TALKATU_HEADERS + ['talkatuenums.h', 'talkatuversion.h']
+	TALKATU_H_INCLUDES += f'#include <talkatu/@header@>'
 endforeach
 
 conf = configuration_data()
-conf.set('TALKATU_H_INCLUDES', TALKATU_H_INCLUDES)
+conf.set('TALKATU_H_INCLUDES', '\n'.join(TALKATU_H_INCLUDES))
 talkatu_h = configure_file(
 	input : 'talkatu.h.in',
 	output : 'talkatu.h',
@@ -202,7 +194,7 @@ if get_option('introspection')
 		includes : ['GModule-2.0', 'GObject-2.0', 'Gtk-4.0'],
 		install : true,
 		namespace : 'Talkatu',
-		nsversion : '@0@.0'.format(TALKATU_MAJOR_VERSION),
+		nsversion : f'@TALKATU_MAJOR_VERSION@.0',
 		symbol_prefix : 'talkatu',
 	)
 	TALKATU_GENERATED_TARGETS += talkatu_gir
@@ -220,9 +212,7 @@ talkatu_dep = declare_dependency(
 	dependencies : [GLIB, GOBJECT, GTK4]
 )
 
-if meson.version().version_compare('>=0.54.0')
-	meson.override_dependency('talkatu', talkatu_dep)
-endif
+meson.override_dependency('talkatu', talkatu_dep)
 
 ###############################################################################
 # Install Stuff
diff --git a/talkatu/reference/meson.build b/talkatu/reference/meson.build
--- a/talkatu/reference/meson.build
+++ b/talkatu/reference/meson.build
@@ -1,32 +1,34 @@
+if not get_option('doc')
+  subdir_done()
+endif
+
 talkatu_doc_content_files = []
 
-if get_option('doc')
-	talkatu_toml = configure_file(
-		input : 'talkatu.toml.in',
-		output : 'talkatu.toml',
-		configuration : version_conf,
-		install : true,
-		install_dir : docs_dir / 'talkatu',
-	)
+talkatu_toml = configure_file(
+	input : 'talkatu.toml.in',
+	output : 'talkatu.toml',
+	configuration : version_conf,
+	install : true,
+	install_dir : docs_dir / 'talkatu',
+)
 
-	talkatu_doc = custom_target('talkatu-doc',
-		input : [ talkatu_toml, talkatu_gir[0] ],
-		output : 'talkatu',
-		command : [
-			gidocgen,
-			'generate',
-			'--quiet',
-			'--fatal-warnings',
-			'--config=@INPUT0@',
-			'--output-dir=@OUTPUT@',
-			'--no-namespace-dir',
-			'--content-dir=@0@'.format(meson.current_source_dir()),
-			'@INPUT1@'
-		],
-		depend_files : [ talkatu_doc_content_files ],
-		build_by_default : true,
-		install : true,
-		install_dir : docs_dir,
-	)
-endif
-
+talkatu_doc = custom_target('talkatu-doc',
+	input : [ talkatu_toml, talkatu_gir[0] ],
+	output : 'talkatu',
+	command : [
+		gidocgen,
+		'generate',
+		'--quiet',
+		'--fatal-warnings',
+		'--config=@INPUT0@',
+		'--output-dir=@OUTPUT@',
+		'--no-namespace-dir',
+		'--content-dir=@0@'.format(meson.current_source_dir()),
+		'@INPUT1@'
+	],
+	depend_files : [ talkatu_doc_content_files ],
+	build_by_default : true,
+	install : true,
+	install_dir : docs_dir,
+)
+doc_targets += talkatu_doc
diff --git a/talkatu/tests/meson.build b/talkatu/tests/meson.build
--- a/talkatu/tests/meson.build
+++ b/talkatu/tests/meson.build
@@ -1,6 +1,8 @@
-TEST_WRAPPER = find_program('./test-wrapper.py', required : true)
+if not get_option('tests')
+  subdir_done()
+endif
 
-if get_option('tests')
+TEST_WRAPPER = find_program('./test-wrapper.py', required : true)
 
 testenv = environment()
 testenv.set('XDG_CONFIG_HOME', meson.current_build_dir() / 'config')
@@ -34,5 +36,3 @@ e = executable(
 )
 test('html-renderer', TEST_WRAPPER, args : e, is_parallel : false,
 	env : testenv)
-
-endif
diff --git a/vapi/meson.build b/vapi/meson.build
--- a/vapi/meson.build
+++ b/vapi/meson.build
@@ -1,14 +1,16 @@
-if get_option('vapi')
-	if not get_option('introspection')
-		error('Vala generation requires GObject Introspection.')
-	endif
+if not get_option('vapi')
+	subdir_done()
+endif
 
-	add_languages('vala', native : false)
+if not get_option('introspection')
+	error('Vala generation requires GObject Introspection.')
+endif
 
-	talkatu_vapi = gnome.generate_vapi('talkatu',
-		sources : talkatu_gir[0],
-		packages : [ 'gtk4' ],
-		install : true,
-		gir_dirs : meson.current_build_dir() / '..' / 'talkatu',
-	)
-endif # vala
+add_languages('vala', native : false)
+
+talkatu_vapi = gnome.generate_vapi('talkatu',
+	sources : talkatu_gir[0],
+	packages : [ 'gtk4' ],
+	install : true,
+	gir_dirs : meson.current_build_dir() / '..' / 'talkatu',
+)
