config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

libvterm-gitclone.cmake (3452B)


      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 3.5)
      5 
      6 if(EXISTS "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt" AND EXISTS "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitinfo.txt" AND
      7   "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt" IS_NEWER_THAN "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitinfo.txt")
      8   message(STATUS
      9     "Avoiding repeated git clone, stamp file is up to date: "
     10     "'/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt'"
     11   )
     12   return()
     13 endif()
     14 
     15 execute_process(
     16   COMMAND ${CMAKE_COMMAND} -E rm -rf "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm"
     17   RESULT_VARIABLE error_code
     18 )
     19 if(error_code)
     20   message(FATAL_ERROR "Failed to remove directory: '/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm'")
     21 endif()
     22 
     23 # try the clone 3 times in case there is an odd git clone issue
     24 set(error_code 1)
     25 set(number_of_tries 0)
     26 while(error_code AND number_of_tries LESS 3)
     27   execute_process(
     28     COMMAND "/usr/bin/git"
     29             clone --no-checkout --config "advice.detachedHead=false" "https://github.com/Sbozzolo/libvterm-mirror.git" "libvterm"
     30     WORKING_DIRECTORY "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src"
     31     RESULT_VARIABLE error_code
     32   )
     33   math(EXPR number_of_tries "${number_of_tries} + 1")
     34 endwhile()
     35 if(number_of_tries GREATER 1)
     36   message(STATUS "Had to git clone more than once: ${number_of_tries} times.")
     37 endif()
     38 if(error_code)
     39   message(FATAL_ERROR "Failed to clone repository: 'https://github.com/Sbozzolo/libvterm-mirror.git'")
     40 endif()
     41 
     42 execute_process(
     43   COMMAND "/usr/bin/git"
     44           checkout "64f1775952dbe001e989f2ab679563b54f2fca55" --
     45   WORKING_DIRECTORY "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm"
     46   RESULT_VARIABLE error_code
     47 )
     48 if(error_code)
     49   message(FATAL_ERROR "Failed to checkout tag: '64f1775952dbe001e989f2ab679563b54f2fca55'")
     50 endif()
     51 
     52 set(init_submodules TRUE)
     53 if(init_submodules)
     54   execute_process(
     55     COMMAND "/usr/bin/git" 
     56             submodule update --recursive --init 
     57     WORKING_DIRECTORY "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm"
     58     RESULT_VARIABLE error_code
     59   )
     60 endif()
     61 if(error_code)
     62   message(FATAL_ERROR "Failed to update submodules in: '/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm'")
     63 endif()
     64 
     65 # Complete success, update the script-last-run stamp file:
     66 #
     67 execute_process(
     68   COMMAND ${CMAKE_COMMAND} -E copy "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitinfo.txt" "/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt"
     69   RESULT_VARIABLE error_code
     70 )
     71 if(error_code)
     72   message(FATAL_ERROR "Failed to copy script-last-run stamp file: '/home/dwrz/.config/emacs/elpa/vterm-20240325.1551/build/libvterm-prefix/src/libvterm-stamp/libvterm-gitclone-lastrun.txt'")
     73 endif()