]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Follow-up to r1919413: CMake: Use configure_file() instead of file(write)
authorIvan Zhakov <ivan@apache.org>
Tue, 30 Jul 2024 00:15:32 +0000 (00:15 +0000)
committerIvan Zhakov <ivan@apache.org>
Tue, 30 Jul 2024 00:15:32 +0000 (00:15 +0000)
to generate modules.c file because configure_file() doesn't change
timestamp of file if contents is the the same.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919587 13f79535-47bb-0310-9956-ffa450edef68

build/build-modules-c.cmake
build/modules.c.in [new file with mode: 0644]

index 9d4ac6cc2daa6aeaaf5dcf0518222f5d266ef31a..1d005bd9b1edee3d8ce1ab4ed841e492d851f37f 100644 (file)
 function(generate_builtin_modules_c output_filename module_list)
   list(PREPEND module_list "core")
 
-  set(content "")
-
-  string(APPEND content "/*\n")
-  string(APPEND content " * modules.c --- automatically generated by Apache\n")
-  string(APPEND content " * configuration script.  DO NOT HAND EDIT!!!!!\n")
-  string(APPEND content " */\n")
-  string(APPEND content "\n")
-  string(APPEND content "#include \"ap_config.h\"\n")
-  string(APPEND content "#include \"httpd.h\"\n")
-  string(APPEND content "#include \"http_config.h\"\n")
-  string(APPEND content "\n")
-
-  foreach(module ${module_list})
-    string(APPEND content "extern module ${module}_module\;\n")
-  endforeach()
-
-  string(APPEND content "\n")
-  string(APPEND content "/*\n")
-  string(APPEND content " *  Modules which implicitly form the\n")
-  string(APPEND content " *  list of activated modules on startup,\n")
-  string(APPEND content " *  i.e. these are the modules which are\n")
-  string(APPEND content " *  initially linked into the Apache processing\n")
-  string(APPEND content " *  [extendable under run-time via AddModule]\n")
-  string(APPEND content " */\n")
-
-  string(APPEND content "AP_DECLARE_DATA module *ap_prelinked_modules[] = {\n")
   foreach(module ${module_list})
-    string(APPEND content "  &${module}_module,\n")
+    string(APPEND MODULES_EXTERN "extern module ${module}_module;\n")
+    string(APPEND MODULES_PRELINK "  &${module}_module,\n")
+    string(APPEND MODULES_SYNMBOLS "  {\"${module}_module\", &${module}_module},\n")
+    string(APPEND MODULES_PRELOAD "  &${module}_module,\n")
   endforeach()
-  string(APPEND content "  NULL\n")
-  string(APPEND content "}\;\n")
-
-  string(APPEND content "\n")
-  string(APPEND content "/*\n")
-  string(APPEND content " *  We need the symbols as strings for <IfModule> containers\n")
-  string(APPEND content " */\n")
-  string(APPEND content "\n")
-  string(APPEND content "ap_module_symbol_t ap_prelinked_module_symbols[] = {\n")
-
-  foreach(module ${module_list})
-    string(APPEND content "  {\"${module}_module\", &${module}_module},\n")
-  endforeach()
-
-  string(APPEND content "  {NULL, NULL}\n")
-  string(APPEND content "}\;\n")
-  string(APPEND content "\n")
-  string(APPEND content "/*\n")
-  string(APPEND content " *  Modules which initially form the\n")
-  string(APPEND content " *  list of available modules on startup,\n")
-  string(APPEND content " *  i.e. these are the modules which are\n")
-  string(APPEND content " *  initially loaded into the Apache process\n")
-  string(APPEND content " *  [extendable under run-time via LoadModule]\n")
-  string(APPEND content " */\n")
-  string(APPEND content "module *ap_preloaded_modules[] = {\n")
-
-  foreach(module ${module_list})
-    string(APPEND content "  &${module}_module,\n")
-  endforeach()
-
-  string(APPEND content "  NULL\n")
-  string(APPEND content "}\;\n")
-  string(APPEND content "\n")
 
-  file(WRITE ${output_filename} ${content})
+  configure_file("build/modules.c.in" ${output_filename})
 endfunction()
diff --git a/build/modules.c.in b/build/modules.c.in
new file mode 100644 (file)
index 0000000..c811d0d
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * modules.c --- automatically generated by Apache\r
+ * configuration script.  DO NOT HAND EDIT!!!!!\r
+ */\r
+\r
+#include "ap_config.h"\r
+#include "httpd.h"\r
+#include "http_config.h"\r
+\r
+@MODULES_EXTERN@\r
+/*\r
+ *  Modules which implicitly form the\r
+ *  list of activated modules on startup,\r
+ *  i.e. these are the modules which are\r
+ *  initially linked into the Apache processing\r
+ *  [extendable under run-time via AddModule]\r
+ */\r
+AP_DECLARE_DATA module *ap_prelinked_modules[] = {\r
+@MODULES_PRELINK@\r
+  NULL\r
+};\r
+\r
+/*\r
+ *  We need the symbols as strings for <IfModule> containers\r
+ */\r
+ap_module_symbol_t ap_prelinked_module_symbols[] = {\r
+@MODULES_SYNMBOLS@\r
+  {NULL, NULL}\r
+};\r
+\r
+/*\r
+ *  Modules which initially form the\r
+ *  list of available modules on startup,\r
+ *  i.e. these are the modules which are\r
+ *  initially loaded into the Apache process\r
+ *  [extendable under run-time via LoadModule]\r
+ */\r
+module *ap_preloaded_modules[] = {\r
+@MODULES_PRELOAD@\r
+  NULL\r
+};\r