From: Daniel Arndt Date: Tue, 13 Dec 2016 16:23:59 +0000 (+0100) Subject: Replace bash script by CMake script and adjust files to be installed X-Git-Tag: v8.5.0-rc1~330^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3617%2Fhead;p=dealii.git Replace bash script by CMake script and adjust files to be installed --- diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index be790e7b5d..7cc17a02a6 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -33,6 +33,7 @@ IF(DEAL_II_COMPONENT_DOCUMENTATION) PATTERN "CMakeLists.txt" EXCLUDE PATTERN "doxygen" EXCLUDE PATTERN "*.in" EXCLUDE + PATTERN "news" EXCLUDE ) CONFIGURE_FILE( diff --git a/doc/doxygen/CMakeLists.txt b/doc/doxygen/CMakeLists.txt index 0f078911aa..5abb415616 100644 --- a/doc/doxygen/CMakeLists.txt +++ b/doc/doxygen/CMakeLists.txt @@ -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 ) diff --git a/doc/news/CMakeLists.txt b/doc/news/CMakeLists.txt index 8cc793fc7a..9ad6615b31 100644 --- a/doc/news/CMakeLists.txt +++ b/doc/news/CMakeLists.txt @@ -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 index 0000000000..28148df270 --- /dev/null +++ b/doc/news/changes/create_changes_h.cmake @@ -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} "
    \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
  1. \n") + CAT(${ENTRY} ${OUT_FILE} "TRUE") + FILE(APPEND ${OUT_FILE} "
  2. \n") + ENDFOREACH() + FILE(APPEND ${OUT_FILE} "\n
\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 index 4f1c30df8a..0000000000 --- a/doc/news/changes/create_changes_h.sh +++ /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 "
    " - # process all entries in the right order - ARRAY=($(ls "$1" | sort -r)) - for f in "${ARRAY[@]}"; do - echo "" - echo -n "
  1. " - # indent lines by one blank space - sed 's/^[ ]*/ /' "$1"/"$f" - echo "
  2. " - done - echo "" - echo "
" -} - - - -cat header - -cat header_incompatibilities -process_directory incompatibilities - -cat header_major -process_directory major - -cat header_minor -process_directory minor - -cat footer