libvterm-gitclone.cmake (3960B)
1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 # file Copyright.txt or https://cmake.org/licensing for details. 3 4 cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake 5 6 if(EXISTS "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt" AND EXISTS "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitinfo.txt" AND 7 "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt" IS_NEWER_THAN "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitinfo.txt") 8 message(VERBOSE 9 "Avoiding repeated git clone, stamp file is up to date: " 10 "'/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt'" 11 ) 12 return() 13 endif() 14 15 # Even at VERBOSE level, we don't want to see the commands executed, but 16 # enabling them to be shown for DEBUG may be useful to help diagnose problems. 17 cmake_language(GET_MESSAGE_LOG_LEVEL active_log_level) 18 if(active_log_level MATCHES "DEBUG|TRACE") 19 set(maybe_show_command COMMAND_ECHO STDOUT) 20 else() 21 set(maybe_show_command "") 22 endif() 23 24 execute_process( 25 COMMAND ${CMAKE_COMMAND} -E rm -rf "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm" 26 RESULT_VARIABLE error_code 27 ${maybe_show_command} 28 ) 29 if(error_code) 30 message(FATAL_ERROR "Failed to remove directory: '/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm'") 31 endif() 32 33 # try the clone 3 times in case there is an odd git clone issue 34 set(error_code 1) 35 set(number_of_tries 0) 36 while(error_code AND number_of_tries LESS 3) 37 execute_process( 38 COMMAND "/usr/bin/git" 39 clone --no-checkout --config "advice.detachedHead=false" "https://github.com/Sbozzolo/libvterm-mirror.git" "libvterm" 40 WORKING_DIRECTORY "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src" 41 RESULT_VARIABLE error_code 42 ${maybe_show_command} 43 ) 44 math(EXPR number_of_tries "${number_of_tries} + 1") 45 endwhile() 46 if(number_of_tries GREATER 1) 47 message(NOTICE "Had to git clone more than once: ${number_of_tries} times.") 48 endif() 49 if(error_code) 50 message(FATAL_ERROR "Failed to clone repository: 'https://github.com/Sbozzolo/libvterm-mirror.git'") 51 endif() 52 53 execute_process( 54 COMMAND "/usr/bin/git" 55 checkout "64f1775952dbe001e989f2ab679563b54f2fca55" -- 56 WORKING_DIRECTORY "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm" 57 RESULT_VARIABLE error_code 58 ${maybe_show_command} 59 ) 60 if(error_code) 61 message(FATAL_ERROR "Failed to checkout tag: '64f1775952dbe001e989f2ab679563b54f2fca55'") 62 endif() 63 64 set(init_submodules TRUE) 65 if(init_submodules) 66 execute_process( 67 COMMAND "/usr/bin/git" 68 submodule update --recursive --init 69 WORKING_DIRECTORY "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm" 70 RESULT_VARIABLE error_code 71 ${maybe_show_command} 72 ) 73 endif() 74 if(error_code) 75 message(FATAL_ERROR "Failed to update submodules in: '/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm'") 76 endif() 77 78 # Complete success, update the script-last-run stamp file: 79 # 80 execute_process( 81 COMMAND ${CMAKE_COMMAND} -E copy "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitinfo.txt" "/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt" 82 RESULT_VARIABLE error_code 83 ${maybe_show_command} 84 ) 85 if(error_code) 86 message(FATAL_ERROR "Failed to copy script-last-run stamp file: '/home/dwrz/.config/emacs/elpa/vterm-20241118.1627/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt'") 87 endif()