diff options
24 files changed, 523 insertions, 18 deletions
diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake index 12d0e02..1ad3ac4 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake @@ -5,6 +5,7 @@ set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") set(CMake_TEST_FindCups "ON" CACHE BOOL "") set(CMake_TEST_FindCURL "ON" CACHE BOOL "") +set(CMake_TEST_FindDevIL "ON" CACHE BOOL "") set(CMake_TEST_FindDoxygen_Dot "ON" CACHE BOOL "") set(CMake_TEST_FindDoxygen "ON" CACHE BOOL "") set(CMake_TEST_FindEXPAT "ON" CACHE BOOL "") @@ -59,6 +60,7 @@ set(CMake_TEST_Fortran_SUBMODULES "ON" CACHE BOOL "") set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "") set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "") set(CMake_TEST_IPO_WORKS_Fortran "ON" CACHE BOOL "") +set(CMake_TEST_JQ "/usr/bin/jq" CACHE PATH "") set(CMake_TEST_Qt5 "ON" CACHE BOOL "") set(CMake_TEST_UseSWIG "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index 90556bf..d925387 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -5,6 +5,7 @@ set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") set(CMake_TEST_FindCups "ON" CACHE BOOL "") set(CMake_TEST_FindCURL "ON" CACHE BOOL "") +set(CMake_TEST_FindDevIL "ON" CACHE BOOL "") set(CMake_TEST_FindDoxygen_Dot "ON" CACHE BOOL "") set(CMake_TEST_FindDoxygen "ON" CACHE BOOL "") set(CMake_TEST_FindEXPAT "ON" CACHE BOOL "") @@ -61,6 +62,7 @@ set(CMake_TEST_Fortran_SUBMODULES "ON" CACHE BOOL "") set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "") set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "") set(CMake_TEST_IPO_WORKS_Fortran "ON" CACHE BOOL "") +set(CMake_TEST_JQ "/usr/bin/jq" CACHE PATH "") set(CMake_TEST_Qt5 "ON" CACHE BOOL "") set(CMake_TEST_UseSWIG "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora33_common.cmake b/.gitlab/ci/configure_fedora33_common.cmake index c343833..dee78ab 100644 --- a/.gitlab/ci/configure_fedora33_common.cmake +++ b/.gitlab/ci/configure_fedora33_common.cmake @@ -1,5 +1,6 @@ set(BUILD_CursesDialog ON CACHE BOOL "") set(BUILD_QtDialog ON CACHE BOOL "") +set(CMake_TEST_JQ "/usr/bin/jq" CACHE PATH "") set(CMake_TEST_JSON_SCHEMA ON CACHE BOOL "") include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/configure_fedora33_makefiles.cmake b/.gitlab/ci/configure_fedora33_makefiles.cmake index db2d005..882ffcd 100644 --- a/.gitlab/ci/configure_fedora33_makefiles.cmake +++ b/.gitlab/ci/configure_fedora33_makefiles.cmake @@ -5,6 +5,7 @@ set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") set(CMake_TEST_FindCups "ON" CACHE BOOL "") set(CMake_TEST_FindCURL "ON" CACHE BOOL "") +set(CMake_TEST_FindDevIL "ON" CACHE BOOL "") set(CMake_TEST_FindDoxygen_Dot "ON" CACHE BOOL "") set(CMake_TEST_FindDoxygen "ON" CACHE BOOL "") set(CMake_TEST_FindEXPAT "ON" CACHE BOOL "") diff --git a/.gitlab/ci/docker/debian10-aarch64/install_deps.sh b/.gitlab/ci/docker/debian10-aarch64/install_deps.sh index 3fc67e8..d84b3c8 100755 --- a/.gitlab/ci/docker/debian10-aarch64/install_deps.sh +++ b/.gitlab/ci/docker/debian10-aarch64/install_deps.sh @@ -19,6 +19,10 @@ apt-get install -y \ clang-6.0 \ libncurses6 +# Tools needed for the test suite. +apt-get install -y \ + jq + # Packages needed to test find modules. apt-get install -y \ alsa-utils \ @@ -34,6 +38,7 @@ apt-get install -y \ libbz2-dev \ libcups2-dev \ libcurl4-gnutls-dev \ + libdevil-dev \ libfontconfig1-dev \ libfreetype6-dev \ libgdal-dev \ diff --git a/.gitlab/ci/docker/debian10/install_deps.sh b/.gitlab/ci/docker/debian10/install_deps.sh index e885ae6..e6c9ba0 100755 --- a/.gitlab/ci/docker/debian10/install_deps.sh +++ b/.gitlab/ci/docker/debian10/install_deps.sh @@ -19,6 +19,10 @@ apt-get install -y \ clang-6.0 \ libncurses6 +# Tools needed for the test suite. +apt-get install -y \ + jq + # Packages needed to test find modules. apt-get install -y \ alsa-utils \ @@ -34,6 +38,7 @@ apt-get install -y \ libbz2-dev \ libcups2-dev \ libcurl4-gnutls-dev \ + libdevil-dev \ libfontconfig1-dev \ libfreetype6-dev \ libgdal-dev \ diff --git a/.gitlab/ci/docker/fedora33/install_deps.sh b/.gitlab/ci/docker/fedora33/install_deps.sh index c1391e3..cdfe35e 100755 --- a/.gitlab/ci/docker/fedora33/install_deps.sh +++ b/.gitlab/ci/docker/fedora33/install_deps.sh @@ -25,6 +25,7 @@ dnf install --setopt=install_weak_deps=False -y \ dnf install --setopt=install_weak_deps=False -y \ findutils \ file \ + jq \ which # Packages needed to test find modules. @@ -34,6 +35,7 @@ dnf install --setopt=install_weak_deps=False -y \ boost-devel boost-python3-devel \ bzip2-devel \ cups-devel \ + DevIL-devel \ doxygen \ expat-devel \ fontconfig-devel \ diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 0229bc0..81c4d8d 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -45,7 +45,7 @@ ### Debian .debian10: - image: "kitware/cmake:ci-debian10-x86_64-2020-10-03" + image: "kitware/cmake:ci-debian10-x86_64-2021-04-06" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -60,7 +60,7 @@ CMake_SKIP_INSTALL: 1 .debian10_aarch64: - image: "kitware/cmake:ci-debian10-aarch64-2021-01-26" + image: "kitware/cmake:ci-debian10-aarch64-2021-04-06" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -69,7 +69,7 @@ ### Fedora .fedora33: - image: "kitware/cmake:ci-fedora33-x86_64-2020-11-13" + image: "kitware/cmake:ci-fedora33-x86_64-2021-04-06" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes" diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 955beae..067f80d 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -92,6 +92,7 @@ syn keyword cmakeProperty contained \ AUTOUIC_EXECUTABLE \ AUTOUIC_OPTIONS \ AUTOUIC_SEARCH_PATHS + \ AUTOUIC_SOURCE_GROUP \ BINARY_DIR \ BUILDSYSTEM_TARGETS \ BUILD_RPATH diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index af170da..60a4028 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -21,6 +21,7 @@ Properties of Global Scope /prop_gbl/AUTOMOC_SOURCE_GROUP /prop_gbl/AUTOMOC_TARGETS_FOLDER /prop_gbl/AUTORCC_SOURCE_GROUP + /prop_gbl/AUTOUIC_SOURCE_GROUP /prop_gbl/CMAKE_C_KNOWN_FEATURES /prop_gbl/CMAKE_CUDA_KNOWN_FEATURES /prop_gbl/CMAKE_CXX_KNOWN_FEATURES diff --git a/Help/prop_gbl/AUTOGEN_SOURCE_GROUP.rst b/Help/prop_gbl/AUTOGEN_SOURCE_GROUP.rst index 2e32320..07c732b 100644 --- a/Help/prop_gbl/AUTOGEN_SOURCE_GROUP.rst +++ b/Help/prop_gbl/AUTOGEN_SOURCE_GROUP.rst @@ -3,15 +3,16 @@ AUTOGEN_SOURCE_GROUP .. versionadded:: 3.9 -Name of the :command:`source_group` for :prop_tgt:`AUTOMOC` and -:prop_tgt:`AUTORCC` generated files. +Name of the :command:`source_group` for :prop_tgt:`AUTOMOC`, +:prop_tgt:`AUTORCC` and :prop_tgt:`AUTOUIC` generated files. -Files generated by :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTORCC` are not always -known at configure time and therefore can't be passed to -:command:`source_group`. -:prop_gbl:`AUTOGEN_SOURCE_GROUP` an be used instead to generate or select -a source group for :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTORCC` generated files. +Files generated by :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTORCC` and +:prop_tgt:`AUTOUIC` are not always known at configure time and therefore can't +be passed to :command:`source_group`. +:prop_gbl:`AUTOGEN_SOURCE_GROUP` can be used instead to generate or select +a source group for :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTORCC` and +:prop_tgt:`AUTOUIC` generated files. -For :prop_tgt:`AUTOMOC` and :prop_tgt:`AUTORCC` specific overrides see -:prop_gbl:`AUTOMOC_SOURCE_GROUP` and :prop_gbl:`AUTORCC_SOURCE_GROUP` -respectively. +For :prop_tgt:`AUTOMOC`, :prop_tgt:`AUTORCC` and :prop_tgt:`AUTOUIC` specific +overrides see :prop_gbl:`AUTOMOC_SOURCE_GROUP`, :prop_gbl:`AUTORCC_SOURCE_GROUP` +and :prop_gbl:`AUTOUIC_SOURCE_GROUP` respectively. diff --git a/Help/prop_gbl/AUTOUIC_SOURCE_GROUP.rst b/Help/prop_gbl/AUTOUIC_SOURCE_GROUP.rst new file mode 100644 index 0000000..79ebfe0 --- /dev/null +++ b/Help/prop_gbl/AUTOUIC_SOURCE_GROUP.rst @@ -0,0 +1,9 @@ +AUTOUIC_SOURCE_GROUP +-------------------- + +.. versionadded:: 3.21 + +Name of the :command:`source_group` for :prop_tgt:`AUTOUIC` generated files. + +When set this is used instead of :prop_gbl:`AUTOGEN_SOURCE_GROUP` for +files generated by :prop_tgt:`AUTOUIC`. diff --git a/Help/prop_sf/GENERATED.rst b/Help/prop_sf/GENERATED.rst index 6ef4580..216dfe8 100644 --- a/Help/prop_sf/GENERATED.rst +++ b/Help/prop_sf/GENERATED.rst @@ -32,9 +32,10 @@ The :ref:`Makefile Generators` will remove ``GENERATED`` files during ``make clean``. Generated sources may be hidden in some IDE tools, while in others they might -be shown. For the special case of sources generated by CMake's :prop_tgt:`AUTOMOC` -or :prop_tgt:`AUTORCC` functionality, the :prop_gbl:`AUTOGEN_SOURCE_GROUP`, -:prop_gbl:`AUTOMOC_SOURCE_GROUP` and :prop_gbl:`AUTORCC_SOURCE_GROUP` target +be shown. For the special case of sources generated by CMake's :prop_tgt:`AUTOMOC`, +:prop_tgt:`AUTORCC` or :prop_tgt:`AUTOUIC` functionality, the +:prop_gbl:`AUTOGEN_SOURCE_GROUP`, :prop_gbl:`AUTOMOC_SOURCE_GROUP`, +:prop_gbl:`AUTORCC_SOURCE_GROUP` and :prop_gbl:`AUTOUIC_SOURCE_GROUP` target properties may influence where the generated sources are grouped in the project's file lists. diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b7ca022..7072e53 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 20) -set(CMake_VERSION_PATCH 20210406) +set(CMake_VERSION_PATCH 20210407) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 6528687..e96ec63 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -943,8 +943,14 @@ bool cmQtAutoGenInitializer::InitScanFiles() this->LocalGen->GetCurrentSourceDirectory(), cmSystemTools::GetFilenamePath(fullPath)); + // Avoid creating a path containing adjacent slashes + if (!uiHeaderRelativePath.empty() && + uiHeaderRelativePath.back() != '/') { + uiHeaderRelativePath += '/'; + } + auto uiHeaderFilePath = cmStrCat( - '/', uiHeaderRelativePath, '/', "ui_"_s, + '/', uiHeaderRelativePath, "ui_"_s, cmSystemTools::GetFilenameWithoutLastExtension(fullPath), ".h"_s); ConfigString uiHeader; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5f5a28f..b1bf835 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -229,6 +229,7 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) endif() add_RunCMake_test(CMakeRoleGlobalProperty) +add_RunCMake_test(CMakeRelease -DCMake_TEST_JQ=${CMake_TEST_JQ}) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() diff --git a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt new file mode 100644 index 0000000..37eb91e --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt @@ -0,0 +1,44 @@ +^-- query: \.version \| \.major , \.minor , \.patch , \.suffix, \.string +1 +2 +3 +"rc4" +"@version@" +-- query: \.files\[\]\.name +"cmake-@version@-linux-aarch64\.sh" +"cmake-@version@-linux-aarch64\.tar\.gz" +"cmake-@version@-linux-x86_64\.sh" +"cmake-@version@-linux-x86_64\.tar\.gz" +"cmake-@version@-macos-universal\.dmg" +"cmake-@version@-macos-universal\.tar\.gz" +"cmake-@version@-macos10\.10-universal\.dmg" +"cmake-@version@-macos10\.10-universal\.tar\.gz" +"cmake-@version@-windows-i386\.msi" +"cmake-@version@-windows-i386\.zip" +"cmake-@version@-windows-x86_64\.msi" +"cmake-@version@-windows-x86_64\.zip" +"cmake-@version@\.tar\.gz" +"cmake-@version@\.zip" +-- query: \.files\[\] \| select\(\.os\[\] \| \. == "source"\) \| \.name +"cmake-@version@\.tar\.gz" +"cmake-@version@\.zip" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macOS"\) and \(\.class == "volume"\)\) \| \.name +"cmake-@version@-macos-universal\.dmg" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macos10\.10"\) and \(\.class == "archive"\)\) \| \.name +"cmake-@version@-macos10\.10-universal\.tar\.gz" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "windows"\) and \(\.architecture\[\] \| \. == "i386"\) and \(\.class == "installer"\)\) \| \.name +"cmake-@version@-windows-i386\.msi" +-- query: \.files\[\] \| select\(\.architecture\[\] \| \. == "x86_64"\) \| \.name +"cmake-@version@-linux-x86_64\.sh" +"cmake-@version@-linux-x86_64\.tar\.gz" +"cmake-@version@-macos-universal\.dmg" +"cmake-@version@-macos-universal\.tar\.gz" +"cmake-@version@-macos10\.10-universal\.dmg" +"cmake-@version@-macos10\.10-universal\.tar\.gz" +"cmake-@version@-windows-x86_64\.msi" +"cmake-@version@-windows-x86_64\.zip" +-- query: \.files\[\] \| select\(\[\.macOSmin\] \| inside\(\["10\.10", "10\.11", "10\.12"\]\)\) \| \.name +"cmake-@version@-macos10\.10-universal\.dmg" +"cmake-@version@-macos10\.10-universal\.tar\.gz" +-- query: \.hashFiles\[\] \| select\(\.algorithm\[\] \| \. == "SHA-256"\) \| \.name +"cmake-@version@-SHA-256\.txt"$ diff --git a/Tests/RunCMake/CMakeRelease/FileTable.cmake b/Tests/RunCMake/CMakeRelease/FileTable.cmake new file mode 100644 index 0000000..f46535c --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/FileTable.cmake @@ -0,0 +1,21 @@ +set(version "@version@") +set(version_major "1") +set(version_minor "2") +set(version_patch "3") +set(maybe_version_suffix "\"suffix\": \"rc4\",") +configure_file("${CMAKE_CURRENT_LIST_DIR}/../../../Utilities/Release/files-v1.json.in" "files-v1.json" @ONLY) + +foreach(query + ".version | .major , .minor , .patch , .suffix, .string" + ".files[].name" + ".files[] | select(.os[] | . == \"source\") | .name" + ".files[] | select((.os[] | . == \"macOS\") and (.class == \"volume\")) | .name" + ".files[] | select((.os[] | . == \"macos10.10\") and (.class == \"archive\")) | .name" + ".files[] | select((.os[] | . == \"windows\") and (.architecture[] | . == \"i386\") and (.class == \"installer\")) | .name" + ".files[] | select(.architecture[] | . == \"x86_64\") | .name" + ".files[] | select([.macOSmin] | inside([\"10.10\", \"10.11\", \"10.12\"])) | .name" + ".hashFiles[] | select(.algorithm[] | . == \"SHA-256\") | .name" + ) + message(STATUS "query: ${query}") + execute_process(COMMAND ${JQ} "${query}" files-v1.json) +endforeach() diff --git a/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake new file mode 100644 index 0000000..9a08ff3 --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) + +if(CMake_TEST_JQ) + set(JQ "${CMake_TEST_JQ}") +else() + find_program(JQ NAMES jq) +endif() +if(JQ) + run_cmake_script(FileTable -DJQ=${JQ}) +endif() diff --git a/Utilities/Release/README.rst b/Utilities/Release/README.rst index 5d8e318..dfaf831 100644 --- a/Utilities/Release/README.rst +++ b/Utilities/Release/README.rst @@ -6,6 +6,17 @@ on ``cmake.org``. See also the `CMake Source Code Guide`_. .. _`CMake Source Code Guide`: ../../Help/dev/source.rst +File Table +---------- + +The set of package files distributed on ``cmake.org`` varies by CMake version. +Clients providing automatic download functionality may query the set of +package files available using a special file that lists them: + +* `File Table v1`_ Documentation + +.. _`File Table v1`: files-v1.rst + Docker ------ diff --git a/Utilities/Release/files-sign.bash b/Utilities/Release/files-sign.bash new file mode 100755 index 0000000..414859d --- /dev/null +++ b/Utilities/Release/files-sign.bash @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +gpg --armor --detach-sign cmake-*-SHA-256.txt diff --git a/Utilities/Release/files-v1.json.in b/Utilities/Release/files-v1.json.in new file mode 100644 index 0000000..aa6b15d --- /dev/null +++ b/Utilities/Release/files-v1.json.in @@ -0,0 +1,106 @@ +{ + "version": { + "major": @version_major@, + "minor": @version_minor@, + "patch": @version_patch@, + @maybe_version_suffix@ + "string": "@version@" + }, + "files": [ + { + "os": ["linux", "Linux"], + "architecture": ["aarch64"], + "class": "installer", + "name": "cmake-@version@-linux-aarch64.sh" + }, + { + "os": ["linux", "Linux"], + "architecture": ["aarch64"], + "class": "archive", + "name": "cmake-@version@-linux-aarch64.tar.gz" + }, + { + "os": ["linux", "Linux"], + "architecture": ["x86_64"], + "class": "installer", + "name": "cmake-@version@-linux-x86_64.sh" + }, + { + "os": ["linux", "Linux"], + "architecture": ["x86_64"], + "class": "archive", + "name": "cmake-@version@-linux-x86_64.tar.gz" + }, + { + "os": ["macos", "macOS"], + "architecture": ["arm64", "x86_64"], + "class": "volume", + "name": "cmake-@version@-macos-universal.dmg", + "macOSmin": "10.13" + }, + { + "os": ["macos", "macOS"], + "architecture": ["arm64", "x86_64"], + "class": "archive", + "name": "cmake-@version@-macos-universal.tar.gz", + "macOSmin": "10.13" + }, + { + "os": ["macos10.10", "macOS10.10"], + "architecture": ["arm64", "x86_64"], + "class": "volume", + "name": "cmake-@version@-macos10.10-universal.dmg", + "macOSmin": "10.10" + }, + { + "os": ["macos10.10", "macOS10.10"], + "architecture": ["arm64", "x86_64"], + "class": "archive", + "name": "cmake-@version@-macos10.10-universal.tar.gz", + "macOSmin": "10.10" + }, + { + "os": ["windows", "Windows"], + "architecture": ["i386"], + "class": "installer", + "name": "cmake-@version@-windows-i386.msi" + }, + { + "os": ["windows", "Windows"], + "architecture": ["i386"], + "class": "archive", + "name": "cmake-@version@-windows-i386.zip" + }, + { + "os": ["windows", "Windows"], + "architecture": ["x86_64"], + "class": "installer", + "name": "cmake-@version@-windows-x86_64.msi" + }, + { + "os": ["windows", "Windows"], + "architecture": ["x86_64"], + "class": "archive", + "name": "cmake-@version@-windows-x86_64.zip" + }, + { + "os": ["source"], + "architecture": [], + "class": "archive", + "name": "cmake-@version@.tar.gz" + }, + { + "os": ["source"], + "architecture": [], + "class": "archive", + "name": "cmake-@version@.zip" + } + ], + "hashFiles": [ + { + "algorithm": ["sha256", "SHA-256"], + "name": "cmake-@version@-SHA-256.txt", + "signature": ["cmake-@version@-SHA-256.txt.asc"] + } + ] +} diff --git a/Utilities/Release/files-v1.rst b/Utilities/Release/files-v1.rst new file mode 100644 index 0000000..ceebecc --- /dev/null +++ b/Utilities/Release/files-v1.rst @@ -0,0 +1,186 @@ +File Table v1 +************* + +The set of package files distributed on ``cmake.org`` varies by CMake version. +One file, named ``cmake-<ver>-files-v1.json``, contains a table of the package +files available for a given version. Clients may use this to find other files. + +Format +------ + +The format is a JSON object: + +.. code-block:: json + + { + "version": { + "major": 3, "minor": 20, "patch": 0, + "string": "3.20.0" + }, + "files": [ + { + "os": ["...", "..."], + "architecture": ["...", "..."], + "class": "...", + "name": "..." + } + ], + "hashFiles": [ + { + "algorithm": ["...", "..."], + "name": "cmake-<version>-<algo>.txt", + "signature": ["cmake-<version>-<algo>.txt.asc"] + } + ] + } + +The members are: + +``version`` + A JSON object specifying the version of CMake with members: + + ``major``, ``minor``, ``patch`` + Integer values specifying the major, minor, and patch version components. + + ``suffix`` + A string specifying the version suffix, if any, e.g. ``rc1``. + + ``string`` + A string specifying the full version in the format + ``<major>.<minor>.<patch>[-<suffix>]``. + +``files`` + A JSON array of entries corresponding to available package files. + Each entry is a JSON object containing members: + + ``os`` + A JSON array of strings naming the operating system for which the + package file is built, possibly using multiple alternative spellings. + Possible names include: + + ``source`` + Source packages. + + ``Linux``, ``linux`` + Linux packages. + + ``macOS``, ``macos`` + macOS packages. + + ``Windows``, ``windows`` + Windows packages. + + ``architecture`` + A JSON array of strings naming the architecture(s) for which the + package file is built, possibly using multiple alternative spellings. + Source packages have an empty list of architectures (``[]``). + Binary packages have a non-empty list of architectures, with at least + one name matching the output of ``uname -m`` on corresponding hosts. + On Windows, architecture names include ``x86_64`` and ``i386``. + On macOS, universal binary packages list all architectures, + e.g. ``["arm64","x86_64"]``. + + ``class`` + A JSON string naming the class of package. The value is one of: + + ``archive`` + A tarball or zip archive. + The extension, such as ``.tar.gz`` or ``.zip``, indicates the format. + The rest of the file name matches the top-level directory in the archive. + + ``installer`` + An interactive installer. + + ``volume`` + A disk image (``.dmg`` on macOS). + + ``name`` + A JSON string specifying the name of the package file. + + ``macOSmin`` + Optional member that is present on package files for macOS. + The value is a JSON string specifying the minimum version of macOS + required to run the binary, e.g. ``"10.13"``. + + ``deprecated`` + Optional member that is present when the package file is deprecated + and may be removed from the set of package files in later versions. + The value is a string containing a deprecation message. + Clients should check this field to warn users when they are using + a deprecated package file. + +``hashFiles`` + A JSON array of entries corresponding to files containing cryptographic + hashes of the package file contents. Each entry is a JSON object + containing members: + + ``algorithm`` + A JSON array of strings naming a cryptographic hash algorithm, possibly + using multiple alternative spellings, e.g. ``["sha256", "SHA-256"]``. + + ``name`` + A JSON string specifying the name of the file containing hashes, + e.g. ``"cmake-<version>-SHA-256.txt"``. + + ``signature`` + A JSON array of strings naming files containing a cryptographic + signature of the hash file specified by ``name``, e.g. + ``["cmake-<version>-SHA-256.txt.asc"]``. + + ``deprecated`` + Optional member that is present when the hash algorithm is deprecated + and may be removed from the set of hash files in later versions. + The value is a string containing a deprecation message. + Clients that rely on a specific hash algorithm should check this + field to determine whether an update is needed. + +``deprecated`` + Optional member that is present when `File Table v1`_ has been + deprecated in favor of a newer alternative. The value is a string + containing a deprecation message. Clients should check this field + to determine whether they need an update to use a newer alternative. + +The table and hash files are generated by `files.bash`_ from +the `files-v1.json.in`_ template and the package files themselves. + +.. _`files.bash`: files.bash +.. _`files-v1.json.in`: files-v1.json.in + +Queries +------- + +Clients may download the `File Table v1`_ file ``cmake-<ver>-files-v1.json`` +and query it to get the name(s) of specific package files adjacent to it. +Make queries as specific as possible in order to account for additional +alternative binaries in future CMake versions. + +For example, one may use ``jq`` queries: + +* To select a Windows binary archive supporting ``x86_64`` hosts:: + + .files[] | select((.os[] | . == "windows") and + (.architecture[] | . == "x86_64") and + (.class == "archive")) | .name + +* To select a Linux binary archive supporting ``aarch64`` hosts:: + + .files[] | select((.os[] | . == "linux") and + (.architecture[] | . == "aarch64") and + (.class == "archive")) | .name + +* To select a macOS binary archive supporting ``arm64`` hosts:: + + .files[] | select((.os[] | . == "macos") and + (.architecture[] | . == "arm64") and + (.class == "archive")) | .name + +* To select a macOS binary archive supporting macOS 10.12 on ``x86_64`` hosts:: + + .files[] | select((.os[] | contains("macOS")) and + (.architecture[] | . == "x86_64") and + ([.macOSmin] | inside(["10.10", "10.11", "10.12"])) + ) | .name + +* To select a SHA-256 hash file:: + + .hashFiles[] | select(.algorithm[] | . == "SHA-256") | .name diff --git a/Utilities/Release/files.bash b/Utilities/Release/files.bash new file mode 100755 index 0000000..28ca8f1 --- /dev/null +++ b/Utilities/Release/files.bash @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +set -e + +usage='usage: files.bash [<options>] [--] + +Options: + + --version <ver> CMake <major>.<minor> version number to push. + Defaults to version of source tree. +' + +die() { + echo "$@" 1>&2; exit 1 +} + +readonly cmake_source_dir="${BASH_SOURCE%/*}/../.." + +cmake_version_component() +{ + sed -n " +/^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\))/\1/;p;} +" "${cmake_source_dir}/Source/CMakeVersion.cmake" +} + + +version='' +while test "$#" != 0; do + case "$1" in + --version) shift; version="$1" ;; + --) shift ; break ;; + -*) die "$usage" ;; + *) break ;; + esac + shift +done +test "$#" = 0 || die "$usage" + +if test -z "$version"; then + cmake_version_major="$(cmake_version_component MAJOR)" + cmake_version_minor="$(cmake_version_component MINOR)" + cmake_version_patch="$(cmake_version_component PATCH)" + cmake_version_rc="$(cmake_version_component RC)" + version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" + if test -n "$cmake_version_rc"; then + version="$version-rc$cmake_version_rc" + fi +fi +readonly version + +IFS='.-' read version_major version_minor version_patch version_suffix <<< "$version" +readonly version_major +readonly version_minor +readonly version_patch +readonly version_suffix + +if test -n "$version_suffix"; then + maybe_version_suffix='"suffix": "'"$version_suffix"'",' +else + maybe_version_suffix='' +fi +readonly maybe_version_suffix + +readonly files_v1_in="${BASH_SOURCE%/*}/files-v1.json.in" +sed " + s/@version@/$version/g + s/@version_major@/$version_major/g + s/@version_minor@/$version_minor/g + s/@version_patch@/$version_patch/g + s/@maybe_version_suffix@/$maybe_version_suffix/g +" "$files_v1_in" \ + | jq . \ + > "cmake-$version-files-v1.json" + +readonly algos=' + 256 +' +for algo in $algos; do + shasum -a $algo \ + "cmake-$version-files-v1.json" \ + $(jq -r '.files[].name' "cmake-$version-files-v1.json") \ + | LC_ALL=C sort -k 2 \ + > "cmake-$version-SHA-$algo.txt" +done |