Fix tarball and install, particularly for INSTALL
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 5 Jul 2014 12:24:28 +0000 (14:24 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 7 Jul 2014 22:45:07 +0000 (00:45 +0200)
Getting the INSTALL file generated from the markdown, into the tarball
via CPack and not otherwise installed is a bit tricky. I did this
manually for 5.0, but this automates things. CPack source archives use
a mechanism that acts on whole directories. So we put INSTALL into its
own output directory (as we do for generated HTML), and the
directory-globbing mechanism takes care of it fine. Added some
documentation for why we need to do this.

Added more CPack-time checks that the tarball will be complete.

Prevented installation of .gitattributes.

Change-Id: I77c645faf7b292a085165bdd1598741dae6972a5

CMakeLists.txt
CPackInit.cmake
install-guide/CMakeLists.txt

index 832dcb44ce5ef6f9de8a6235754ab97c4b47019f..b7b8f2785690b550106c22fd9bec403c24b01b8a 100644 (file)
@@ -137,9 +137,13 @@ set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/admin/InstallWelcome.txt")
 # Its GPL/LGPL, so they do not have to agree to a license for mere usage, but some installers require this...
 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
 set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/admin/InstallInfo.txt")
-set(CPACK_SOURCE_IGNORE_FILES "\\\\.isreposource$;\\\\.git/;\\\\.gitignore$")
+set(CPACK_SOURCE_IGNORE_FILES "\\\\.isreposource$;\\\\.git/;\\\\.gitignore$;\\\\.gitattributes;")
 set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/CPackInit.cmake")
-set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR};/;${CMAKE_BINARY_DIR}/src/programs/completion;src/programs/completion;${CMAKE_BINARY_DIR}/share/man/man1;share/man/man1;${CMAKE_BINARY_DIR}/share/man/man7;share/man/man7;${CMAKE_BINARY_DIR}/share/html/final;share/html/final")
+# CPack source archives include only the directories we list here.
+# This variable is a list of pairs of names of source and destination
+# directories. Most of these are used for content GROMACS generates as
+# part of the configuration or build.
+set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR};/;${CMAKE_BINARY_DIR}/src/programs/completion;src/programs/completion;${CMAKE_BINARY_DIR}/share/man/man1;share/man/man1;${CMAKE_BINARY_DIR}/share/man/man7;share/man/man7;${CMAKE_BINARY_DIR}/share/html/final;share/html/final;${CMAKE_BINARY_DIR}/install-guide/final;/")
 set(CPACK_PACKAGE_CONTACT "gmx-users@gromacs.org")
 
 #must come after all cpack settings!
index 779124f2a1c255226d19378e3b5f11c074a653e6..7d3985f99450122b22e1ebe9ecdbe2788fc3c17a 100644 (file)
 if(CPACK_SOURCE_PACKAGE_FILE_NAME) #building source package
     get_filename_component(CMAKE_BINARY_DIR ${CPACK_OUTPUT_CONFIG_FILE} PATH)
     if (NOT EXISTS "${CMAKE_BINARY_DIR}/share/man/man1/gmx-view.1" OR
-        NOT EXISTS "${CMAKE_BINARY_DIR}/INSTALL" OR
-        NOT EXISTS "${CMAKE_BINARY_DIR}/share/html/final/online.html")
+        NOT EXISTS "${CMAKE_BINARY_DIR}/install-guide/final/INSTALL" OR
+        NOT EXISTS "${CMAKE_BINARY_DIR}/share/html/final/online.html" OR
+        NOT EXISTS "${CMAKE_BINARY_DIR}/src/programs/completion/gmx-completion.bash" OR
+        NOT EXISTS "${CMAKE_BINARY_DIR}/share/html/final/programs/gmx-view.html")
         message(FATAL_ERROR
-            "To create a complete source package all man and HTML pages need "
-            "to be generated, and the INSTALL file generated. "
-            "Run 'make man html' to build these parts. You can also set "
-            "GMX_BUILD_HELP=ON to automatically build the HTML parts. "
-            "The latter also requires you to execute 'make install-guide'.")
+            "To create a complete source package, bash completions, "
+            "man and HTML pages, and INSTALL need to be generated. "
+            "Run 'make completion man html install-guide' to build "
+            "these parts. You can also configure with "
+            "GMX_BUILD_HELP=ON to automatically build the HTML parts.")
     endif()
 endif()
index a54d82cd148a1a21114aa5913f3db3fd60f70a8e..fb5faaa7e0e3f6dd44c2dfa71fa86478f3da098c 100644 (file)
@@ -68,10 +68,13 @@ if(INSTALL_GUIDE_BUILD_IS_POSSIBLE)
         VERBATIM
         )
 
-    # Make the INSTALL file for CPack for the tarball
+    # Make the INSTALL file for CPack for the tarball. This gets put
+    # into the tarball via the CPack rules in the top-level
+    # CMakeLists.txt
     add_custom_command(
-        OUTPUT ${CMAKE_BINARY_DIR}/INSTALL
-        COMMAND pandoc -t plain -o ../INSTALL install-guide.md
+        OUTPUT final/INSTALL
+        COMMAND ${CMAKE_COMMAND} -E make_directory final
+        COMMAND pandoc -t plain -o final/INSTALL install-guide.md
         DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/install-guide.md
         VERBATIM
         )
@@ -80,7 +83,7 @@ if(INSTALL_GUIDE_BUILD_IS_POSSIBLE)
     add_custom_target(install-guide
         DEPENDS
            ${CMAKE_CURRENT_BINARY_DIR}/install-guide.html
-           ${CMAKE_BINARY_DIR}/INSTALL
+           final/INSTALL
         VERBATIM
         )
 endif()