Revision: 10362 https://osdn.net/projects/ttssh2/scm/svn/commits/10362 Author: zmatsuo Date: 2022-11-12 23:44:41 +0900 (Sat, 12 Nov 2022) Log Message: ----------- ライブラリのダウンロードを download.cmake にまとめた - 従来、各ライブラリの cmake からダウンロードしていた - 各ライブラリの cmake から download.cmake を使用するようにした Modified Paths: -------------- trunk/libs/buildargon2.cmake trunk/libs/buildcjson.cmake trunk/libs/buildlibressl.cmake trunk/libs/buildoniguruma.cmake trunk/libs/buildputty.cmake trunk/libs/buildsfmt.cmake trunk/libs/buildzlib.cmake -------------- next part -------------- Modified: trunk/libs/buildargon2.cmake =================================================================== --- trunk/libs/buildargon2.cmake 2022-11-12 14:44:30 UTC (rev 10361) +++ trunk/libs/buildargon2.cmake 2022-11-12 14:44:41 UTC (rev 10362) @@ -1,39 +1,15 @@ # cmake -P buildargon2.cmake -set(SRC_DIR_BASE "phc-winner-argon2-20190702") -set(SRC_ARC "20190702.tar.gz") -set(SRC_URL "https://github.com/P-H-C/phc-winner-argon2/archive/refs/tags/20190702.tar.gz") -set(SRC_ARC_HASH_SHA256 daf972a89577f8772602bf2eb38b6a3dd3d922bf5724d45e7f9589b5e830442c) +set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/argon2") -set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/argon2") -set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/argon2/src") -set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/argon2/src/${SRC_DIR_BASE}") -set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/argon2") +execute_process( + COMMAND ${CMAKE_COMMAND} -DTARGET=argon2 -P download.cmake +) -if(NOT EXISTS ${INSTALL_DIR}/README.md) - - file(DOWNLOAD - ${SRC_URL} - ${DOWN_DIR}/${SRC_ARC} - EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256} - SHOW_PROGRESS - ) - - file(MAKE_DIRECTORY ${EXTRACT_DIR}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC} - WORKING_DIRECTORY ${EXTRACT_DIR} - ) - - file(REMOVE_RECURSE ${INSTALL_DIR}) - file(RENAME ${SRC_DIR} ${INSTALL_DIR}) - file(REMOVE_RECURSE ${EXTRACT_DIR}) - +if(${SRC_DIR}/LICENSE IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/argon2-LICENSE.txt) file(COPY - ${INSTALL_DIR}/LICENSE - DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help - ) + ${SRC_DIR}/LICENSE + DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) file(RENAME ${CMAKE_CURRENT_LIST_DIR}/doc_help/LICENSE ${CMAKE_CURRENT_LIST_DIR}/doc_help/argon2-LICENSE.txt) Modified: trunk/libs/buildcjson.cmake =================================================================== --- trunk/libs/buildcjson.cmake 2022-11-12 14:44:30 UTC (rev 10361) +++ trunk/libs/buildcjson.cmake 2022-11-12 14:44:41 UTC (rev 10362) @@ -1,36 +1,14 @@ # cmake -P buildcjson.cmake -set(SRC_DIR_BASE "cJSON-1.7.14") -set(SRC_ARC "v1.7.14.zip") -set(SRC_URL "https://github.com/DaveGamble/cJSON/archive/v1.7.14.zip") -set(SRC_ARC_HASH_SHA256 d797b4440c91a19fa9c721d1f8bab21078624aa9555fc64c5c82e24aa2a08221) -set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/cJSON") -set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/cJSON") -set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/cJSON/${SRC_DIR_BASE}") -set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/cJSON") +set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/cJSON") -if(NOT EXISTS ${INSTALL_DIR}/README.md) +execute_process( + COMMAND ${CMAKE_COMMAND} -DTARGET=cjson -P download.cmake +) - file(DOWNLOAD - ${SRC_URL} - ${DOWN_DIR}/${SRC_ARC} - EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256} - SHOW_PROGRESS - ) - - file(MAKE_DIRECTORY ${EXTRACT_DIR}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC} - WORKING_DIRECTORY ${EXTRACT_DIR} - ) - - file(REMOVE_RECURSE ${INSTALL_DIR}) - file(RENAME ${SRC_DIR} ${INSTALL_DIR}) - file(REMOVE_RECURSE ${EXTRACT_DIR}) - +if(${SRC_DIR}/LICENSE IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/cJSON-LICENSE.txt) file(COPY - ${INSTALL_DIR}/LICENSE + ${SRC_DIR}/LICENSE DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) file(RENAME ${CMAKE_CURRENT_LIST_DIR}/doc_help/LICENSE Modified: trunk/libs/buildlibressl.cmake =================================================================== --- trunk/libs/buildlibressl.cmake 2022-11-12 14:44:30 UTC (rev 10361) +++ trunk/libs/buildlibressl.cmake 2022-11-12 14:44:41 UTC (rev 10362) @@ -5,16 +5,10 @@ include(script_support.cmake) -set(SRC_DIR_BASE "libressl-3.4.3") -set(SRC_ARC "libressl-3.4.3.tar.gz") -set(SRC_URL "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.4.3.tar.gz") -set(SRC_ARC_HASH_SHA256 ff88bffe354818b3ccf545e3cafe454c5031c7a77217074f533271d63c37f08d) - -set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/libressl") -set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/libressl/src") -set(SRC_DIR "${EXTRACT_DIR}/${SRC_DIR_BASE}") -set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/libressl_${TOOLSET}") -set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build/libressl/build_${TOOLSET}") +set(EXTRACT_DIR "${CMAKE_CURRENT_LIST_DIR}/build/libressl/src") +set(SRC_DIR "${EXTRACT_DIR}/libressl") +set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/libressl/build_${TOOLSET}") +set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/libressl_${TOOLSET}") if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) set(INSTALL_DIR "${INSTALL_DIR}_x64") set(BUILD_DIR "${BUILD_DIR}_x64") @@ -53,26 +47,16 @@ ######################################## -if(NOT EXISTS ${SRC_DIR}/README.md) +file(MAKE_DIRECTORY ${SRC_DIR}) - file(DOWNLOAD - ${SRC_URL} - ${DOWN_DIR}/${SRC_ARC} - EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256} - SHOW_PROGRESS - ) +execute_process( + COMMAND ${CMAKE_COMMAND} -DTARGET=libressl -DEXT_DIR=${EXTRACT_DIR} -P download.cmake +) - file(MAKE_DIRECTORY ${EXTRACT_DIR}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC} - WORKING_DIRECTORY ${EXTRACT_DIR} - ) - +if(${SRC_DIR}/COPYING IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/LibreSSL-LICENSE.txt) file(COPY ${SRC_DIR}/COPYING - DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help - ) + DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) file(RENAME ${CMAKE_CURRENT_LIST_DIR}/doc_help/COPYING ${CMAKE_CURRENT_LIST_DIR}/doc_help/LibreSSL-LICENSE.txt) Modified: trunk/libs/buildoniguruma.cmake =================================================================== --- trunk/libs/buildoniguruma.cmake 2022-11-12 14:44:30 UTC (rev 10361) +++ trunk/libs/buildoniguruma.cmake 2022-11-12 14:44:41 UTC (rev 10362) @@ -7,16 +7,10 @@ include(script_support.cmake) -set(SRC_DIR_BASE "onig-6.9.8") -set(SRC_ARC "${SRC_DIR_BASE}.tar.gz") -set(SRC_URL "https://github.com/kkos/oniguruma/releases/download/v6.9.8/${SRC_ARC}") -set(SRC_ARC_HASH_SHA256 28cd62c1464623c7910565fb1ccaaa0104b2fe8b12bcd646e81f73b47535213e) - -set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/oniguruma") -set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/oniguruma/src") -set(SRC_DIR "${EXTRACT_DIR}/${SRC_DIR_BASE}") -set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/oniguruma_${TOOLSET}") -set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build/oniguruma/build_${TOOLSET}") +set(EXTRACT_DIR "${CMAKE_CURRENT_LIST_DIR}/build/oniguruma/src") +set(SRC_DIR "${EXTRACT_DIR}/oniguruma") +set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/oniguruma_${TOOLSET}") +set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/oniguruma/build_${TOOLSET}") if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) set(INSTALL_DIR "${INSTALL_DIR}_x64") set(BUILD_DIR "${BUILD_DIR}_x64") @@ -29,7 +23,6 @@ # Configure + Generate function(cmake_generate GENERATOR SRC_DIR WORKING_DIR OPTIONS) - message("${CMAKE_COMMAND} ${SRC_DIR} -G \"${GENERATOR}\" ${OPTIONS}") execute_process( COMMAND ${CMAKE_COMMAND} ${SRC_DIR} -G "${GENERATOR}" ${OPTIONS} WORKING_DIRECTORY "${BUILD_DIR}" @@ -43,7 +36,6 @@ # build + install function(cmake_build WORKING_DIR OPTIONS BUILD_TOOL_OPTIONS) - message("${CMAKE_COMMAND} --build . ${OPTIONS} --target install -- ${BUILD_TOOL_OPTIONS}") execute_process( COMMAND ${CMAKE_COMMAND} --build . ${OPTIONS} --target install -- ${BUILD_TOOL_OPTIONS} WORKING_DIRECTORY "${BUILD_DIR}" @@ -57,26 +49,16 @@ ######################################## -if(NOT EXISTS ${SRC_DIR}/README.md) +file(MAKE_DIRECTORY ${SRC_DIR}) - file(DOWNLOAD - ${SRC_URL} - ${DOWN_DIR}/${SRC_ARC} - EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256} - SHOW_PROGRESS - ) +execute_process( + COMMAND ${CMAKE_COMMAND} -DTARGET=oniguruma -DEXT_DIR=${EXTRACT_DIR} -P download.cmake +) - file(MAKE_DIRECTORY ${EXTRACT_DIR}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC} - WORKING_DIRECTORY ${EXTRACT_DIR} - ) - +if(${SRC_DIR}/COPYING IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/Oniguruma-LICENSE.txt) file(COPY ${SRC_DIR}/COPYING - DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help - ) + DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) file(RENAME ${CMAKE_CURRENT_LIST_DIR}/doc_help/COPYING ${CMAKE_CURRENT_LIST_DIR}/doc_help/Oniguruma-LICENSE.txt) Modified: trunk/libs/buildputty.cmake =================================================================== --- trunk/libs/buildputty.cmake 2022-11-12 14:44:30 UTC (rev 10361) +++ trunk/libs/buildputty.cmake 2022-11-12 14:44:41 UTC (rev 10362) @@ -1,37 +1,14 @@ # cmake -P buildputty.cmake -set(SRC_DIR_BASE "putty-0.76") -set(SRC_ARC "putty-0.76.tar.gz") -set(SRC_URL "https://the.earth.li/~sgtatham/putty/0.76/putty-0.76.tar.gz") -set(SRC_ARC_HASH_SHA256 547cd97a8daa87ef71037fab0773bceb54a8abccb2f825a49ef8eba5e045713f) +set(SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/putty") -set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/putty") -set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/putty/src") -set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/putty/src/${SRC_DIR_BASE}") -set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/putty") +execute_process( + COMMAND ${CMAKE_COMMAND} -DTARGET=putty -P download.cmake +) -if(NOT EXISTS ${INSTALL_DIR}/README) - - file(DOWNLOAD - ${SRC_URL} - ${DOWN_DIR}/${SRC_ARC} - EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256} - SHOW_PROGRESS - ) - - file(MAKE_DIRECTORY ${EXTRACT_DIR}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC} - WORKING_DIRECTORY ${EXTRACT_DIR} - ) - - file(REMOVE_RECURSE ${INSTALL_DIR}) - file(RENAME ${SRC_DIR} ${INSTALL_DIR}) - file(REMOVE_RECURSE ${EXTRACT_DIR}) - +if(${SRC_DIR}/LICENSE IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/cJSON-LICENSE.txt) file(COPY - ${INSTALL_DIR}/LICENCE + ${SRC_DIR}/LICENCE DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) file(RENAME ${CMAKE_CURRENT_LIST_DIR}/doc_help/LICENCE Modified: trunk/libs/buildsfmt.cmake =================================================================== --- trunk/libs/buildsfmt.cmake 2022-11-12 14:44:30 UTC (rev 10361) +++ trunk/libs/buildsfmt.cmake 2022-11-12 14:44:41 UTC (rev 10362) @@ -57,17 +57,10 @@ include(script_support.cmake) -set(SFMT_VERSION "1.5.1") -set(SRC_DIR_BASE "SFMT-src-1.5.1") -set(SRC_ARC "SFMT-1.5.1.zip") -set(SRC_URL "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/SFMT-src-1.5.1.zip") -set(SRC_ARC_HASH_SHA256 630d1dfa6b690c30472f75fa97ca90ba62f9c13c5add6c264fdac2c1d3a878f4) - -set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/SFMT") -set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/SFMT/src") -set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/SFMT/src/${SRC_DIR_BASE}") -set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build/SFMT/build_${TOOLSET}") -set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/SFMT_${TOOLSET}") +set(EXTRACT_DIR "${CMAKE_CURRENT_LIST_DIR}/build/SFMT/src") +set(SRC_DIR "${EXTRACT_DIR}/SFMT") +set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/SFMT/build_${TOOLSET}") +set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/SFMT_${TOOLSET}") if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) set(BUILD_DIR "${BUILD_DIR}_x64") set(INSTALL_DIR "${INSTALL_DIR}_x64") @@ -75,22 +68,13 @@ ######################################## -if(NOT EXISTS ${SRC_DIR}/README.txt) +file(MAKE_DIRECTORY ${SRC_DIR}) - file(DOWNLOAD - ${SRC_URL} - ${DOWN_DIR}/${SRC_ARC} - EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256} - SHOW_PROGRESS - ) +execute_process( + COMMAND ${CMAKE_COMMAND} -DTARGET=sfmt -DEXT_DIR=${EXTRACT_DIR} -P download.cmake +) - file(MAKE_DIRECTORY ${EXTRACT_DIR}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC} - WORKING_DIRECTORY ${EXTRACT_DIR} - ) - +if(${SRC_DIR}/COPYING IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/LibreSSL-LICENSE.txt) file(COPY ${SRC_DIR}/LICENSE.txt DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help) @@ -101,20 +85,9 @@ ######################################## -if(NOT EXISTS ${SRC_DIR}/SFMT_version_for_teraterm.h) - file(WRITE "${SRC_DIR}/SFMT_version_for_teraterm.h" - "// created by cmake\n" - "#pragma once\n" - "#ifndef SFMT_VERSION_H\n" - "#define SFMT_VERSION_H\n" - "#define SFMT_VERSION \"${SFMT_VERSION}\"\n" - "#endif" - ) - -endif() if(NOT EXISTS ${SRC_DIR}/CMakeLists.txt) file(WRITE "${SRC_DIR}/CMakeLists.txt" - "cmake_minimum_required(VERSION 2.4.4)\n" + "cmake_minimum_required(VERSION 3.11.4)\n" "project(SFMT C)\n" "\n" "if(MSVC)\n" Modified: trunk/libs/buildzlib.cmake =================================================================== --- trunk/libs/buildzlib.cmake 2022-11-12 14:44:30 UTC (rev 10361) +++ trunk/libs/buildzlib.cmake 2022-11-12 14:44:41 UTC (rev 10362) @@ -56,16 +56,10 @@ include(script_support.cmake) -set(SRC_DIR_BASE "zlib-1.2.12") -set(SRC_ARC "zlib-1.2.12.tar.xz") -set(SRC_URL "https://zlib.net/zlib-1.2.12.tar.xz") -set(SRC_ARC_HASH_SHA256 7db46b8d7726232a621befaab4a1c870f00a90805511c0e0090441dac57def18) - -set(DOWN_DIR "${CMAKE_SOURCE_DIR}/download/zlib") -set(EXTRACT_DIR "${CMAKE_SOURCE_DIR}/build/zlib/src") -set(SRC_DIR "${CMAKE_SOURCE_DIR}/build/zlib/src/${SRC_DIR_BASE}") -set(BUILD_DIR "${CMAKE_SOURCE_DIR}/build/zlib/build_${TOOLSET}") -set(INSTALL_DIR "${CMAKE_SOURCE_DIR}/zlib_${TOOLSET}") +set(EXTRACT_DIR "${CMAKE_CURRENT_LIST_DIR}/build/zlib/src") +set(SRC_DIR "${EXTRACT_DIR}/zlib") +set(BUILD_DIR "${CMAKE_CURRENT_LIST_DIR}/build/zlib/build_${TOOLSET}") +set(INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib_${TOOLSET}") if(("${CMAKE_GENERATOR}" MATCHES "Win64") OR ("${ARCHITECTURE}" MATCHES "x64") OR ("$ENV{MSYSTEM_CHOST}" STREQUAL "x86_64-w64-mingw32") OR ("${CMAKE_COMMAND}" MATCHES "mingw64")) set(BUILD_DIR "${BUILD_DIR}_x64") set(INSTALL_DIR "${INSTALL_DIR}_x64") @@ -73,22 +67,13 @@ ######################################## -if(NOT EXISTS ${SRC_DIR}/README) +file(MAKE_DIRECTORY ${SRC_DIR}) - file(DOWNLOAD - ${SRC_URL} - ${DOWN_DIR}/${SRC_ARC} - EXPECTED_HASH SHA256=${SRC_ARC_HASH_SHA256} - SHOW_PROGRESS - ) +execute_process( + COMMAND ${CMAKE_COMMAND} -DTARGET=zlib -DEXT_DIR=${EXTRACT_DIR} -P download.cmake +) - file(MAKE_DIRECTORY ${EXTRACT_DIR}) - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "xvf" ${DOWN_DIR}/${SRC_ARC} - WORKING_DIRECTORY ${EXTRACT_DIR} - ) - +if(${SRC_DIR}/README IS_NEWER_THAN ${CMAKE_CURRENT_LIST_DIR}/doc_help/zlib-LICENSE.txt) file(COPY ${SRC_DIR}/README DESTINATION ${CMAKE_CURRENT_LIST_DIR}/doc_help)