From b50cf2a79ab8926bd5c02bfd7c4a8a88e3e9e383 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sun, 30 Mar 2025 10:38:52 +0300
Subject: [PATCH 21/21] Move src-check functionality to new src-check.sh

That makes it available outside autotools buildsystem.

See RM #1269

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 tests/Makefile.am  | 13 ++-----------
 tests/src-check.sh | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 11 deletions(-)
 create mode 100755 tests/src-check.sh

diff --git a/tests/Makefile.am b/tests/Makefile.am
index ad8c8a9d28..89e5f0dcd7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,17 +4,7 @@
 # the results of the checks.  It might be better to actually fail the make run
 # if the check fails.
 src-check:
-	rm -f check-output check-output_
-	$(srcdir)/check_macros.sh $(top_srcdir) >> check-output_
-	$(srcdir)/copyright.sh $(top_srcdir) >> check-output_
-	$(srcdir)/fcintl.sh $(top_srcdir) >> check-output_
-	$(srcdir)/header_guard.sh $(top_srcdir) >> check-output_
-	$(srcdir)/va_list.sh $(top_srcdir) >> check-output_
-	$(srcdir)/trailing_spaces.sh $(top_srcdir) >> check-output_
-	cat check-output_ | sed "s,$(top_srcdir)/,," > check-output
-	rm -f check-output_
-
-.PHONY: src-check
+	$(srcdir)/src-check.sh
 
 CLEANFILES = check-output
 
@@ -30,5 +20,6 @@ EXTRA_DIST =	check_macros.sh			\
 		rs_test_res/ruleset_list_opt.txt \
 		rs_test_res/ruleset_loads.sh.in	\
 		rulesets_autohelp.sh.in		\
+		src-check.sh			\
 		trailing_spaces.sh		\
 		va_list.sh
diff --git a/tests/src-check.sh b/tests/src-check.sh
new file mode 100755
index 0000000000..ded319ac20
--- /dev/null
+++ b/tests/src-check.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#/***********************************************************************
+# Freeciv - Copyright (C) 2004-2025
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2, or (at your option)
+#   any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#***********************************************************************/
+
+srcdir="$(dirname "$0")"
+top_srcdir="$(cd "$srcdir/.." && pwd)"
+
+rm -f check-output check-output_
+${srcdir}/check_macros.sh ${top_srcdir} >> check-output_
+${srcdir}/copyright.sh ${top_srcdir} >> check-output_
+${srcdir}/fcintl.sh ${top_srcdir} >> check-output_
+${srcdir}/header_guard.sh ${top_srcdir} >> check-output_
+${srcdir}/va_list.sh ${top_srcdir} >> check-output_
+${srcdir}/trailing_spaces.sh ${top_srcdir} >> check-output_
+cat check-output_ | sed "s,${top_srcdir}/,," > check-output
+rm -f check-output_
-- 
2.47.2

