]> git.seodisparate.com - SimpleArchiver/commitdiff
Attempt to fix build when git-describe fails
authorStephen Seo <seo.disparate@gmail.com>
Mon, 17 Feb 2025 11:44:21 +0000 (20:44 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Mon, 17 Feb 2025 11:46:08 +0000 (20:46 +0900)
.github/workflows/unittest.yml
CMakeLists.txt

index aec440fc72db2bc42e2cbbda07a9741fee41b440..f398a66181e6441ca144b9eeecf8890ba07bebe3 100644 (file)
@@ -11,7 +11,7 @@ jobs:
       - name: Get cmake/gcc
         run: sudo apt-get -y install cmake gcc sed
       - name: Clone repo
-        run: git clone https://github.com/Stephen-Seo/SimpleArchiver.git
+        run: git clone --depth=1 --no-single-branch https://github.com/Stephen-Seo/SimpleArchiver.git
       - name: Checkout the branch
         run: cd SimpleArchiver && git checkout "${GITHUB_REF_NAME}"
       - name: Patch CMakeLists.txt to remove "-fstrict-flex-arrays=3" which is unavailable in ubuntu-latest
index ac9d78f4f9e82468054e0933b302f007a0eca7b6..d6272eda50d0008ea8d2dea9c033781d8485ecfd 100644 (file)
@@ -70,7 +70,7 @@ set_source_files_properties(src/archiver.c
 
 if(EXISTS /usr/bin/git AND EXISTS /usr/bin/sh AND EXISTS /usr/bin/cat AND EXISTS /usr/bin/xargs AND EXISTS /usr/bin/sed)
     add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/version_string.txt"
-        COMMAND /usr/bin/sh ARGS -c "/usr/bin/git describe --long --tags >${CMAKE_CURRENT_BINARY_DIR}/version_string.txt"
+        COMMAND /usr/bin/sh ARGS -c "/usr/bin/git describe --long --tags >${CMAKE_CURRENT_BINARY_DIR}/version_string.txt || /usr/bin/echo ${SimpleArchiver_VERSION} >${CMAKE_CURRENT_BINARY_DIR}/version_string.txt"
         COMMAND /usr/bin/sh ARGS -c "/usr/bin/cat ${CMAKE_CURRENT_BINARY_DIR}/version_string.txt | /usr/bin/xargs -Iderp sed -i \"/^#define SIMPLE_ARCHIVER_VERSION_STR /c #define SIMPLE_ARCHIVER_VERSION_STR \\\"derp\\\"\" ${CMAKE_CURRENT_SOURCE_DIR}/src/version.h"
         COMMAND /usr/bin/rm ARGS -f "${CMAKE_CURRENT_BINARY_DIR}/version_string.txt"
         VERBATIM)