From: Stephen Seo Date: Mon, 17 Feb 2025 11:44:21 +0000 (+0900) Subject: Attempt to fix build when git-describe fails X-Git-Tag: 1.16~3 X-Git-Url: https://git.seodisparate.com/stephenseo/search/main.js?a=commitdiff_plain;h=1b5c7788c8853fd948bc04488a8ff3bb93aaeb61;p=SimpleArchiver Attempt to fix build when git-describe fails --- diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index aec440f..f398a66 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index ac9d78f..d6272ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)