]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace bash script by CMake script and adjust files to be installed 3617/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 13 Dec 2016 16:23:59 +0000 (17:23 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 16 Dec 2016 10:11:03 +0000 (11:11 +0100)
doc/CMakeLists.txt
doc/doxygen/CMakeLists.txt
doc/news/CMakeLists.txt
doc/news/changes/create_changes_h.cmake [new file with mode: 0644]
doc/news/changes/create_changes_h.sh [deleted file]

index be790e7b5d53e325d59c433c0b92c78f8d4ca3b1..7cc17a02a6457988d54a8f3f3a9f180303774687 100644 (file)
@@ -33,6 +33,7 @@ IF(DEAL_II_COMPONENT_DOCUMENTATION)
     PATTERN "CMakeLists.txt" EXCLUDE
     PATTERN "doxygen" EXCLUDE
     PATTERN "*.in" EXCLUDE
+    PATTERN "news" EXCLUDE
     )
 
   CONFIGURE_FILE(
index 0f078911aa7860fc6ccc1b4eae0de61ba1882d0e..5abb41561653ee2da9ca57b02f9161bf5b8a1138 100644 (file)
@@ -137,6 +137,7 @@ LIST(APPEND _doxygen_input
   ${CMAKE_SOURCE_DIR}/source/
   ${CMAKE_BINARY_DIR}/include/
   ${CMAKE_SOURCE_DIR}/doc/news/
+  ${CMAKE_BINARY_DIR}/doc/news/
   ${CMAKE_CURRENT_BINARY_DIR}/tutorial/tutorial.h
   )
 
index 8cc793fc7a2a3cd7d0173ce4fd318cb14fe6171c..9ad6615b31bfb47a2cfc43765f84dba9b2303953 100644 (file)
@@ -13,6 +13,7 @@
 ##
 ## ---------------------------------------------------------------------
 
+
 #
 # Set up all necessary bits for the changelog generation
 #
@@ -26,16 +27,18 @@ IF(DEAL_II_COMPONENT_DOCUMENTATION)
   #
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/changes.h
-    COMMAND 
-      ${CMAKE_CURRENT_SOURCE_DIR}/changes/create_changes_h.sh
-        > ${CMAKE_CURRENT_BINARY_DIR}/changes.h
+    COMMAND ${CMAKE_COMMAND} -DOUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/changes.h
+                             -P ${CMAKE_CURRENT_SOURCE_DIR}/changes/create_changes_h.cmake
     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/changes
     DEPENDS 
       ${CMAKE_CURRENT_SOURCE_DIR}/changes/header
       ${CMAKE_CURRENT_SOURCE_DIR}/changes/header_incompatibilities
       ${CMAKE_CURRENT_SOURCE_DIR}/changes/header_major
       ${CMAKE_CURRENT_SOURCE_DIR}/changes/header_minor
-      ${CMAKE_CURRENT_SOURCE_DIR}/changes/create_changes_h.sh
+      ${CMAKE_CURRENT_SOURCE_DIR}/changes/footer
+      ${CMAKE_CURRENT_SOURCE_DIR}/changes/major
+      ${CMAKE_CURRENT_SOURCE_DIR}/changes/minor
+      ${CMAKE_CURRENT_SOURCE_DIR}/changes/incompatibilities
   )
 
   ADD_CUSTOM_TARGET(changelog ALL
@@ -44,9 +47,5 @@ IF(DEAL_II_COMPONENT_DOCUMENTATION)
 
   ADD_DEPENDENCIES(documentation changelog)
 
-  #
-  # Install the static elements of the html documentation:
-  #
-
 ENDIF(DEAL_II_COMPONENT_DOCUMENTATION)
 
diff --git a/doc/news/changes/create_changes_h.cmake b/doc/news/changes/create_changes_h.cmake
new file mode 100644 (file)
index 0000000..28148df
--- /dev/null
@@ -0,0 +1,65 @@
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2016 by the deal.II Authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+# Auxiliary functions
+FUNCTION(CAT IN_FILE OUT_FILE INDENT)
+  FILE(READ ${IN_FILE} CONTENTS)
+  IF(${INDENT} MATCHES "TRUE")
+    FILE(STRINGS ${IN_FILE} LINESTMP)
+    FOREACH(LINETMP ${LINESTMP})
+      FILE(APPEND ${OUT_FILE} "  ${LINETMP}\n")
+    ENDFOREACH()
+  ELSE()
+    FILE(APPEND ${OUT_FILE} "${CONTENTS}")
+  ENDIF()
+ENDFUNCTION()
+
+FUNCTION(PROCESS IN_DIR OUT_FILE)
+  FILE(APPEND ${OUT_FILE} "<ol>\n")
+  FILE(GLOB ENTRY_LIST ${IN_DIR}/[0-9]*)
+  LIST(SORT ENTRY_LIST)
+  LIST(REVERSE ENTRY_LIST)
+  FOREACH(ENTRY ${ENTRY_LIST})
+    FILE(APPEND ${OUT_FILE} "\n <li>\n")
+    CAT(${ENTRY} ${OUT_FILE} "TRUE")
+    FILE(APPEND ${OUT_FILE} " </li>\n")
+  ENDFOREACH()
+  FILE(APPEND ${OUT_FILE} "\n</ol>\n")
+ENDFUNCTION()
+
+# Generate 'changes.h'.
+
+# First, create a file 'changes.h.in' based on all changelog fragments.
+FILE(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in "")
+CAT    (${CMAKE_CURRENT_SOURCE_DIR}/header                   
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in "FALSE")
+CAT    (${CMAKE_CURRENT_SOURCE_DIR}/header_incompatibilities 
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in "FALSE")
+PROCESS(${CMAKE_CURRENT_SOURCE_DIR}/incompatibilities        
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in)
+CAT    (${CMAKE_CURRENT_SOURCE_DIR}/header_major             
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in "FALSE")
+PROCESS(${CMAKE_CURRENT_SOURCE_DIR}/major                    
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in)
+CAT    (${CMAKE_CURRENT_SOURCE_DIR}/header_minor             
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in "FALSE")
+PROCESS(${CMAKE_CURRENT_SOURCE_DIR}/minor                    
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in)
+CAT    (${CMAKE_CURRENT_SOURCE_DIR}/footer                   
+        ${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in "FALSE")
+
+# Copy it over to 'changes.h' but only touch the time stamp 
+# if the file actually changed (this is what CONFIGURE_FILE does).
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/changes.h.in ${OUTPUT_FILE} COPYONLY)
diff --git a/doc/news/changes/create_changes_h.sh b/doc/news/changes/create_changes_h.sh
deleted file mode 100755 (executable)
index 4f1c30d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-## ---------------------------------------------------------------------
-##
-## Copyright (C) 2016 by the deal.II authors
-##
-## This file is part of the deal.II library.
-##
-## The deal.II library is free software; you can use it, redistribute
-## it, and/or modify it under the terms of the GNU Lesser General
-## Public License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-## The full text of the license can be found in the file LICENSE at
-## the top level of the deal.II distribution.
-##
-## ---------------------------------------------------------------------
-
-#
-# This script creates "changes.h.new" from the contributions in the subfolders
-# of ./doc/news/changes.
-#
-# The script needs to be executed as 
-#   ./create_changes_h.sh
-# from ./doc/news/changes. It simply outputs its results to the console,
-# from where the text can be captured to a file.
-
-
-
-if test ! -d incompatibilities -o ! -d major -o ! -d minor ; then
-  echo "*** This script must be run from ./doc/news/changes!"
-  exit 1
-fi
-
-
-function process_directory
-{
-  echo "<ol>"
-  # process all entries in the right order
-  ARRAY=($(ls "$1" | sort -r))
-  for f in "${ARRAY[@]}"; do
-    echo ""
-    echo -n " <li>"
-    # indent lines by one blank space
-    sed 's/^[ ]*/ /' "$1"/"$f"
-    echo " </li>"
-  done
-  echo ""
-  echo "</ol>"
-}
-
-
-
-cat header
-
-cat header_incompatibilities
-process_directory incompatibilities
-
-cat header_major
-process_directory major
-
-cat header_minor
-process_directory minor
-
-cat footer

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.