summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-05-01 13:00:49 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2020-06-05 07:14:25 +0100
commit2d615d66171afd74889514375b9c4098171bf12c (patch)
tree45c6002f999ca0bb5e06608492fd0f0de5b26ef4
parentd4793d6c75cf81141e4608752d7f38a9b02e98e2 (diff)
downloadlibgit2-2d615d66171afd74889514375b9c4098171bf12c.tar.gz
refactor source tree: move utilities into `util`
Add a new source directory, `util`, that contains utility functions like buffers, vectors, etc, that that are general purpose and not necessarily part of libgit2 itself. These utility functions can be used by additional projects.
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/SelectHashes.cmake4
-rw-r--r--examples/CMakeLists.txt9
-rw-r--r--fuzzers/CMakeLists.txt5
-rw-r--r--src/CMakeLists.txt283
-rw-r--r--src/libgit2/CMakeLists.txt434
-rw-r--r--src/libgit2/common.h165
-rw-r--r--src/libgit2/errors.h28
-rw-r--r--src/libgit2/oid.c437
-rw-r--r--src/libgit2/strarray.c2
-rw-r--r--src/util/CMakeCache.txt364
-rw-r--r--src/util/CMakeFiles/3.16.3/CMakeCCompiler.cmake76
-rwxr-xr-xsrc/util/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.binbin0 -> 16544 bytes
-rw-r--r--src/util/CMakeFiles/3.16.3/CMakeSystem.cmake15
-rw-r--r--src/util/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c671
-rwxr-xr-xsrc/util/CMakeFiles/3.16.3/CompilerIdC/a.outbin0 -> 16704 bytes
-rw-r--r--src/util/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp660
-rw-r--r--src/util/CMakeFiles/CMakeError.log90
-rw-r--r--src/util/CMakeFiles/CMakeOutput.log227
-rw-r--r--src/util/CMakeFiles/cmake.check_cache1
-rw-r--r--src/util/CMakeLists.txt34
-rw-r--r--src/util/alloc.c (renamed from src/libgit2/alloc.c)0
-rw-r--r--src/util/alloc.h (renamed from src/libgit2/alloc.h)4
-rw-r--r--src/util/allocators/stdalloc.c (renamed from src/libgit2/allocators/stdalloc.c)0
-rw-r--r--src/util/allocators/stdalloc.h (renamed from src/libgit2/allocators/stdalloc.h)6
-rw-r--r--src/util/allocators/win32_crtdbg.c (renamed from src/libgit2/allocators/win32_crtdbg.c)0
-rw-r--r--src/util/allocators/win32_crtdbg.h (renamed from src/libgit2/allocators/win32_crtdbg.h)6
-rw-r--r--src/util/array.h (renamed from src/libgit2/array.h)0
-rw-r--r--src/util/assert_safe.h (renamed from src/libgit2/assert_safe.h)0
-rw-r--r--src/util/buf_text.c (renamed from src/libgit2/buf_text.c)0
-rw-r--r--src/util/buf_text.h (renamed from src/libgit2/buf_text.h)6
-rw-r--r--src/util/buffer.c (renamed from src/libgit2/buffer.c)0
-rw-r--r--src/util/buffer.h (renamed from src/libgit2/buffer.h)6
-rw-r--r--src/util/cc-compat.h (renamed from src/libgit2/cc-compat.h)4
-rw-r--r--src/util/errors.h41
-rw-r--r--src/util/features.h.in (renamed from src/libgit2/features.h.in)4
-rw-r--r--src/util/futils.c (renamed from src/libgit2/futils.c)3
-rw-r--r--src/util/futils.h (renamed from src/libgit2/futils.h)6
-rw-r--r--src/util/git2_util.h179
-rw-r--r--src/util/hash.c (renamed from src/libgit2/hash.c)0
-rw-r--r--src/util/hash.h (renamed from src/libgit2/hash.h)6
-rw-r--r--src/util/hash/sha1.h (renamed from src/libgit2/hash/sha1.h)6
-rw-r--r--src/util/hash/sha1/collisiondetect.c (renamed from src/libgit2/hash/sha1/collisiondetect.c)0
-rw-r--r--src/util/hash/sha1/collisiondetect.h (renamed from src/libgit2/hash/sha1/collisiondetect.h)4
-rw-r--r--src/util/hash/sha1/common_crypto.c (renamed from src/libgit2/hash/sha1/common_crypto.c)0
-rw-r--r--src/util/hash/sha1/common_crypto.h (renamed from src/libgit2/hash/sha1/common_crypto.h)4
-rw-r--r--src/util/hash/sha1/generic.c (renamed from src/libgit2/hash/sha1/generic.c)0
-rw-r--r--src/util/hash/sha1/generic.h (renamed from src/libgit2/hash/sha1/generic.h)4
-rw-r--r--src/util/hash/sha1/mbedtls.c (renamed from src/libgit2/hash/sha1/mbedtls.c)0
-rw-r--r--src/util/hash/sha1/mbedtls.h (renamed from src/libgit2/hash/sha1/mbedtls.h)4
-rw-r--r--src/util/hash/sha1/openssl.c (renamed from src/libgit2/hash/sha1/openssl.c)0
-rw-r--r--src/util/hash/sha1/openssl.h (renamed from src/libgit2/hash/sha1/openssl.h)4
-rw-r--r--src/util/hash/sha1/sha1dc/sha1.c (renamed from src/libgit2/hash/sha1/sha1dc/sha1.c)0
-rw-r--r--src/util/hash/sha1/sha1dc/sha1.h (renamed from src/libgit2/hash/sha1/sha1dc/sha1.h)0
-rw-r--r--src/util/hash/sha1/sha1dc/ubc_check.c (renamed from src/libgit2/hash/sha1/sha1dc/ubc_check.c)0
-rw-r--r--src/util/hash/sha1/sha1dc/ubc_check.h (renamed from src/libgit2/hash/sha1/sha1dc/ubc_check.h)0
-rw-r--r--src/util/hash/sha1/win32.c (renamed from src/libgit2/hash/sha1/win32.c)4
-rw-r--r--src/util/hash/sha1/win32.h (renamed from src/libgit2/hash/sha1/win32.h)4
-rw-r--r--src/util/integer.h (renamed from src/libgit2/integer.h)4
-rw-r--r--src/util/khash.h (renamed from src/libgit2/khash.h)0
-rw-r--r--src/util/map.h (renamed from src/libgit2/map.h)6
-rw-r--r--src/util/net.c (renamed from src/libgit2/net.c)1
-rw-r--r--src/util/net.h (renamed from src/libgit2/net.h)2
-rw-r--r--src/util/oid.c444
-rw-r--r--src/util/oid.h (renamed from src/libgit2/oid.h)6
-rw-r--r--src/util/path.c (renamed from src/libgit2/path.c)2
-rw-r--r--src/util/path.h (renamed from src/libgit2/path.h)6
-rw-r--r--src/util/pool.c (renamed from src/libgit2/pool.c)0
-rw-r--r--src/util/pool.h (renamed from src/libgit2/pool.h)6
-rw-r--r--src/util/posix.c (renamed from src/libgit2/posix.c)0
-rw-r--r--src/util/posix.h (renamed from src/libgit2/posix.h)6
-rw-r--r--src/util/runtime.c (renamed from src/libgit2/runtime.c)2
-rw-r--r--src/util/runtime.h (renamed from src/libgit2/runtime.h)2
-rw-r--r--src/util/strmap.c (renamed from src/libgit2/strmap.c)0
-rw-r--r--src/util/strmap.h (renamed from src/libgit2/strmap.h)6
-rw-r--r--src/util/strnlen.h (renamed from src/libgit2/strnlen.h)4
-rw-r--r--src/util/thread-utils.c (renamed from src/libgit2/thread-utils.c)2
-rw-r--r--src/util/thread-utils.h (renamed from src/libgit2/thread-utils.h)4
-rw-r--r--src/util/tsort.c (renamed from src/libgit2/tsort.c)2
-rw-r--r--src/util/unix/map.c (renamed from src/libgit2/unix/map.c)2
-rw-r--r--src/util/unix/posix.h (renamed from src/libgit2/unix/posix.h)8
-rw-r--r--src/util/unix/pthread.h (renamed from src/libgit2/unix/pthread.h)4
-rw-r--r--src/util/unix/realpath.c (renamed from src/libgit2/unix/realpath.c)2
-rw-r--r--src/util/util.c (renamed from src/libgit2/util.c)3
-rw-r--r--src/util/util.h (renamed from src/libgit2/util.h)7
-rw-r--r--src/util/varint.c (renamed from src/libgit2/varint.c)0
-rw-r--r--src/util/varint.h (renamed from src/libgit2/varint.h)6
-rw-r--r--src/util/vector.c (renamed from src/libgit2/vector.c)0
-rw-r--r--src/util/vector.h (renamed from src/libgit2/vector.h)6
-rw-r--r--src/util/win32/dir.c (renamed from src/libgit2/win32/dir.c)0
-rw-r--r--src/util/win32/dir.h (renamed from src/libgit2/win32/dir.h)3
-rw-r--r--src/util/win32/error.c (renamed from src/libgit2/win32/error.c)0
-rw-r--r--src/util/win32/error.h (renamed from src/libgit2/win32/error.h)2
-rw-r--r--src/util/win32/map.c (renamed from src/libgit2/win32/map.c)2
-rw-r--r--src/util/win32/mingw-compat.h (renamed from src/libgit2/win32/mingw-compat.h)0
-rw-r--r--src/util/win32/msvc-compat.h (renamed from src/libgit2/win32/msvc-compat.h)0
-rw-r--r--src/util/win32/path_w32.c (renamed from src/libgit2/win32/path_w32.c)0
-rw-r--r--src/util/win32/path_w32.h (renamed from src/libgit2/win32/path_w32.h)3
-rw-r--r--src/util/win32/posix.h (renamed from src/libgit2/win32/posix.h)2
-rw-r--r--src/util/win32/posix_w32.c (renamed from src/libgit2/win32/posix_w32.c)3
-rw-r--r--src/util/win32/reparse.h (renamed from src/libgit2/win32/reparse.h)0
-rw-r--r--src/util/win32/thread.c (renamed from src/libgit2/win32/thread.c)0
-rw-r--r--src/util/win32/thread.h (renamed from src/libgit2/win32/thread.h)2
-rw-r--r--src/util/win32/utf-conv.c (renamed from src/libgit2/win32/utf-conv.c)0
-rw-r--r--src/util/win32/utf-conv.h (renamed from src/libgit2/win32/utf-conv.h)2
-rw-r--r--src/util/win32/version.h (renamed from src/libgit2/win32/version.h)0
-rw-r--r--src/util/win32/w32_buffer.c (renamed from src/libgit2/win32/w32_buffer.c)0
-rw-r--r--src/util/win32/w32_buffer.h (renamed from src/libgit2/win32/w32_buffer.h)2
-rw-r--r--src/util/win32/w32_common.h (renamed from src/libgit2/win32/w32_common.h)0
-rw-r--r--src/util/win32/w32_crtdbg_stacktrace.c (renamed from src/libgit2/win32/w32_crtdbg_stacktrace.c)0
-rw-r--r--src/util/win32/w32_crtdbg_stacktrace.h (renamed from src/libgit2/win32/w32_crtdbg_stacktrace.h)2
-rw-r--r--src/util/win32/w32_stack.c (renamed from src/libgit2/win32/w32_stack.c)0
-rw-r--r--src/util/win32/w32_stack.h (renamed from src/libgit2/win32/w32_stack.h)2
-rw-r--r--src/util/win32/w32_util.c (renamed from src/libgit2/win32/w32_util.c)0
-rw-r--r--src/util/win32/w32_util.h (renamed from src/libgit2/win32/w32_util.h)2
-rw-r--r--src/util/win32/win32-compat.h (renamed from src/libgit2/win32/win32-compat.h)0
-rw-r--r--tests/CMakeLists.txt7
117 files changed, 3291 insertions, 1098 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b4484c48..fb5202fd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -277,7 +277,7 @@ IF(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS)
UNSET(CMAKE_REQUIRED_FLAGS)
ENDIF ()
-ADD_SUBDIRECTORY(src/libgit2)
+ADD_SUBDIRECTORY(src)
# Tests
IF (NOT MSVC)
diff --git a/cmake/SelectHashes.cmake b/cmake/SelectHashes.cmake
index 06672ab03..3decc12b1 100644
--- a/cmake/SelectHashes.cmake
+++ b/cmake/SelectHashes.cmake
@@ -22,8 +22,8 @@ ENDIF()
IF(USE_SHA1 STREQUAL "CollisionDetection")
SET(GIT_SHA1_COLLISIONDETECT 1)
ADD_DEFINITIONS(-DSHA1DC_NO_STANDARD_INCLUDES=1)
- ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\")
- ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\")
+ ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\")
+ ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\")
FILE(GLOB SRC_SHA1 hash/sha1/collisiondetect.* hash/sha1/sha1dc/*)
ELSEIF(USE_SHA1 STREQUAL "OpenSSL")
# OPENSSL_FOUND should already be set, we're checking USE_HTTPS
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 8cc72b35e..a86cab05c 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,3 +1,8 @@
+GET_PROPERTY(LIBGIT2_OBJECTS GLOBAL PROPERTY libgit2_objects)
+GET_PROPERTY(LIBGIT2_INCLUDES GLOBAL PROPERTY libgit2_includes)
+GET_PROPERTY(LIBGIT2_SYSTEM_INCLUDES GLOBAL PROPERTY libgit2_system_includes)
+GET_PROPERTY(LIBGIT2_LIBS GLOBAL PROPERTY libgit2_libs)
+
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
INCLUDE_DIRECTORIES(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES})
@@ -9,7 +14,7 @@ SET_TARGET_PROPERTIES(lg2 PROPERTIES C_STANDARD 90)
ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
IF(WIN32 OR ANDROID)
- TARGET_LINK_LIBRARIES(lg2 git2)
+ TARGET_LINK_LIBRARIES(lg2 libgit2_meta)
ELSE()
- TARGET_LINK_LIBRARIES(lg2 git2 pthread)
+ TARGET_LINK_LIBRARIES(lg2 libgit2_meta pthread)
ENDIF()
diff --git a/fuzzers/CMakeLists.txt b/fuzzers/CMakeLists.txt
index 59eca24d0..302dd8de0 100644
--- a/fuzzers/CMakeLists.txt
+++ b/fuzzers/CMakeLists.txt
@@ -1,3 +1,8 @@
+GET_PROPERTY(LIBGIT2_OBJECTS GLOBAL PROPERTY libgit2_objects)
+GET_PROPERTY(LIBGIT2_INCLUDES GLOBAL PROPERTY libgit2_includes)
+GET_PROPERTY(LIBGIT2_SYSTEM_INCLUDES GLOBAL PROPERTY libgit2_system_includes)
+GET_PROPERTY(LIBGIT2_LIBS GLOBAL PROPERTY libgit2_libs)
+
LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
INCLUDE_DIRECTORIES(SYSTEM ${LIBGIT2_SYSTEM_INCLUDES})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 000000000..eeaecc971
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,283 @@
+# Top-level CMakeLists.txt does feature detection, so that all projects
+# can understand what is available to the system.
+
+# This variable will contain the libraries we need to put into
+# libgit2.pc's Requires.private. That is, what we're linking to or
+# what someone who's statically linking us needs to link to.
+set(LIBGIT2_PC_REQUIRES "")
+
+# This will be set later if we use the system's http-parser library or
+# use iconv (OSX) and will be written to the Libs.private field in the
+# pc file.
+set(LIBGIT2_PC_LIBS "")
+
+set(LIBGIT2_SYSTEM_INCLUDES "")
+set(LIBGIT2_INCLUDES "")
+set(LIBGIT2_LIBS "")
+
+if(ENABLE_TRACE)
+ set(GIT_TRACE 1)
+endif()
+add_feature_info(tracing GIT_TRACE "tracing support")
+
+check_function_exists(futimens HAVE_FUTIMENS)
+if(HAVE_FUTIMENS)
+ set(GIT_USE_FUTIMENS 1)
+endif()
+
+check_prototype_definition(qsort_r
+ "void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, \
+ int (*compar)(void *, const void *, const void *))"
+ "" "stdlib.h" HAVE_QSORT_R_BSD)
+if(HAVE_QSORT_R_BSD)
+ set(GIT_USE_QSORT_R_BSD 1)
+endif()
+
+check_prototype_definition(qsort_r
+ "void qsort_r(void *base, size_t nmemb, size_t size, \
+ int (*compar)(const void *, const void *, void *), \
+ void *arg)"
+ "" "stdlib.h" HAVE_QSORT_R_GNU)
+if(HAVE_QSORT_R_GNU)
+ set(GIT_USE_QSORT_R_GNU 1)
+endif()
+
+check_function_exists(qsort_s HAVE_QSORT_S)
+if(HAVE_QSORT_S)
+ set(GIT_USE_QSORT_S 1)
+endif()
+
+# Find required dependencies
+
+if(WIN32)
+ list(APPEND LIBGIT2_LIBS ws2_32)
+elseif(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
+ list(APPEND LIBGIT2_LIBS socket nsl)
+ list(APPEND LIBGIT2_PC_LIBS "-lsocket -lnsl")
+elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku")
+ list(APPEND LIBGIT2_LIBS network)
+ list(APPEND LIBGIT2_PC_LIBS "-lnetwork")
+endif()
+
+check_library_exists(rt clock_gettime "time.h" NEED_LIBRT)
+if(NEED_LIBRT)
+ list(APPEND LIBGIT2_LIBS rt)
+ list(APPEND LIBGIT2_PC_LIBS "-lrt")
+endif()
+
+if(THREADSAFE)
+ list(APPEND LIBGIT2_LIBS ${CMAKE_THREAD_LIBS_INIT})
+ list(APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT})
+endif()
+add_feature_info(threadsafe THREADSAFE "threadsafe support")
+
+if(WIN32 AND EMBED_SSH_PATH)
+ file(GLOB LIBGIT2_SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
+ list(SORT LIBGIT2_SRC_SSH)
+
+ list(APPEND LIBGIT2_SYSTEM_INCLUDES "${EMBED_SSH_PATH}/include")
+ file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
+ set(GIT_SSH 1)
+endif()
+
+if(WIN32 AND WINHTTP)
+ set(GIT_WINHTTP 1)
+
+ # Since MinGW does not come with headers or an import library for winhttp,
+ # we have to include a private header and generate our own import library
+ if(MINGW)
+ add_subdirectory("${libgit2_SOURCE_DIR}/deps/winhttp" "${libgit2_BINARY_DIR}/deps/winhttp")
+ list(APPEND LIBGIT2_LIBS winhttp)
+ list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/winhttp")
+ else()
+ list(APPEND LIBGIT2_LIBS "winhttp")
+ list(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
+ endif()
+
+ list(APPEND LIBGIT2_LIBS "rpcrt4" "crypt32" "ole32")
+ list(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
+endif()
+
+include(SelectHTTPSBackend)
+include(SelectHashes)
+
+# Specify regular expression implementation
+find_package(PCRE)
+
+if(REGEX_BACKEND STREQUAL "")
+ check_symbol_exists(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
+
+ if(HAVE_REGCOMP_L)
+ set(REGEX_BACKEND "regcomp_l")
+ elseif(PCRE_FOUND)
+ set(REGEX_BACKEND "pcre")
+ else()
+ set(REGEX_BACKEND "builtin")
+ endif()
+endif()
+
+if(REGEX_BACKEND STREQUAL "regcomp_l")
+ add_feature_info(regex ON "using system regcomp_l")
+ set(GIT_REGEX_REGCOMP_L 1)
+elseif(REGEX_BACKEND STREQUAL "pcre2")
+ find_package(PCRE2)
+
+ if(NOT PCRE2_FOUND)
+ message(FATAL_ERROR "PCRE2 support was requested but not found")
+ endif()
+
+ add_feature_info(regex ON "using system PCRE2")
+ set(GIT_REGEX_PCRE2 1)
+
+ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS})
+ list(APPEND LIBGIT2_LIBS ${PCRE2_LIBRARIES})
+ list(APPEND LIBGIT2_PC_REQUIRES "libpcre2-8")
+elseif(REGEX_BACKEND STREQUAL "pcre")
+ add_feature_info(regex ON "using system PCRE")
+ set(GIT_REGEX_PCRE 1)
+
+ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE_INCLUDE_DIRS})
+ list(APPEND LIBGIT2_LIBS ${PCRE_LIBRARIES})
+ list(APPEND LIBGIT2_PC_REQUIRES "libpcre")
+elseif(REGEX_BACKEND STREQUAL "regcomp")
+ add_feature_info(regex ON "using system regcomp")
+ set(GIT_REGEX_REGCOMP 1)
+elseif(REGEX_BACKEND STREQUAL "builtin")
+ add_feature_info(regex ON "using bundled PCRE")
+ set(GIT_REGEX_BUILTIN 1)
+
+ add_subdirectory("${libgit2_SOURCE_DIR}/deps/pcre" "${libgit2_BINARY_DIR}/deps/pcre")
+ list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/pcre")
+ list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:pcre>)
+else()
+ message(FATAL_ERROR "The REGEX_BACKEND option provided is not supported")
+endif()
+
+# Optional external dependency: http-parser
+if(USE_HTTP_PARSER STREQUAL "system")
+ FIND_PACKAGE(HTTP_Parser)
+
+ if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
+ list(APPEND COMMON_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
+ list(APPEND COMMON_LIBS ${HTTP_PARSER_LIBRARIES})
+ list(APPEND COMMON_PC_LIBS "-lhttp_parser")
+ add_feature_info(http-parser ON "http-parser support (system)")
+ else()
+ message(FATAL_ERROR "http-parser support was requested but not found")
+ endif()
+else()
+ message(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
+ add_subdirectory("${libgit2_SOURCE_DIR}/deps/http-parser" "${libgit2_BINARY_DIR}/deps/http-parser")
+ list(APPEND COMMON_INCLUDES "${libgit2_SOURCE_DIR}/deps/http-parser")
+ list(APPEND COMMON_OBJECTS "$<TARGET_OBJECTS:http-parser>")
+ add_feature_info(http-parser ON "http-parser support (bundled)")
+endif()
+
+# Optional external dependency: zlib
+if(NOT USE_BUNDLED_ZLIB)
+ find_package(ZLIB)
+ if(ZLIB_FOUND)
+ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS})
+ list(APPEND LIBGIT2_LIBS ${ZLIB_LIBRARIES})
+ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ list(APPEND LIBGIT2_PC_LIBS "-lz")
+ else()
+ list(APPEND LIBGIT2_PC_REQUIRES "zlib")
+ endif()
+ add_feature_info(zlib ON "using system zlib")
+ else()
+ MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
+ endif()
+endif()
+if(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
+ add_subdirectory("${libgit2_SOURCE_DIR}/deps/zlib" "${libgit2_BINARY_DIR}/deps/zlib")
+ list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib")
+ list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>)
+ add_feature_info(zlib ON "using bundled zlib")
+endif()
+
+# Optional external dependency: libssh2
+if(USE_SSH)
+ find_pkglibraries(LIBSSH2 libssh2)
+endif()
+if(LIBSSH2_FOUND)
+ set(GIT_SSH 1)
+ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
+ list(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES})
+ list(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
+
+ check_library_exists("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
+ if(HAVE_LIBSSH2_MEMORY_CREDENTIALS)
+ set(GIT_SSH_MEMORY_CREDENTIALS 1)
+ endif()
+else()
+ message(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
+endif()
+add_feature_info(SSH GIT_SSH "SSH transport support")
+
+# Optional external dependency: ntlmclient
+if(USE_NTLMCLIENT)
+ set(GIT_NTLM 1)
+ add_subdirectory("${libgit2_SOURCE_DIR}/deps/ntlmclient" "${libgit2_BINARY_DIR}/deps/ntlmclient")
+ list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/ntlmclient")
+ list(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:ntlmclient>")
+endif()
+add_feature_info(ntlmclient GIT_NTLM "NTLM authentication support for Unix")
+
+# Optional external dependency: GSSAPI
+
+include(SelectGSSAPI)
+
+# Optional external dependency: iconv
+if(USE_ICONV)
+ find_package(Iconv)
+endif()
+if(ICONV_FOUND)
+ set(GIT_USE_ICONV 1)
+ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${ICONV_INCLUDE_DIR})
+ list(APPEND LIBGIT2_LIBS ${ICONV_LIBRARIES})
+ list(APPEND LIBGIT2_PC_LIBS ${ICONV_LIBRARIES})
+ENDIF()
+add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support")
+
+if(THREADSAFE)
+ if(NOT WIN32)
+ find_package(Threads REQUIRED)
+ endif()
+
+ set(GIT_THREADS 1)
+endif()
+
+if(USE_NSEC)
+ set(GIT_USE_NSEC 1)
+endif()
+
+if(HAVE_STRUCT_STAT_ST_MTIM)
+ set(GIT_USE_STAT_MTIM 1)
+elseif(HAVE_STRUCT_STAT_ST_MTIMESPEC)
+ set(GIT_USE_STAT_MTIMESPEC 1)
+elseif(HAVE_STRUCT_STAT_ST_MTIME_NSEC)
+ set(GIT_USE_STAT_MTIME_NSEC 1)
+endif()
+
+add_definitions(-D_FILE_OFFSET_BITS=64)
+
+if(USE_LEAK_CHECKER STREQUAL "valgrind")
+ add_definitions(-DVALGRIND)
+endif()
+
+# Determine architecture of the machine
+IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(GIT_ARCH_64 1)
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(GIT_ARCH_32 1)
+elseif(CMAKE_SIZEOF_VOID_P)
+ message(FATAL_ERROR "Unsupported architecture (pointer size is ${CMAKE_SIZEOF_VOID_P} bytes)")
+else()
+ message(FATAL_ERROR "Unsupported architecture (CMAKE_SIZEOF_VOID_P is unset)")
+endif()
+
+configure_file(util/features.h.in generated/features.h)
+
+add_subdirectory(util)
+add_subdirectory(libgit2)
diff --git a/src/libgit2/CMakeLists.txt b/src/libgit2/CMakeLists.txt
index c086896b8..ca825652a 100644
--- a/src/libgit2/CMakeLists.txt
+++ b/src/libgit2/CMakeLists.txt
@@ -1,399 +1,131 @@
-IF(DEBUG_POOL)
- SET(GIT_DEBUG_POOL 1)
-ENDIF()
-ADD_FEATURE_INFO(debugpool GIT_DEBUG_POOL "debug pool allocator")
+include(PkgBuildConfig)
-INCLUDE(PkgBuildConfig)
-
-# This variable will contain the libraries we need to put into
-# libgit2.pc's Requires.private. That is, what we're linking to or
-# what someone who's statically linking us needs to link to.
-SET(LIBGIT2_PC_REQUIRES "")
-# This will be set later if we use the system's http-parser library or
-# use iconv (OSX) and will be written to the Libs.private field in the
-# pc file.
-SET(LIBGIT2_PC_LIBS "")
-
-SET(LIBGIT2_INCLUDES
- "${CMAKE_CURRENT_BINARY_DIR}"
+list(APPEND LIBGIT2_INCLUDES
+ "${COMMON_INCLUDES}"
+ "${libgit2_BINARY_DIR}/src"
+ "${libgit2_SOURCE_DIR}/src/util"
"${libgit2_SOURCE_DIR}/src/libgit2"
"${libgit2_SOURCE_DIR}/include")
-SET(LIBGIT2_SYSTEM_INCLUDES "")
-SET(LIBGIT2_LIBS "")
-
-# Enable tracing
-IF(ENABLE_TRACE)
- SET(GIT_TRACE 1)
-ENDIF()
-ADD_FEATURE_INFO(tracing GIT_TRACE "tracing support")
-
-CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
-IF (HAVE_FUTIMENS)
- SET(GIT_USE_FUTIMENS 1)
-ENDIF ()
-
-CHECK_PROTOTYPE_DEFINITION(qsort_r
- "void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *))"
- "" "stdlib.h" HAVE_QSORT_R_BSD)
-IF (HAVE_QSORT_R_BSD)
- ADD_DEFINITIONS(-DHAVE_QSORT_R_BSD)
-ENDIF()
-
-CHECK_PROTOTYPE_DEFINITION(qsort_r
- "void qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *arg)"
- "" "stdlib.h" HAVE_QSORT_R_GNU)
-IF (HAVE_QSORT_R_GNU)
- ADD_DEFINITIONS(-DHAVE_QSORT_R_GNU)
-ENDIF()
-
-CHECK_FUNCTION_EXISTS(qsort_s HAVE_QSORT_S)
-IF (HAVE_QSORT_S)
- ADD_DEFINITIONS(-DHAVE_QSORT_S)
-ENDIF ()
-
-# Find required dependencies
-
-IF(WIN32)
- LIST(APPEND LIBGIT2_LIBS ws2_32)
-ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
- LIST(APPEND LIBGIT2_LIBS socket nsl)
- LIST(APPEND LIBGIT2_PC_LIBS "-lsocket" "-lnsl")
-ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Haiku")
- LIST(APPEND LIBGIT2_LIBS network)
- LIST(APPEND LIBGIT2_PC_LIBS "-lnetwork")
-ENDIF()
-
-CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" NEED_LIBRT)
-IF(NEED_LIBRT)
- LIST(APPEND LIBGIT2_LIBS rt)
- LIST(APPEND LIBGIT2_PC_LIBS "-lrt")
-ENDIF()
-
-IF(THREADSAFE)
- LIST(APPEND LIBGIT2_LIBS ${CMAKE_THREAD_LIBS_INIT})
- LIST(APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT})
-ENDIF()
-ADD_FEATURE_INFO(threadsafe THREADSAFE "threadsafe support")
-
-
-if(WIN32 AND EMBED_SSH_PATH)
- file(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
- list(SORT SRC_SSH)
- list(APPEND LIBGIT2_SYSTEM_INCLUDES "${EMBED_SSH_PATH}/include")
- file(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
- set(GIT_SSH 1)
-endif()
-
-IF (WIN32 AND WINHTTP)
- SET(GIT_WINHTTP 1)
-
- # Since MinGW does not come with headers or an import library for winhttp,
- # we have to include a private header and generate our own import library
- IF (MINGW)
- ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/winhttp" "${libgit2_BINARY_DIR}/deps/winhttp")
- LIST(APPEND LIBGIT2_LIBS winhttp)
- LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/winhttp")
- ELSE()
- LIST(APPEND LIBGIT2_LIBS "winhttp")
- LIST(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
- ENDIF ()
-
- LIST(APPEND LIBGIT2_LIBS "rpcrt4" "crypt32" "ole32")
- LIST(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
-ENDIF()
-
-Include(SelectHTTPSBackend)
-Include(SelectHashes)
-
-# Specify regular expression implementation
-FIND_PACKAGE(PCRE)
-
-IF(REGEX_BACKEND STREQUAL "")
- CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
-
- IF(HAVE_REGCOMP_L)
- SET(REGEX_BACKEND "regcomp_l")
- ELSEIF(PCRE_FOUND)
- SET(REGEX_BACKEND "pcre")
- ELSE()
- SET(REGEX_BACKEND "builtin")
- ENDIF()
-ENDIF()
-
-IF(REGEX_BACKEND STREQUAL "regcomp_l")
- ADD_FEATURE_INFO(regex ON "using system regcomp_l")
- SET(GIT_REGEX_REGCOMP_L 1)
-ELSEIF(REGEX_BACKEND STREQUAL "pcre2")
- FIND_PACKAGE(PCRE2)
-
- IF(NOT PCRE2_FOUND)
- MESSAGE(FATAL_ERROR "PCRE2 support was requested but not found")
- ENDIF()
-
- ADD_FEATURE_INFO(regex ON "using system PCRE2")
- SET(GIT_REGEX_PCRE2 1)
-
- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS})
- LIST(APPEND LIBGIT2_LIBS ${PCRE2_LIBRARIES})
- LIST(APPEND LIBGIT2_PC_REQUIRES "libpcre2-8")
-ELSEIF(REGEX_BACKEND STREQUAL "pcre")
- ADD_FEATURE_INFO(regex ON "using system PCRE")
- SET(GIT_REGEX_PCRE 1)
-
- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE_INCLUDE_DIRS})
- LIST(APPEND LIBGIT2_LIBS ${PCRE_LIBRARIES})
- LIST(APPEND LIBGIT2_PC_REQUIRES "libpcre")
-ELSEIF(REGEX_BACKEND STREQUAL "regcomp")
- ADD_FEATURE_INFO(regex ON "using system regcomp")
- SET(GIT_REGEX_REGCOMP 1)
-ELSEIF(REGEX_BACKEND STREQUAL "builtin")
- ADD_FEATURE_INFO(regex ON "using bundled PCRE")
- SET(GIT_REGEX_BUILTIN 1)
-
- ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/pcre" "${libgit2_BINARY_DIR}/deps/pcre")
- LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/pcre")
- LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:pcre>)
-ELSE()
- MESSAGE(FATAL_ERROR "The REGEX_BACKEND option provided is not supported")
-ENDIF()
-# Optional external dependency: http-parser
-IF(USE_HTTP_PARSER STREQUAL "system")
- FIND_PACKAGE(HTTP_Parser)
+list(APPEND LIBGIT2_SYSTEM_INCLUDES "${COMMON_SYSTEM_INCLUDES}")
+list(APPEND LIBGIT2_LIBS "${COMMON_LIBS}")
+list(APPEND LIBGIT2_PC_LIBS "${COMMON_PC_LIBS}")
- IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
- LIST(APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES})
- LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
- ADD_FEATURE_INFO(http-parser ON "http-parser support (system)")
- ELSE()
- MESSAGE(FATAL_ERROR "http-parser support was requested but not found")
- ENDIF()
-ELSE()
- MESSAGE(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
- ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/http-parser" "${libgit2_BINARY_DIR}/deps/http-parser")
- LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/http-parser")
- LIST(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:http-parser>")
- ADD_FEATURE_INFO(http-parser ON "http-parser support (bundled)")
-ENDIF()
-
-# Optional external dependency: zlib
-IF(NOT USE_BUNDLED_ZLIB)
- FIND_PACKAGE(ZLIB)
- IF(ZLIB_FOUND)
- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${ZLIB_INCLUDE_DIRS})
- LIST(APPEND LIBGIT2_LIBS ${ZLIB_LIBRARIES})
- IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
- LIST(APPEND LIBGIT2_PC_LIBS "-lz")
- ELSE()
- LIST(APPEND LIBGIT2_PC_REQUIRES "zlib")
- ENDIF()
- ADD_FEATURE_INFO(zlib ON "using system zlib")
- ELSE()
- MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
- ENDIF()
-ENDIF()
-IF(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
- ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/zlib" "${libgit2_BINARY_DIR}/deps/zlib")
- LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib")
- LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>)
- ADD_FEATURE_INFO(zlib ON "using bundled zlib")
-ENDIF()
-
-# Optional external dependency: libssh2
-IF (USE_SSH)
- FIND_PKGLIBRARIES(LIBSSH2 libssh2)
-ENDIF()
-IF (LIBSSH2_FOUND)
- SET(GIT_SSH 1)
- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
- LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES})
- LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
-
- CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
- IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS)
- SET(GIT_SSH_MEMORY_CREDENTIALS 1)
- ENDIF()
-ELSE()
- MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
-ENDIF()
-ADD_FEATURE_INFO(SSH GIT_SSH "SSH transport support")
-
-# Optional external dependency: ntlmclient
-IF (USE_NTLMCLIENT)
- SET(GIT_NTLM 1)
- ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/ntlmclient" "${libgit2_BINARY_DIR}/deps/ntlmclient")
- LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/ntlmclient")
- LIST(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:ntlmclient>")
-ENDIF()
-ADD_FEATURE_INFO(ntlmclient GIT_NTLM "NTLM authentication support for Unix")
-
-# Optional external dependency: GSSAPI
-
-INCLUDE(SelectGSSAPI)
-
-# Optional external dependency: iconv
-IF (USE_ICONV)
- FIND_PACKAGE(Iconv)
-ENDIF()
-IF (ICONV_FOUND)
- SET(GIT_USE_ICONV 1)
- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${ICONV_INCLUDE_DIR})
- LIST(APPEND LIBGIT2_LIBS ${ICONV_LIBRARIES})
- LIST(APPEND LIBGIT2_PC_LIBS ${ICONV_LIBRARIES})
-ENDIF()
-ADD_FEATURE_INFO(iconv GIT_USE_ICONV "iconv encoding conversion support")
-
-
-IF (THREADSAFE)
- IF (NOT WIN32)
- FIND_PACKAGE(Threads REQUIRED)
- ENDIF()
-
- SET(GIT_THREADS 1)
-ENDIF()
-
-IF (USE_NSEC)
- SET(GIT_USE_NSEC 1)
-ENDIF()
-
-IF (HAVE_STRUCT_STAT_ST_MTIM)
- SET(GIT_USE_STAT_MTIM 1)
-ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
- SET(GIT_USE_STAT_MTIMESPEC 1)
-ELSEIF (HAVE_STRUCT_STAT_ST_MTIME_NSEC)
- SET(GIT_USE_STAT_MTIME_NSEC 1)
-ENDIF()
-
-ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
-
-# Collect sourcefiles
-file(GLOB SRC_H
+file(GLOB LIBGIT2_SRC_H
"${libgit2_SOURCE_DIR}/include/git2.h"
"${libgit2_SOURCE_DIR}/include/git2/*.h"
"${libgit2_SOURCE_DIR}/include/git2/sys/*.h")
-list(SORT SRC_H)
+list(SORT LIBGIT2_SRC_H)
# On Windows use specific platform sources
if(WIN32 AND NOT CYGWIN)
if(MSVC)
- SET(WIN_RC "win32/git2.rc")
+ set(LIBGIT2_WIN_RC "win32/git2.rc")
endif()
- file(GLOB SRC_OS win32/*.c win32/*.h)
- list(SORT SRC_OS)
+ list(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/src/util/win32")
+ file(GLOB LIBGIT2_SRC_OS win32/*.c win32/*.h)
+ list(SORT LIBGIT2_SRC_OS)
elseif(AMIGA)
add_definitions(-DNO_ADDRINFO -DNO_READDIR_R -DNO_MMAP)
else()
- file(GLOB SRC_OS unix/*.c unix/*.h)
- list(SORT SRC_OS)
+ file(GLOB LIBGIT2_SRC_OS unix/*.c unix/*.h)
+ list(SORT LIBGIT2_SRC_OS)
endif()
-IF (USE_LEAK_CHECKER STREQUAL "valgrind")
- ADD_DEFINITIONS(-DVALGRIND)
-ENDIF()
-
-file(GLOB SRC_GIT2 *.c *.h
- allocators/*.c allocators/*.h
+file(GLOB LIBGIT2_SRC_C *.c *.h
streams/*.c streams/*.h
transports/*.c transports/*.h
xdiff/*.c xdiff/*.h)
-list(SORT SRC_GIT2)
+list(SORT LIBGIT2_SRC_C)
-IF(APPLE)
+if(APPLE)
# The old Secure Transport API has been deprecated in macOS 10.15.
- SET_SOURCE_FILES_PROPERTIES(streams/stransport.c PROPERTIES COMPILE_FLAGS -Wno-deprecated)
-ENDIF()
+ set_source_files_properties(streams/stransport.c PROPERTIES COMPILE_FLAGS -Wno-deprecated)
+endif()
# the xdiff dependency is not (yet) warning-free, disable warnings as
# errors for the xdiff sources until we've sorted them out
-IF(MSVC)
- SET_SOURCE_FILES_PROPERTIES(xdiff/xdiffi.c PROPERTIES COMPILE_FLAGS -WX-)
- SET_SOURCE_FILES_PROPERTIES(xdiff/xutils.c PROPERTIES COMPILE_FLAGS -WX-)
-ENDIF()
-
-# Determine architecture of the machine
-IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
- SET(GIT_ARCH_64 1)
-ELSEIF (CMAKE_SIZEOF_VOID_P EQUAL 4)
- SET(GIT_ARCH_32 1)
-ELSEIF (CMAKE_SIZEOF_VOID_P)
- MESSAGE(FATAL_ERROR "Unsupported architecture (pointer size is ${CMAKE_SIZEOF_VOID_P} bytes)")
-ELSE()
- MESSAGE(FATAL_ERROR "Unsupported architecture (CMAKE_SIZEOF_VOID_P is unset)")
-ENDIF()
-
-CONFIGURE_FILE(features.h.in git2/sys/features.h)
-
-SET(LIBGIT2_SOURCES ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_SSH} ${SRC_SHA1})
+if(MSVC)
+ set_source_files_properties(xdiff/xdiffi.c PROPERTIES COMPILE_FLAGS -WX-)
+ set_source_files_properties(xdiff/xutils.c PROPERTIES COMPILE_FLAGS -WX-)
+endif()
-ADD_LIBRARY(git2internal OBJECT ${LIBGIT2_SOURCES})
-SET_TARGET_PROPERTIES(git2internal PROPERTIES C_STANDARD 90)
-IDE_SPLIT_SOURCES(git2internal)
-LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal>)
+set(LIBGIT2_SRC ${LIBGIT2_SRC_H} ${LIBGIT2_SRC_C} ${LIBGIT2_SRC_OS} ${LIBGIT2_SRC_SSH})
-TARGET_INCLUDE_DIRECTORIES(git2internal PRIVATE ${LIBGIT2_INCLUDES} PUBLIC ${libgit2_SOURCE_DIR}/include)
-TARGET_INCLUDE_DIRECTORIES(git2internal SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
+add_library(libgit2 OBJECT ${LIBGIT2_SRC})
+set_target_properties(libgit2 PROPERTIES C_STANDARD 90)
+ide_split_sources(libgit2)
+list(APPEND LIBGIT2_OBJECTS ${COMMON_OBJECTS})
+list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:libgit2>)
+list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util>)
-SET(LIBGIT2_OBJECTS ${LIBGIT2_OBJECTS} PARENT_SCOPE)
-SET(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
-SET(LIBGIT2_SYSTEM_INCLUDES ${LIBGIT2_SYSTEM_INCLUDES} PARENT_SCOPE)
-SET(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE)
+target_include_directories(libgit2 PRIVATE ${LIBGIT2_INCLUDES} PUBLIC ${libgit2_SOURCE_DIR}/include)
+target_include_directories(libgit2 SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
-IF(XCODE_VERSION)
+if(XCODE_VERSION)
# This is required for Xcode to actually link the libgit2 library
# when using only object libraries.
- FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "")
- LIST(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c)
-ENDIF()
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "")
+ list(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c)
+endif()
# Compile and link libgit2
-ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
-TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS})
+add_library(libgit2_meta ${WIN_RC} ${LIBGIT2_OBJECTS})
+target_link_libraries(libgit2_meta ${LIBGIT2_LIBS})
-SET_TARGET_PROPERTIES(git2 PROPERTIES C_STANDARD 90)
-SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
-SET_TARGET_PROPERTIES(git2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
-SET_TARGET_PROPERTIES(git2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
+set_target_properties(libgit2_meta PROPERTIES C_STANDARD 90)
+set_target_properties(libgit2_meta PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
+set_target_properties(libgit2_meta PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
+set_target_properties(libgit2_meta PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
# Win64+MSVC+static libs = linker error
-IF(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS)
- SET_TARGET_PROPERTIES(git2 PROPERTIES STATIC_LIBRARY_FLAGS "/MACHINE:x64")
-ENDIF()
-
-IDE_SPLIT_SOURCES(git2)
+if(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS)
+ set_target_properties(libgit2_meta PROPERTIES STATIC_LIBRARY_FLAGS "/MACHINE:x64")
+endif()
-IF (SONAME)
- SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
- SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_SOVERSION})
- IF (LIBGIT2_FILENAME)
- ADD_DEFINITIONS(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\")
- SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
- ELSEIF (DEFINED LIBGIT2_PREFIX)
- SET_TARGET_PROPERTIES(git2 PROPERTIES PREFIX "${LIBGIT2_PREFIX}")
- ENDIF()
-ENDIF()
+ide_split_sources(libgit2_meta)
+
+if(SONAME)
+ set_target_properties(libgit2_meta PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
+ set_target_properties(libgit2_meta PROPERTIES SOVERSION ${LIBGIT2_SOVERSION})
+ if(LIBGIT2_FILENAME)
+ add_definitions(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\")
+ set_target_properties(libgit2_meta PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
+ elseif(DEFINED LIBGIT2_PREFIX)
+ set_target_properties(libgit2_meta PROPERTIES PREFIX "${LIBGIT2_PREFIX}")
+ else()
+ set_target_properties(libgit2_meta PROPERTIES OUTPUT_NAME git2)
+ endif()
+endif()
-PKG_BUILD_CONFIG(NAME libgit2
+pkg_build_config(NAME libgit2
VERSION ${LIBGIT2_VERSION_STRING}
- DESCRIPTION "The git library, take 2"
- LIBS_SELF git2
+ DESCRIPTION "A cross-platform, linkable library implementation of Git that you can use in your application."
+ LIBS_SELF libgit2_meta
PRIVATE_LIBS ${LIBGIT2_PC_LIBS}
- REQUIRES ${LIBGIT2_PC_REQUIRES}
-)
+ REQUIRES ${LIBGIT2_PC_REQUIRES})
-IF (MSVC_IDE)
- # Precompiled headers
- SET_TARGET_PROPERTIES(git2 PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
- SET_SOURCE_FILES_PROPERTIES(win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
-ENDIF ()
+if(MSVC_IDE)
+ # Precompiled headers
+ set_target_properties(libgit2_meta PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
+ set_source_files_properties(win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
+endif()
# Install
-INSTALL(TARGETS git2
+install(TARGETS libgit2_meta
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-)
-INSTALL(DIRECTORY ${libgit2_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
-INSTALL(FILES ${libgit2_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+install(DIRECTORY ${libgit2_SOURCE_DIR}/include/git2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+install(FILES ${libgit2_SOURCE_DIR}/include/git2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+
+# export these variables for the test framework; it links our object
+# files directly (instead of linking to libgit2.so) so that it can
+# test private and internal functions.
+set_property(GLOBAL PROPERTY libgit2_objects ${LIBGIT2_OBJECTS})
+set_property(GLOBAL PROPERTY libgit2_includes ${LIBGIT2_INCLUDES})
+set_property(GLOBAL PROPERTY libgit2_system_includes ${LIBGIT2_SYSTEM_INCLUDES})
+set_property(GLOBAL PROPERTY libgit2_libs ${LIBGIT2_LIBS})
diff --git a/src/libgit2/common.h b/src/libgit2/common.h
index dc3062223..17328c1ae 100644
--- a/src/libgit2/common.h
+++ b/src/libgit2/common.h
@@ -7,80 +7,10 @@
#ifndef INCLUDE_common_h__
#define INCLUDE_common_h__
-#ifndef LIBGIT2_NO_FEATURES_H
-# include "git2/sys/features.h"
-#endif
-
-#include "git2/common.h"
-#include "cc-compat.h"
-
-/** Declare a function as always inlined. */
-#if defined(_MSC_VER)
-# define GIT_INLINE(type) static __inline type
-#elif defined(__GNUC__)
-# define GIT_INLINE(type) static __inline__ type
-#else
-# define GIT_INLINE(type) static type
-#endif
-
-/** Support for gcc/clang __has_builtin intrinsic */
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifdef GIT_WIN32
-
-# include <io.h>
-# include <direct.h>
-# include <winsock2.h>
-# include <windows.h>
-# include <ws2tcpip.h>
-# include "win32/msvc-compat.h"
-# include "win32/mingw-compat.h"
-# include "win32/w32_common.h"
-# include "win32/win32-compat.h"
-# include "win32/error.h"
-# include "win32/version.h"
-# ifdef GIT_THREADS
-# include "win32/thread.h"
-# endif
-
-#else
-
-# include <unistd.h>
-# include <strings.h>
-# ifdef GIT_THREADS
-# include <pthread.h>
-# include <sched.h>
-# endif
-#define GIT_STDLIB_CALL
-
-#ifdef GIT_USE_STAT_ATIMESPEC
-# define st_atim st_atimespec
-# define st_ctim st_ctimespec
-# define st_mtim st_mtimespec
-#endif
-
-# include <arpa/inet.h>
-
-#endif
-
-#include "git2/types.h"
-#include "git2/errors.h"
+#include "git2_util.h"
#include "errors.h"
#include "thread-utils.h"
#include "integer.h"
-#include "assert_safe.h"
/*
* Include the declarations for deprecated functions; this ensures
@@ -94,97 +24,4 @@
#define GIT_DEPRECATE_BUF
#include "git2/deprecated.h"
-#include "posix.h"
-
-#define DEFAULT_BUFSIZE 65536
-#define FILEIO_BUFSIZE DEFAULT_BUFSIZE
-#define FILTERIO_BUFSIZE DEFAULT_BUFSIZE
-#define NETIO_BUFSIZE DEFAULT_BUFSIZE
-
-/**
- * Check a pointer allocation result, returning -1 if it failed.
- */
-#define GIT_ERROR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
-
-/**
- * Check a buffer allocation result, returning -1 if it failed.
- */
-#define GIT_ERROR_CHECK_ALLOC_BUF(buf) if ((void *)(buf) == NULL || git_buf_oom(buf)) { return -1; }
-
-/**
- * Check a return value and propagate result if non-zero.
- */
-#define GIT_ERROR_CHECK_ERROR(code) \
- do { int _err = (code); if (_err) return _err; } while (0)
-
-/**
- * Check a versioned structure for validity
- */
-GIT_INLINE(int) git_error__check_version(const void *structure, unsigned int expected_max, const char *name)
-{
- unsigned int actual;
-
- if (!structure)
- return 0;
-
- actual = *(const unsigned int*)structure;
- if (actual > 0 && actual <= expected_max)
- return 0;
-
- git_error_set(GIT_ERROR_INVALID, "invalid version %d on %s", actual, name);
- return -1;
-}
-#define GIT_ERROR_CHECK_VERSION(S,V,N) if (git_error__check_version(S,V,N) < 0) return -1
-
-/**
- * Initialize a structure with a version.
- */
-GIT_INLINE(void) git__init_structure(void *structure, size_t len, unsigned int version)
-{
- memset(structure, 0, len);
- *((int*)structure) = version;
-}
-#define GIT_INIT_STRUCTURE(S,V) git__init_structure(S, sizeof(*S), V)
-
-#define GIT_INIT_STRUCTURE_FROM_TEMPLATE(PTR,VERSION,TYPE,TPL) do { \
- TYPE _tmpl = TPL; \
- GIT_ERROR_CHECK_VERSION(&(VERSION), _tmpl.version, #TYPE); \
- memcpy((PTR), &_tmpl, sizeof(_tmpl)); } while (0)
-
-
-/** Check for additive overflow, setting an error if would occur. */
-#define GIT_ADD_SIZET_OVERFLOW(out, one, two) \
- (git__add_sizet_overflow(out, one, two) ? (git_error_set_oom(), 1) : 0)
-
-/** Check for additive overflow, setting an error if would occur. */
-#define GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize) \
- (git__multiply_sizet_overflow(out, nelem, elsize) ? (git_error_set_oom(), 1) : 0)
-
-/** Check for additive overflow, failing if it would occur. */
-#define GIT_ERROR_CHECK_ALLOC_ADD(out, one, two) \
- if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { return -1; }
-
-#define GIT_ERROR_CHECK_ALLOC_ADD3(out, one, two, three) \
- if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
- GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { return -1; }
-
-#define GIT_ERROR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
- if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
- GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
- GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { return -1; }
-
-#define GIT_ERROR_CHECK_ALLOC_ADD5(out, one, two, three, four, five) \
- if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
- GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
- GIT_ADD_SIZET_OVERFLOW(out, *(out), four) || \
- GIT_ADD_SIZET_OVERFLOW(out, *(out), five)) { return -1; }
-
-/** Check for multiplicative overflow, failing if it would occur. */
-#define GIT_ERROR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
- if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { return -1; }
-
-/* NOTE: other git_error functions are in the public errors.h header file */
-
-#include "util.h"
-
#endif
diff --git a/src/libgit2/errors.h b/src/libgit2/errors.h
index a2f60f752..4a8f63aa7 100644
--- a/src/libgit2/errors.h
+++ b/src/libgit2/errors.h
@@ -17,34 +17,6 @@ void git_error_set(int error_class, const char *fmt, ...) GIT_FORMAT_PRINTF(2, 3
void git_error_vset(int error_class, const char *fmt, va_list ap);
/**
- * Set error message for user callback if needed.
- *
- * If the error code in non-zero and no error message is set, this
- * sets a generic error message.
- *
- * @return This always returns the `error_code` parameter.
- */
-GIT_INLINE(int) git_error_set_after_callback_function(
- int error_code, const char *action)
-{
- if (error_code) {
- const git_error *e = git_error_last();
- if (!e || !e->message)
- git_error_set(e ? e->klass : GIT_ERROR_CALLBACK,
- "%s callback returned %d", action, error_code);
- }
- return error_code;
-}
-
-#ifdef GIT_WIN32
-#define git_error_set_after_callback(code) \
- git_error_set_after_callback_function((code), __FUNCTION__)
-#else
-#define git_error_set_after_callback(code) \
- git_error_set_after_callback_function((code), __func__)
-#endif
-
-/**
* Gets the system error code for this thread.
*/
int git_error_system_last(void);
diff --git a/src/libgit2/oid.c b/src/libgit2/oid.c
index c28d7ac49..e5ca1fb6f 100644
--- a/src/libgit2/oid.c
+++ b/src/libgit2/oid.c
@@ -6,104 +6,7 @@
*/
#include "oid.h"
-
-#include "git2/oid.h"
-#include "repository.h"
#include "tlsdata.h"
-#include <string.h>
-#include <limits.h>
-
-static char to_hex[] = "0123456789abcdef";
-
-static int oid_error_invalid(const char *msg)
-{
- git_error_set(GIT_ERROR_INVALID, "unable to parse OID - %s", msg);
- return -1;
-}
-
-int git_oid_fromstrn(git_oid *out, const char *str, size_t length)
-{
- size_t p;
- int v;
-
- assert(out && str);
-
- if (!length)
- return oid_error_invalid("too short");
-
- if (length > GIT_OID_HEXSZ)
- return oid_error_invalid("too long");
-
- memset(out->id, 0, GIT_OID_RAWSZ);
-
- for (p = 0; p < length; p++) {
- v = git__fromhex(str[p]);
- if (v < 0)
- return oid_error_invalid("contains invalid characters");
-
- out->id[p / 2] |= (unsigned char)(v << (p % 2 ? 0 : 4));
- }
-
- return 0;
-}
-
-int git_oid_fromstrp(git_oid *out, const char *str)
-{
- return git_oid_fromstrn(out, str, strlen(str));
-}
-
-int git_oid_fromstr(git_oid *out, const char *str)
-{
- return git_oid_fromstrn(out, str, GIT_OID_HEXSZ);
-}
-
-GIT_INLINE(char) *fmt_one(char *str, unsigned int val)
-{
- *str++ = to_hex[val >> 4];
- *str++ = to_hex[val & 0xf];
- return str;
-}
-
-int git_oid_nfmt(char *str, size_t n, const git_oid *oid)
-{
- size_t i, max_i;
-
- if (!oid) {
- memset(str, 0, n);
- return 0;
- }
- if (n > GIT_OID_HEXSZ) {
- memset(&str[GIT_OID_HEXSZ], 0, n - GIT_OID_HEXSZ);
- n = GIT_OID_HEXSZ;
- }
-
- max_i = n / 2;
-
- for (i = 0; i < max_i; i++)
- str = fmt_one(str, oid->id[i]);
-
- if (n & 1)
- *str++ = to_hex[oid->id[i] >> 4];
-
- return 0;
-}
-
-int git_oid_fmt(char *str, const git_oid *oid)
-{
- return git_oid_nfmt(str, GIT_OID_HEXSZ, oid);
-}
-
-int git_oid_pathfmt(char *str, const git_oid *oid)
-{
- size_t i;
-
- str = fmt_one(str, oid->id[0]);
- *str++ = '/';
- for (i = 1; i < sizeof(oid->id); i++)
- str = fmt_one(str, oid->id[i]);
-
- return 0;
-}
char *git_oid_tostr_s(const git_oid *oid)
{
@@ -111,343 +14,3 @@ char *git_oid_tostr_s(const git_oid *oid)
git_oid_nfmt(str, GIT_OID_HEXSZ + 1, oid);
return str;
}
-
-char *git_oid_allocfmt(const git_oid *oid)
-{
- char *str = git__malloc(GIT_OID_HEXSZ + 1);
- if (!str)
- return NULL;
- git_oid_nfmt(str, GIT_OID_HEXSZ + 1, oid);
- return str;
-}
-
-char *git_oid_tostr(char *out, size_t n, const git_oid *oid)
-{
- if (!out || n == 0)
- return "";
-
- if (n > GIT_OID_HEXSZ + 1)
- n = GIT_OID_HEXSZ + 1;
-
- git_oid_nfmt(out, n - 1, oid); /* allow room for terminating NUL */
- out[n - 1] = '\0';
-
- return out;
-}
-
-int git_oid__parse(
- git_oid *oid, const char **buffer_out,
- const char *buffer_end, const char *header)
-{
- const size_t sha_len = GIT_OID_HEXSZ;
- const size_t header_len = strlen(header);
-
- const char *buffer = *buffer_out;
-
- if (buffer + (header_len + sha_len + 1) > buffer_end)
- return -1;
-
- if (memcmp(buffer, header, header_len) != 0)
- return -1;
-
- if (buffer[header_len + sha_len] != '\n')
- return -1;
-
- if (git_oid_fromstr(oid, buffer + header_len) < 0)
- return -1;
-
- *buffer_out = buffer + (header_len + sha_len + 1);
-
- return 0;
-}
-
-void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid)
-{
- char hex_oid[GIT_OID_HEXSZ];
-
- git_oid_fmt(hex_oid, oid);
- git_buf_puts(buf, header);
- git_buf_put(buf, hex_oid, GIT_OID_HEXSZ);
- git_buf_putc(buf, '\n');
-}
-
-int git_oid_fromraw(git_oid *out, const unsigned char *raw)
-{
- memcpy(out->id, raw, sizeof(out->id));
- return 0;
-}
-
-int git_oid_cpy(git_oid *out, const git_oid *src)
-{
- memcpy(out->id, src->id, sizeof(out->id));
- return 0;
-}
-
-int git_oid_cmp(const git_oid *a, const git_oid *b)
-{
- return git_oid__cmp(a, b);
-}
-
-int git_oid_equal(const git_oid *a, const git_oid *b)
-{
- return (git_oid__cmp(a, b) == 0);
-}
-
-int git_oid_ncmp(const git_oid *oid_a, const git_oid *oid_b, size_t len)
-{
- const unsigned char *a = oid_a->id;
- const unsigned char *b = oid_b->id;
-
- if (len > GIT_OID_HEXSZ)
- len = GIT_OID_HEXSZ;
-
- while (len > 1) {
- if (*a != *b)
- return 1;
- a++;
- b++;
- len -= 2;
- };
-
- if (len)
- if ((*a ^ *b) & 0xf0)
- return 1;
-
- return 0;
-}
-
-int git_oid_strcmp(const git_oid *oid_a, const char *str)
-{
- const unsigned char *a;
- unsigned char strval;
- int hexval;
-
- for (a = oid_a->id; *str && (a - oid_a->id) < GIT_OID_RAWSZ; ++a) {
- if ((hexval = git__fromhex(*str++)) < 0)
- return -1;
- strval = (unsigned char)(hexval << 4);
- if (*str) {
- if ((hexval = git__fromhex(*str++)) < 0)
- return -1;
- strval |= hexval;
- }
- if (*a != strval)
- return (*a - strval);
- }
-
- return 0;
-}
-
-int git_oid_streq(const git_oid *oid_a, const char *str)
-{
- return git_oid_strcmp(oid_a, str) == 0 ? 0 : -1;
-}
-
-int git_oid_is_zero(const git_oid *oid_a)
-{
- const unsigned char *a = oid_a->id;
- unsigned int i;
- for (i = 0; i < GIT_OID_RAWSZ; ++i, ++a)
- if (*a != 0)
- return 0;
- return 1;
-}
-
-int git_oid_iszero(const git_oid *oid_a)
-{
- return git_oid_is_zero(oid_a);
-}
-
-typedef short node_index;
-
-typedef union {
- const char *tail;
- node_index children[16];
-} trie_node;
-
-struct git_oid_shorten {
- trie_node *nodes;
- size_t node_count, size;
- int min_length, full;
-};
-
-static int resize_trie(git_oid_shorten *self, size_t new_size)
-{
- self->nodes = git__reallocarray(self->nodes, new_size, sizeof(trie_node));
- GIT_ERROR_CHECK_ALLOC(self->nodes);
-
- if (new_size > self->size) {
- memset(&self->nodes[self->size], 0x0, (new_size - self->size) * sizeof(trie_node));
- }
-
- self->size = new_size;
- return 0;
-}
-
-static trie_node *push_leaf(git_oid_shorten *os, node_index idx, int push_at, const char *oid)
-{
- trie_node *node, *leaf;
- node_index idx_leaf;
-
- if (os->node_count >= os->size) {
- if (resize_trie(os, os->size * 2) < 0)
- return NULL;
- }
-
- idx_leaf = (node_index)os->node_count++;
-
- if (os->node_count == SHRT_MAX) {
- os->full = 1;
- return NULL;
- }
-
- node = &os->nodes[idx];
- node->children[push_at] = -idx_leaf;
-
- leaf = &os->nodes[idx_leaf];
- leaf->tail = oid;
-
- return node;
-}
-
-git_oid_shorten *git_oid_shorten_new(size_t min_length)
-{
- git_oid_shorten *os;
-
- assert((size_t)((int)min_length) == min_length);
-
- os = git__calloc(1, sizeof(git_oid_shorten));
- if (os == NULL)
- return NULL;
-
- if (resize_trie(os, 16) < 0) {
- git__free(os);
- return NULL;
- }
-
- os->node_count = 1;
- os->min_length = (int)min_length;
-
- return os;
-}
-
-void git_oid_shorten_free(git_oid_shorten *os)
-{
- if (os == NULL)
- return;
-
- git__free(os->nodes);
- git__free(os);
-}
-
-
-/*
- * What wizardry is this?
- *
- * This is just a memory-optimized trie: basically a very fancy
- * 16-ary tree, which is used to store the prefixes of the OID
- * strings.
- *
- * Read more: http://en.wikipedia.org/wiki/Trie
- *
- * Magic that happens in this method:
- *
- * - Each node in the trie is an union, so it can work both as
- * a normal node, or as a leaf.
- *
- * - Each normal node points to 16 children (one for each possible
- * character in the oid). This is *not* stored in an array of
- * pointers, because in a 64-bit arch this would be sucking
- * 16*sizeof(void*) = 128 bytes of memory per node, which is
- * insane. What we do is store Node Indexes, and use these indexes
- * to look up each node in the om->index array. These indexes are
- * signed shorts, so this limits the amount of unique OIDs that
- * fit in the structure to about 20000 (assuming a more or less uniform
- * distribution).
- *
- * - All the nodes in om->index array are stored contiguously in
- * memory, and each of them is 32 bytes, so we fit 2x nodes per
- * cache line. Convenient for speed.
- *
- * - To differentiate the leafs from the normal nodes, we store all
- * the indexes towards a leaf as a negative index (indexes to normal
- * nodes are positives). When we find that one of the children for
- * a node has a negative value, that means it's going to be a leaf.
- * This reduces the amount of indexes we have by two, but also reduces
- * the size of each node by 1-4 bytes (the amount we would need to
- * add a `is_leaf` field): this is good because it allows the nodes
- * to fit cleanly in cache lines.
- *
- * - Once we reach an empty children, instead of continuing to insert
- * new nodes for each remaining character of the OID, we store a pointer
- * to the tail in the leaf; if the leaf is reached again, we turn it
- * into a normal node and use the tail to create a new leaf.
- *
- * This is a pretty good balance between performance and memory usage.
- */
-int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
-{
- int i;
- bool is_leaf;
- node_index idx;
-
- if (os->full) {
- git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
- return -1;
- }
-
- if (text_oid == NULL)
- return os->min_length;
-
- idx = 0;
- is_leaf = false;
-
- for (i = 0; i < GIT_OID_HEXSZ; ++i) {
- int c = git__fromhex(text_oid[i]);
- trie_node *node;
-
- if (c == -1) {
- git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - invalid hex value");
- return -1;
- }
-
- node = &os->nodes[idx];
-
- if (is_leaf) {
- const char *tail;
-
- tail = node->tail;
- node->tail = NULL;
-
- node = push_leaf(os, idx, git__fromhex(tail[0]), &tail[1]);
- if (node == NULL) {
- if (os->full)
- git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
- return -1;
- }
- }
-
- if (node->children[c] == 0) {
- if (push_leaf(os, idx, c, &text_oid[i + 1]) == NULL) {
- if (os->full)
- git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
- return -1;
- }
- break;
- }
-
- idx = node->children[c];
- is_leaf = false;
-
- if (idx < 0) {
- node->children[c] = idx = -idx;
- is_leaf = true;
- }
- }
-
- if (++i > os->min_length)
- os->min_length = i;
-
- return os->min_length;
-}
-
diff --git a/src/libgit2/strarray.c b/src/libgit2/strarray.c
index 7ad413404..2f464c2cb 100644
--- a/src/libgit2/strarray.c
+++ b/src/libgit2/strarray.c
@@ -5,8 +5,6 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "util.h"
-
#include "common.h"
int git_strarray_copy(git_strarray *tgt, const git_strarray *src)
diff --git a/src/util/CMakeCache.txt b/src/util/CMakeCache.txt
new file mode 100644
index 000000000..a82054d19
--- /dev/null
+++ b/src/util/CMakeCache.txt
@@ -0,0 +1,364 @@
+# This is the CMakeCache file.
+# For build in directory: /home/ethomson/libgit2/libgit2/src/util
+# It was generated by CMake: /usr/bin/cmake
+# You can edit this file to change values found and used by cmake.
+# If you do not want to change any of the values, simply exit the editor.
+# If you do want to change a value, simply edit, save, and exit the editor.
+# The syntax for the file is as follows:
+# KEY:TYPE=VALUE
+# KEY is the name of a variable in the cache.
+# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
+# VALUE is the current value for the KEY.
+
+########################
+# EXTERNAL cache entries
+########################
+
+//Path to a program.
+CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line
+
+//Path to a program.
+CMAKE_AR:FILEPATH=/usr/bin/ar
+
+//For backwards compatibility, what version of CMake commands and
+// syntax should this version of CMake try to support.
+CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
+
+//Choose the type of build, options are: None Debug Release RelWithDebInfo
+// MinSizeRel ...
+CMAKE_BUILD_TYPE:STRING=
+
+//Enable/Disable color output during build.
+CMAKE_COLOR_MAKEFILE:BOOL=ON
+
+//CXX compiler
+CMAKE_CXX_COMPILER:FILEPATH=CMAKE_CXX_COMPILER-NOTFOUND
+
+//Flags used by the CXX compiler during all build types.
+CMAKE_CXX_FLAGS:STRING=
+
+//Flags used by the CXX compiler during DEBUG builds.
+CMAKE_CXX_FLAGS_DEBUG:STRING=
+
+//Flags used by the CXX compiler during MINSIZEREL builds.
+CMAKE_CXX_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the CXX compiler during RELEASE builds.
+CMAKE_CXX_FLAGS_RELEASE:STRING=
+
+//Flags used by the CXX compiler during RELWITHDEBINFO builds.
+CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=
+
+//C compiler
+CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc
+
+//A wrapper around 'ar' adding the appropriate '--plugin' option
+// for the GCC compiler
+CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9
+
+//A wrapper around 'ranlib' adding the appropriate '--plugin' option
+// for the GCC compiler
+CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9
+
+//Flags used by the C compiler during all build types.
+CMAKE_C_FLAGS:STRING=
+
+//Flags used by the C compiler during DEBUG builds.
+CMAKE_C_FLAGS_DEBUG:STRING=-g
+
+//Flags used by the C compiler during MINSIZEREL builds.
+CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
+
+//Flags used by the C compiler during RELEASE builds.
+CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
+
+//Flags used by the C compiler during RELWITHDEBINFO builds.
+CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
+
+//Path to a program.
+CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
+
+//Flags used by the linker during all build types.
+CMAKE_EXE_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during DEBUG builds.
+CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during MINSIZEREL builds.
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during RELEASE builds.
+CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during RELWITHDEBINFO builds.
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Enable/Disable output of compile commands during generation.
+CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF
+
+//Install path prefix, prepended onto install directories.
+CMAKE_INSTALL_PREFIX:PATH=/usr/local
+
+//Path to a program.
+CMAKE_LINKER:FILEPATH=/usr/bin/ld
+
+//Path to a program.
+CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make
+
+//Flags used by the linker during the creation of modules during
+// all build types.
+CMAKE_MODULE_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during the creation of modules during
+// DEBUG builds.
+CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during the creation of modules during
+// MINSIZEREL builds.
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during the creation of modules during
+// RELEASE builds.
+CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during the creation of modules during
+// RELWITHDEBINFO builds.
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Path to a program.
+CMAKE_NM:FILEPATH=/usr/bin/nm
+
+//Path to a program.
+CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
+
+//Path to a program.
+CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
+
+//Value Computed by CMake
+CMAKE_PROJECT_DESCRIPTION:STATIC=
+
+//Value Computed by CMake
+CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
+
+//Value Computed by CMake
+CMAKE_PROJECT_NAME:STATIC=Project
+
+//Path to a program.
+CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
+
+//Path to a program.
+CMAKE_READELF:FILEPATH=/usr/bin/readelf
+
+//Flags used by the linker during the creation of shared libraries
+// during all build types.
+CMAKE_SHARED_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during the creation of shared libraries
+// during DEBUG builds.
+CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during the creation of shared libraries
+// during MINSIZEREL builds.
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during the creation of shared libraries
+// during RELEASE builds.
+CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during the creation of shared libraries
+// during RELWITHDEBINFO builds.
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//If set, runtime paths are not added when installing shared libraries,
+// but are added when building.
+CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
+
+//If set, runtime paths are not added when using shared libraries.
+CMAKE_SKIP_RPATH:BOOL=NO
+
+//Flags used by the linker during the creation of static libraries
+// during all build types.
+CMAKE_STATIC_LINKER_FLAGS:STRING=
+
+//Flags used by the linker during the creation of static libraries
+// during DEBUG builds.
+CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
+
+//Flags used by the linker during the creation of static libraries
+// during MINSIZEREL builds.
+CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
+
+//Flags used by the linker during the creation of static libraries
+// during RELEASE builds.
+CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
+
+//Flags used by the linker during the creation of static libraries
+// during RELWITHDEBINFO builds.
+CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
+
+//Path to a program.
+CMAKE_STRIP:FILEPATH=/usr/bin/strip
+
+//If this value is on, makefiles will be generated without the
+// .SILENT directive, and all commands will be echoed to the console
+// during the make. This is useful for debugging only. With Visual
+// Studio IDE projects all commands are done without /nologo.
+CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
+
+//Single output directory for building all executables.
+EXECUTABLE_OUTPUT_PATH:PATH=
+
+//Single output directory for building all libraries.
+LIBRARY_OUTPUT_PATH:PATH=
+
+//Value Computed by CMake
+Project_BINARY_DIR:STATIC=/home/ethomson/libgit2/libgit2/src/util
+
+//Value Computed by CMake
+Project_SOURCE_DIR:STATIC=/home/ethomson/libgit2/libgit2/src
+
+
+########################
+# INTERNAL cache entries
+########################
+
+//ADVANCED property for variable: CMAKE_ADDR2LINE
+CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_AR
+CMAKE_AR-ADVANCED:INTERNAL=1
+//This is the directory where this CMakeCache.txt was created
+CMAKE_CACHEFILE_DIR:INTERNAL=/home/ethomson/libgit2/libgit2/src/util
+//Major version of cmake used to create the current loaded cache
+CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
+//Minor version of cmake used to create the current loaded cache
+CMAKE_CACHE_MINOR_VERSION:INTERNAL=16
+//Patch version of cmake used to create the current loaded cache
+CMAKE_CACHE_PATCH_VERSION:INTERNAL=3
+//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
+CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
+//Path to CMake executable.
+CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
+//Path to cpack program executable.
+CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
+//Path to ctest program executable.
+CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
+//ADVANCED property for variable: CMAKE_CXX_COMPILER
+CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS
+CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
+CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
+CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
+CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
+CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_COMPILER
+CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_COMPILER_AR
+CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
+CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS
+CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
+CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
+CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
+CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
+CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_DLLTOOL
+CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
+//Executable file format
+CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
+CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
+CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
+CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
+CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
+CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
+//Name of external makefile project generator.
+CMAKE_EXTRA_GENERATOR:INTERNAL=
+//Name of generator.
+CMAKE_GENERATOR:INTERNAL=Unix Makefiles
+//Generator instance identifier.
+CMAKE_GENERATOR_INSTANCE:INTERNAL=
+//Name of generator platform.
+CMAKE_GENERATOR_PLATFORM:INTERNAL=
+//Name of generator toolset.
+CMAKE_GENERATOR_TOOLSET:INTERNAL=
+//Source directory with the top level CMakeLists.txt file for this
+// project
+CMAKE_HOME_DIRECTORY:INTERNAL=/home/ethomson/libgit2/libgit2/src
+//Install .so files without execute permission.
+CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
+//ADVANCED property for variable: CMAKE_LINKER
+CMAKE_LINKER-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
+CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
+CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
+CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
+CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
+CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_NM
+CMAKE_NM-ADVANCED:INTERNAL=1
+//number of local generators
+CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
+//ADVANCED property for variable: CMAKE_OBJCOPY
+CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_OBJDUMP
+CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
+//Platform information initialized
+CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_RANLIB
+CMAKE_RANLIB-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_READELF
+CMAKE_READELF-ADVANCED:INTERNAL=1
+//Path to CMake installation.
+CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.16
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
+CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
+CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
+CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
+CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
+CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_SKIP_RPATH
+CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
+CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
+CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
+CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
+CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
+CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
+//ADVANCED property for variable: CMAKE_STRIP
+CMAKE_STRIP-ADVANCED:INTERNAL=1
+//uname command
+CMAKE_UNAME:INTERNAL=/usr/bin/uname
+//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
+CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
+
diff --git a/src/util/CMakeFiles/3.16.3/CMakeCCompiler.cmake b/src/util/CMakeFiles/3.16.3/CMakeCCompiler.cmake
new file mode 100644
index 000000000..2692f7332
--- /dev/null
+++ b/src/util/CMakeFiles/3.16.3/CMakeCCompiler.cmake
@@ -0,0 +1,76 @@
+set(CMAKE_C_COMPILER "/usr/bin/cc")
+set(CMAKE_C_COMPILER_ARG1 "")
+set(CMAKE_C_COMPILER_ID "GNU")
+set(CMAKE_C_COMPILER_VERSION "9.3.0")
+set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
+set(CMAKE_C_COMPILER_WRAPPER "")
+set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
+set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
+set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
+set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
+set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
+
+set(CMAKE_C_PLATFORM_ID "Linux")
+set(CMAKE_C_SIMULATE_ID "")
+set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
+set(CMAKE_C_SIMULATE_VERSION "")
+
+
+
+set(CMAKE_AR "/usr/bin/ar")
+set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-9")
+set(CMAKE_RANLIB "/usr/bin/ranlib")
+set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9")
+set(CMAKE_LINKER "/usr/bin/ld")
+set(CMAKE_MT "")
+set(CMAKE_COMPILER_IS_GNUCC 1)
+set(CMAKE_C_COMPILER_LOADED 1)
+set(CMAKE_C_COMPILER_WORKS TRUE)
+set(CMAKE_C_ABI_COMPILED TRUE)
+set(CMAKE_COMPILER_IS_MINGW )
+set(CMAKE_COMPILER_IS_CYGWIN )
+if(CMAKE_COMPILER_IS_CYGWIN)
+ set(CYGWIN 1)
+ set(UNIX 1)
+endif()
+
+set(CMAKE_C_COMPILER_ENV_VAR "CC")
+
+if(CMAKE_COMPILER_IS_MINGW)
+ set(MINGW 1)
+endif()
+set(CMAKE_C_COMPILER_ID_RUN 1)
+set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
+set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
+set(CMAKE_C_LINKER_PREFERENCE 10)
+
+# Save compiler ABI information.
+set(CMAKE_C_SIZEOF_DATA_PTR "8")
+set(CMAKE_C_COMPILER_ABI "ELF")
+set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
+
+if(CMAKE_C_SIZEOF_DATA_PTR)
+ set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
+endif()
+
+if(CMAKE_C_COMPILER_ABI)
+ set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
+endif()
+
+if(CMAKE_C_LIBRARY_ARCHITECTURE)
+ set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
+endif()
+
+set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
+if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
+ set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
+endif()
+
+
+
+
+
+set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include")
+set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
+set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
+set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
diff --git a/src/util/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin b/src/util/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin
new file mode 100755
index 000000000..43681c879
--- /dev/null
+++ b/src/util/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin
Binary files differ
diff --git a/src/util/CMakeFiles/3.16.3/CMakeSystem.cmake b/src/util/CMakeFiles/3.16.3/CMakeSystem.cmake
new file mode 100644
index 000000000..3895bf8de
--- /dev/null
+++ b/src/util/CMakeFiles/3.16.3/CMakeSystem.cmake
@@ -0,0 +1,15 @@
+set(CMAKE_HOST_SYSTEM "Linux-5.4.0-28-generic")
+set(CMAKE_HOST_SYSTEM_NAME "Linux")
+set(CMAKE_HOST_SYSTEM_VERSION "5.4.0-28-generic")
+set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
+
+
+
+set(CMAKE_SYSTEM "Linux-5.4.0-28-generic")
+set(CMAKE_SYSTEM_NAME "Linux")
+set(CMAKE_SYSTEM_VERSION "5.4.0-28-generic")
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+
+set(CMAKE_CROSSCOMPILING "FALSE")
+
+set(CMAKE_SYSTEM_LOADED 1)
diff --git a/src/util/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c b/src/util/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c
new file mode 100644
index 000000000..d884b5090
--- /dev/null
+++ b/src/util/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c
@@ -0,0 +1,671 @@
+#ifdef __cplusplus
+# error "A C++ compiler has been selected for C."
+#endif
+
+#if defined(__18CXX)
+# define ID_VOID_MAIN
+#endif
+#if defined(__CLASSIC_C__)
+/* cv-qualifiers did not exist in K&R C */
+# define const
+# define volatile
+#endif
+
+
+/* Version number components: V=Version, R=Revision, P=Patch
+ Version date components: YYYY=Year, MM=Month, DD=Day */
+
+#if defined(__INTEL_COMPILER) || defined(__ICC)
+# define COMPILER_ID "Intel"
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+# endif
+# if defined(__GNUC__)
+# define SIMULATE_ID "GNU"
+# endif
+ /* __INTEL_COMPILER = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# else
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+ /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+# if defined(__GNUC__)
+# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
+# elif defined(__GNUG__)
+# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
+# endif
+# if defined(__GNUC_MINOR__)
+# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif
+
+#elif defined(__PATHCC__)
+# define COMPILER_ID "PathScale"
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif
+
+#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
+# define COMPILER_ID "Embarcadero"
+# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
+
+#elif defined(__BORLANDC__)
+# define COMPILER_ID "Borland"
+ /* __BORLANDC__ = 0xVRR */
+# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
+
+#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
+# define COMPILER_ID "Watcom"
+ /* __WATCOMC__ = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__WATCOMC__)
+# define COMPILER_ID "OpenWatcom"
+ /* __WATCOMC__ = VVRP + 1100 */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__SUNPRO_C)
+# define COMPILER_ID "SunPro"
+# if __SUNPRO_C >= 0x5100
+ /* __SUNPRO_C = 0xVRRP */
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
+# else
+ /* __SUNPRO_CC = 0xVRP */
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
+# endif
+
+#elif defined(__HP_cc)
+# define COMPILER_ID "HP"
+ /* __HP_cc = VVRRPP */
+# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
+# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
+# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
+
+#elif defined(__DECC)
+# define COMPILER_ID "Compaq"
+ /* __DECC_VER = VVRRTPPPP */
+# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
+# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
+# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
+
+#elif defined(__IBMC__) && defined(__COMPILER_VER__)
+# define COMPILER_ID "zOS"
+ /* __IBMC__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
+
+#elif defined(__ibmxl__) && defined(__clang__)
+# define COMPILER_ID "XLClang"
+# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
+# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
+# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
+# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
+
+
+#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
+# define COMPILER_ID "XL"
+ /* __IBMC__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
+
+#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
+# define COMPILER_ID "VisualAge"
+ /* __IBMC__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
+
+#elif defined(__PGI)
+# define COMPILER_ID "PGI"
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
+
+#elif defined(_CRAYC)
+# define COMPILER_ID "Cray"
+# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
+# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
+
+#elif defined(__TI_COMPILER_VERSION__)
+# define COMPILER_ID "TI"
+ /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
+# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
+# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
+# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
+
+#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
+# define COMPILER_ID "Fujitsu"
+
+#elif defined(__ghs__)
+# define COMPILER_ID "GHS"
+/* __GHS_VERSION_NUMBER = VVVVRP */
+# ifdef __GHS_VERSION_NUMBER
+# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
+# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
+# endif
+
+#elif defined(__TINYC__)
+# define COMPILER_ID "TinyCC"
+
+#elif defined(__BCC__)
+# define COMPILER_ID "Bruce"
+
+#elif defined(__SCO_VERSION__)
+# define COMPILER_ID "SCO"
+
+#elif defined(__ARMCC_VERSION) && !defined(__clang__)
+# define COMPILER_ID "ARMCC"
+#if __ARMCC_VERSION >= 1000000
+ /* __ARMCC_VERSION = VRRPPPP */
+ # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
+ # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
+ # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
+#else
+ /* __ARMCC_VERSION = VRPPPP */
+ # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
+ # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
+ # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
+#endif
+
+
+#elif defined(__clang__) && defined(__apple_build_version__)
+# define COMPILER_ID "AppleClang"
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
+
+#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
+# define COMPILER_ID "ARMClang"
+ # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
+ # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
+ # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
+# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
+
+#elif defined(__clang__)
+# define COMPILER_ID "Clang"
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+
+#elif defined(__GNUC__)
+# define COMPILER_ID "GNU"
+# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
+# if defined(__GNUC_MINOR__)
+# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif
+
+#elif defined(_MSC_VER)
+# define COMPILER_ID "MSVC"
+ /* _MSC_VER = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+# if _MSC_VER >= 1400
+ /* _MSC_FULL_VER = VVRRPPPPP */
+# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+# else
+ /* _MSC_FULL_VER = VVRRPPPP */
+# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+# endif
+# endif
+# if defined(_MSC_BUILD)
+# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+# endif
+
+#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
+# define COMPILER_ID "ADSP"
+#if defined(__VISUALDSPVERSION__)
+ /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
+# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
+# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
+#endif
+
+#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
+# define COMPILER_ID "IAR"
+# if defined(__VER__) && defined(__ICCARM__)
+# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
+# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
+# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
+# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
+# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__))
+# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
+# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
+# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
+# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
+# endif
+
+#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
+# define COMPILER_ID "SDCC"
+# if defined(__SDCC_VERSION_MAJOR)
+# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
+# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
+# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
+# else
+ /* SDCC = VRP */
+# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
+# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
+# endif
+
+
+/* These compilers are either not known or too old to define an
+ identification macro. Try to identify the platform and guess that
+ it is the native compiler. */
+#elif defined(__hpux) || defined(__hpua)
+# define COMPILER_ID "HP"
+
+#else /* unknown compiler */
+# define COMPILER_ID ""
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
+
+#ifdef __QNXNTO__
+char const* qnxnto = "INFO" ":" "qnxnto[]";
+#endif
+
+#if defined(__CRAYXE) || defined(__CRAYXC)
+char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
+#endif
+
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
+/* Identify known platforms by name. */
+#if defined(__linux) || defined(__linux__) || defined(linux)
+# define PLATFORM_ID "Linux"
+
+#elif defined(__CYGWIN__)
+# define PLATFORM_ID "Cygwin"
+
+#elif defined(__MINGW32__)
+# define PLATFORM_ID "MinGW"
+
+#elif defined(__APPLE__)
+# define PLATFORM_ID "Darwin"
+
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define PLATFORM_ID "Windows"
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD)
+# define PLATFORM_ID "FreeBSD"
+
+#elif defined(__NetBSD__) || defined(__NetBSD)
+# define PLATFORM_ID "NetBSD"
+
+#elif defined(__OpenBSD__) || defined(__OPENBSD)
+# define PLATFORM_ID "OpenBSD"
+
+#elif defined(__sun) || defined(sun)
+# define PLATFORM_ID "SunOS"
+
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+# define PLATFORM_ID "AIX"
+
+#elif defined(__hpux) || defined(__hpux__)
+# define PLATFORM_ID "HP-UX"
+
+#elif defined(__HAIKU__)
+# define PLATFORM_ID "Haiku"
+
+#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
+# define PLATFORM_ID "BeOS"
+
+#elif defined(__QNX__) || defined(__QNXNTO__)
+# define PLATFORM_ID "QNX"
+
+#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
+# define PLATFORM_ID "Tru64"
+
+#elif defined(__riscos) || defined(__riscos__)
+# define PLATFORM_ID "RISCos"
+
+#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
+# define PLATFORM_ID "SINIX"
+
+#elif defined(__UNIX_SV__)
+# define PLATFORM_ID "UNIX_SV"
+
+#elif defined(__bsdos__)
+# define PLATFORM_ID "BSDOS"
+
+#elif defined(_MPRAS) || defined(MPRAS)
+# define PLATFORM_ID "MP-RAS"
+
+#elif defined(__osf) || defined(__osf__)
+# define PLATFORM_ID "OSF1"
+
+#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
+# define PLATFORM_ID "SCO_SV"
+
+#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
+# define PLATFORM_ID "ULTRIX"
+
+#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
+# define PLATFORM_ID "Xenix"
+
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+# define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+# define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+# define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+# define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+# define PLATFORM_ID
+# endif
+
+#elif defined(__INTEGRITY)
+# if defined(INT_178B)
+# define PLATFORM_ID "Integrity178"
+
+# else /* regular Integrity */
+# define PLATFORM_ID "Integrity"
+# endif
+
+#else /* unknown platform */
+# define PLATFORM_ID
+
+#endif
+
+/* For windows compilers MSVC and Intel we can determine
+ the architecture of the compiler being used. This is because
+ the compilers do not have flags that can change the architecture,
+ but rather depend on which compiler is being used
+*/
+#if defined(_WIN32) && defined(_MSC_VER)
+# if defined(_M_IA64)
+# define ARCHITECTURE_ID "IA64"
+
+# elif defined(_M_X64) || defined(_M_AMD64)
+# define ARCHITECTURE_ID "x64"
+
+# elif defined(_M_IX86)
+# define ARCHITECTURE_ID "X86"
+
+# elif defined(_M_ARM64)
+# define ARCHITECTURE_ID "ARM64"
+
+# elif defined(_M_ARM)
+# if _M_ARM == 4
+# define ARCHITECTURE_ID "ARMV4I"
+# elif _M_ARM == 5
+# define ARCHITECTURE_ID "ARMV5I"
+# else
+# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
+# endif
+
+# elif defined(_M_MIPS)
+# define ARCHITECTURE_ID "MIPS"
+
+# elif defined(_M_SH)
+# define ARCHITECTURE_ID "SHx"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+# define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+# define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
+# if defined(__ICCARM__)
+# define ARCHITECTURE_ID "ARM"
+
+# elif defined(__ICCRX__)
+# define ARCHITECTURE_ID "RX"
+
+# elif defined(__ICCRH850__)
+# define ARCHITECTURE_ID "RH850"
+
+# elif defined(__ICCRL78__)
+# define ARCHITECTURE_ID "RL78"
+
+# elif defined(__ICCRISCV__)
+# define ARCHITECTURE_ID "RISCV"
+
+# elif defined(__ICCAVR__)
+# define ARCHITECTURE_ID "AVR"
+
+# elif defined(__ICC430__)
+# define ARCHITECTURE_ID "MSP430"
+
+# elif defined(__ICCV850__)
+# define ARCHITECTURE_ID "V850"
+
+# elif defined(__ICC8051__)
+# define ARCHITECTURE_ID "8051"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__ghs__)
+# if defined(__PPC64__)
+# define ARCHITECTURE_ID "PPC64"
+
+# elif defined(__ppc__)
+# define ARCHITECTURE_ID "PPC"
+
+# elif defined(__ARM__)
+# define ARCHITECTURE_ID "ARM"
+
+# elif defined(__x86_64__)
+# define ARCHITECTURE_ID "x64"
+
+# elif defined(__i386__)
+# define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+#else
+# define ARCHITECTURE_ID
+#endif
+
+/* Convert integer to decimal digit literals. */
+#define DEC(n) \
+ ('0' + (((n) / 10000000)%10)), \
+ ('0' + (((n) / 1000000)%10)), \
+ ('0' + (((n) / 100000)%10)), \
+ ('0' + (((n) / 10000)%10)), \
+ ('0' + (((n) / 1000)%10)), \
+ ('0' + (((n) / 100)%10)), \
+ ('0' + (((n) / 10)%10)), \
+ ('0' + ((n) % 10))
+
+/* Convert integer to hex digit literals. */
+#define HEX(n) \
+ ('0' + ((n)>>28 & 0xF)), \
+ ('0' + ((n)>>24 & 0xF)), \
+ ('0' + ((n)>>20 & 0xF)), \
+ ('0' + ((n)>>16 & 0xF)), \
+ ('0' + ((n)>>12 & 0xF)), \
+ ('0' + ((n)>>8 & 0xF)), \
+ ('0' + ((n)>>4 & 0xF)), \
+ ('0' + ((n) & 0xF))
+
+/* Construct a string literal encoding the version number components. */
+#ifdef COMPILER_VERSION_MAJOR
+char const info_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
+ COMPILER_VERSION_MAJOR,
+# ifdef COMPILER_VERSION_MINOR
+ '.', COMPILER_VERSION_MINOR,
+# ifdef COMPILER_VERSION_PATCH
+ '.', COMPILER_VERSION_PATCH,
+# ifdef COMPILER_VERSION_TWEAK
+ '.', COMPILER_VERSION_TWEAK,
+# endif
+# endif
+# endif
+ ']','\0'};
+#endif
+
+/* Construct a string literal encoding the internal version number. */
+#ifdef COMPILER_VERSION_INTERNAL
+char const info_version_internal[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
+ 'i','n','t','e','r','n','a','l','[',
+ COMPILER_VERSION_INTERNAL,']','\0'};
+#endif
+
+/* Construct a string literal encoding the version number components. */
+#ifdef SIMULATE_VERSION_MAJOR
+char const info_simulate_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
+ SIMULATE_VERSION_MAJOR,
+# ifdef SIMULATE_VERSION_MINOR
+ '.', SIMULATE_VERSION_MINOR,
+# ifdef SIMULATE_VERSION_PATCH
+ '.', SIMULATE_VERSION_PATCH,
+# ifdef SIMULATE_VERSION_TWEAK
+ '.', SIMULATE_VERSION_TWEAK,
+# endif
+# endif
+# endif
+ ']','\0'};
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
+char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
+
+
+
+
+#if !defined(__STDC__)
+# if (defined(_MSC_VER) && !defined(__clang__)) \
+ || (defined(__ibmxl__) || defined(__IBMC__))
+# define C_DIALECT "90"
+# else
+# define C_DIALECT
+# endif
+#elif __STDC_VERSION__ >= 201000L
+# define C_DIALECT "11"
+#elif __STDC_VERSION__ >= 199901L
+# define C_DIALECT "99"
+#else
+# define C_DIALECT "90"
+#endif
+const char* info_language_dialect_default =
+ "INFO" ":" "dialect_default[" C_DIALECT "]";
+
+/*--------------------------------------------------------------------------*/
+
+#ifdef ID_VOID_MAIN
+void main() {}
+#else
+# if defined(__CLASSIC_C__)
+int main(argc, argv) int argc; char *argv[];
+# else
+int main(int argc, char* argv[])
+# endif
+{
+ int require = 0;
+ require += info_compiler[argc];
+ require += info_platform[argc];
+ require += info_arch[argc];
+#ifdef COMPILER_VERSION_MAJOR
+ require += info_version[argc];
+#endif
+#ifdef COMPILER_VERSION_INTERNAL
+ require += info_version_internal[argc];
+#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
+#if defined(__CRAYXE) || defined(__CRAYXC)
+ require += info_cray[argc];
+#endif
+ require += info_language_dialect_default[argc];
+ (void)argv;
+ return require;
+}
+#endif
diff --git a/src/util/CMakeFiles/3.16.3/CompilerIdC/a.out b/src/util/CMakeFiles/3.16.3/CompilerIdC/a.out
new file mode 100755
index 000000000..f6a721812
--- /dev/null
+++ b/src/util/CMakeFiles/3.16.3/CompilerIdC/a.out
Binary files differ
diff --git a/src/util/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/src/util/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp
new file mode 100644
index 000000000..69cfdba6b
--- /dev/null
+++ b/src/util/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp
@@ -0,0 +1,660 @@
+/* This source file must have a .cpp extension so that all C++ compilers
+ recognize the extension without flags. Borland does not know .cxx for
+ example. */
+#ifndef __cplusplus
+# error "A C compiler has been selected for C++."
+#endif
+
+
+/* Version number components: V=Version, R=Revision, P=Patch
+ Version date components: YYYY=Year, MM=Month, DD=Day */
+
+#if defined(__COMO__)
+# define COMPILER_ID "Comeau"
+ /* __COMO_VERSION__ = VRR */
+# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
+# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
+
+#elif defined(__INTEL_COMPILER) || defined(__ICC)
+# define COMPILER_ID "Intel"
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+# endif
+# if defined(__GNUC__)
+# define SIMULATE_ID "GNU"
+# endif
+ /* __INTEL_COMPILER = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
+# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# if defined(__INTEL_COMPILER_UPDATE)
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+# else
+# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
+# endif
+# if defined(__INTEL_COMPILER_BUILD_DATE)
+ /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
+# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+# endif
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+# if defined(__GNUC__)
+# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
+# elif defined(__GNUG__)
+# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
+# endif
+# if defined(__GNUC_MINOR__)
+# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif
+
+#elif defined(__PATHCC__)
+# define COMPILER_ID "PathScale"
+# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
+# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# if defined(__PATHCC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+# endif
+
+#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
+# define COMPILER_ID "Embarcadero"
+# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
+
+#elif defined(__BORLANDC__)
+# define COMPILER_ID "Borland"
+ /* __BORLANDC__ = 0xVRR */
+# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
+# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
+
+#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
+# define COMPILER_ID "Watcom"
+ /* __WATCOMC__ = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__WATCOMC__)
+# define COMPILER_ID "OpenWatcom"
+ /* __WATCOMC__ = VVRP + 1100 */
+# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
+
+#elif defined(__SUNPRO_CC)
+# define COMPILER_ID "SunPro"
+# if __SUNPRO_CC >= 0x5100
+ /* __SUNPRO_CC = 0xVRRP */
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
+# else
+ /* __SUNPRO_CC = 0xVRP */
+# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
+# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
+# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
+# endif
+
+#elif defined(__HP_aCC)
+# define COMPILER_ID "HP"
+ /* __HP_aCC = VVRRPP */
+# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
+# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
+# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
+
+#elif defined(__DECCXX)
+# define COMPILER_ID "Compaq"
+ /* __DECCXX_VER = VVRRTPPPP */
+# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
+# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
+# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
+
+#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
+# define COMPILER_ID "zOS"
+ /* __IBMCPP__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
+
+#elif defined(__ibmxl__) && defined(__clang__)
+# define COMPILER_ID "XLClang"
+# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
+# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
+# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
+# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
+
+
+#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
+# define COMPILER_ID "XL"
+ /* __IBMCPP__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
+
+#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
+# define COMPILER_ID "VisualAge"
+ /* __IBMCPP__ = VRP */
+# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
+# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
+
+#elif defined(__PGI)
+# define COMPILER_ID "PGI"
+# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
+# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# if defined(__PGIC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+# endif
+
+#elif defined(_CRAYC)
+# define COMPILER_ID "Cray"
+# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
+# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
+
+#elif defined(__TI_COMPILER_VERSION__)
+# define COMPILER_ID "TI"
+ /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
+# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
+# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
+# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
+
+#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
+# define COMPILER_ID "Fujitsu"
+
+#elif defined(__ghs__)
+# define COMPILER_ID "GHS"
+/* __GHS_VERSION_NUMBER = VVVVRP */
+# ifdef __GHS_VERSION_NUMBER
+# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
+# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
+# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
+# endif
+
+#elif defined(__SCO_VERSION__)
+# define COMPILER_ID "SCO"
+
+#elif defined(__ARMCC_VERSION) && !defined(__clang__)
+# define COMPILER_ID "ARMCC"
+#if __ARMCC_VERSION >= 1000000
+ /* __ARMCC_VERSION = VRRPPPP */
+ # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
+ # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
+ # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
+#else
+ /* __ARMCC_VERSION = VRPPPP */
+ # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
+ # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
+ # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
+#endif
+
+
+#elif defined(__clang__) && defined(__apple_build_version__)
+# define COMPILER_ID "AppleClang"
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
+
+#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
+# define COMPILER_ID "ARMClang"
+ # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
+ # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
+ # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
+# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
+
+#elif defined(__clang__)
+# define COMPILER_ID "Clang"
+# if defined(_MSC_VER)
+# define SIMULATE_ID "MSVC"
+# endif
+# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
+# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
+# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# if defined(_MSC_VER)
+ /* _MSC_VER = VVRR */
+# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+# endif
+
+#elif defined(__GNUC__) || defined(__GNUG__)
+# define COMPILER_ID "GNU"
+# if defined(__GNUC__)
+# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
+# else
+# define COMPILER_VERSION_MAJOR DEC(__GNUG__)
+# endif
+# if defined(__GNUC_MINOR__)
+# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# endif
+# if defined(__GNUC_PATCHLEVEL__)
+# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+# endif
+
+#elif defined(_MSC_VER)
+# define COMPILER_ID "MSVC"
+ /* _MSC_VER = VVRR */
+# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
+# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# if defined(_MSC_FULL_VER)
+# if _MSC_VER >= 1400
+ /* _MSC_FULL_VER = VVRRPPPPP */
+# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+# else
+ /* _MSC_FULL_VER = VVRRPPPP */
+# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+# endif
+# endif
+# if defined(_MSC_BUILD)
+# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+# endif
+
+#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
+# define COMPILER_ID "ADSP"
+#if defined(__VISUALDSPVERSION__)
+ /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
+# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
+# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
+# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
+#endif
+
+#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
+# define COMPILER_ID "IAR"
+# if defined(__VER__) && defined(__ICCARM__)
+# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
+# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
+# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
+# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
+# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__))
+# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
+# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
+# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
+# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
+# endif
+
+
+/* These compilers are either not known or too old to define an
+ identification macro. Try to identify the platform and guess that
+ it is the native compiler. */
+#elif defined(__hpux) || defined(__hpua)
+# define COMPILER_ID "HP"
+
+#else /* unknown compiler */
+# define COMPILER_ID ""
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
+#ifdef SIMULATE_ID
+char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
+#endif
+
+#ifdef __QNXNTO__
+char const* qnxnto = "INFO" ":" "qnxnto[]";
+#endif
+
+#if defined(__CRAYXE) || defined(__CRAYXC)
+char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
+#endif
+
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
+/* Identify known platforms by name. */
+#if defined(__linux) || defined(__linux__) || defined(linux)
+# define PLATFORM_ID "Linux"
+
+#elif defined(__CYGWIN__)
+# define PLATFORM_ID "Cygwin"
+
+#elif defined(__MINGW32__)
+# define PLATFORM_ID "MinGW"
+
+#elif defined(__APPLE__)
+# define PLATFORM_ID "Darwin"
+
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+# define PLATFORM_ID "Windows"
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD)
+# define PLATFORM_ID "FreeBSD"
+
+#elif defined(__NetBSD__) || defined(__NetBSD)
+# define PLATFORM_ID "NetBSD"
+
+#elif defined(__OpenBSD__) || defined(__OPENBSD)
+# define PLATFORM_ID "OpenBSD"
+
+#elif defined(__sun) || defined(sun)
+# define PLATFORM_ID "SunOS"
+
+#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
+# define PLATFORM_ID "AIX"
+
+#elif defined(__hpux) || defined(__hpux__)
+# define PLATFORM_ID "HP-UX"
+
+#elif defined(__HAIKU__)
+# define PLATFORM_ID "Haiku"
+
+#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
+# define PLATFORM_ID "BeOS"
+
+#elif defined(__QNX__) || defined(__QNXNTO__)
+# define PLATFORM_ID "QNX"
+
+#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
+# define PLATFORM_ID "Tru64"
+
+#elif defined(__riscos) || defined(__riscos__)
+# define PLATFORM_ID "RISCos"
+
+#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
+# define PLATFORM_ID "SINIX"
+
+#elif defined(__UNIX_SV__)
+# define PLATFORM_ID "UNIX_SV"
+
+#elif defined(__bsdos__)
+# define PLATFORM_ID "BSDOS"
+
+#elif defined(_MPRAS) || defined(MPRAS)
+# define PLATFORM_ID "MP-RAS"
+
+#elif defined(__osf) || defined(__osf__)
+# define PLATFORM_ID "OSF1"
+
+#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
+# define PLATFORM_ID "SCO_SV"
+
+#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
+# define PLATFORM_ID "ULTRIX"
+
+#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
+# define PLATFORM_ID "Xenix"
+
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+# define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+# define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+# define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+# define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+# define PLATFORM_ID
+# endif
+
+#elif defined(__INTEGRITY)
+# if defined(INT_178B)
+# define PLATFORM_ID "Integrity178"
+
+# else /* regular Integrity */
+# define PLATFORM_ID "Integrity"
+# endif
+
+#else /* unknown platform */
+# define PLATFORM_ID
+
+#endif
+
+/* For windows compilers MSVC and Intel we can determine
+ the architecture of the compiler being used. This is because
+ the compilers do not have flags that can change the architecture,
+ but rather depend on which compiler is being used
+*/
+#if defined(_WIN32) && defined(_MSC_VER)
+# if defined(_M_IA64)
+# define ARCHITECTURE_ID "IA64"
+
+# elif defined(_M_X64) || defined(_M_AMD64)
+# define ARCHITECTURE_ID "x64"
+
+# elif defined(_M_IX86)
+# define ARCHITECTURE_ID "X86"
+
+# elif defined(_M_ARM64)
+# define ARCHITECTURE_ID "ARM64"
+
+# elif defined(_M_ARM)
+# if _M_ARM == 4
+# define ARCHITECTURE_ID "ARMV4I"
+# elif _M_ARM == 5
+# define ARCHITECTURE_ID "ARMV5I"
+# else
+# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
+# endif
+
+# elif defined(_M_MIPS)
+# define ARCHITECTURE_ID "MIPS"
+
+# elif defined(_M_SH)
+# define ARCHITECTURE_ID "SHx"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+# define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+# define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
+# if defined(__ICCARM__)
+# define ARCHITECTURE_ID "ARM"
+
+# elif defined(__ICCRX__)
+# define ARCHITECTURE_ID "RX"
+
+# elif defined(__ICCRH850__)
+# define ARCHITECTURE_ID "RH850"
+
+# elif defined(__ICCRL78__)
+# define ARCHITECTURE_ID "RL78"
+
+# elif defined(__ICCRISCV__)
+# define ARCHITECTURE_ID "RISCV"
+
+# elif defined(__ICCAVR__)
+# define ARCHITECTURE_ID "AVR"
+
+# elif defined(__ICC430__)
+# define ARCHITECTURE_ID "MSP430"
+
+# elif defined(__ICCV850__)
+# define ARCHITECTURE_ID "V850"
+
+# elif defined(__ICC8051__)
+# define ARCHITECTURE_ID "8051"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+
+#elif defined(__ghs__)
+# if defined(__PPC64__)
+# define ARCHITECTURE_ID "PPC64"
+
+# elif defined(__ppc__)
+# define ARCHITECTURE_ID "PPC"
+
+# elif defined(__ARM__)
+# define ARCHITECTURE_ID "ARM"
+
+# elif defined(__x86_64__)
+# define ARCHITECTURE_ID "x64"
+
+# elif defined(__i386__)
+# define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+# define ARCHITECTURE_ID ""
+# endif
+#else
+# define ARCHITECTURE_ID
+#endif
+
+/* Convert integer to decimal digit literals. */
+#define DEC(n) \
+ ('0' + (((n) / 10000000)%10)), \
+ ('0' + (((n) / 1000000)%10)), \
+ ('0' + (((n) / 100000)%10)), \
+ ('0' + (((n) / 10000)%10)), \
+ ('0' + (((n) / 1000)%10)), \
+ ('0' + (((n) / 100)%10)), \
+ ('0' + (((n) / 10)%10)), \
+ ('0' + ((n) % 10))
+
+/* Convert integer to hex digit literals. */
+#define HEX(n) \
+ ('0' + ((n)>>28 & 0xF)), \
+ ('0' + ((n)>>24 & 0xF)), \
+ ('0' + ((n)>>20 & 0xF)), \
+ ('0' + ((n)>>16 & 0xF)), \
+ ('0' + ((n)>>12 & 0xF)), \
+ ('0' + ((n)>>8 & 0xF)), \
+ ('0' + ((n)>>4 & 0xF)), \
+ ('0' + ((n) & 0xF))
+
+/* Construct a string literal encoding the version number components. */
+#ifdef COMPILER_VERSION_MAJOR
+char const info_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
+ COMPILER_VERSION_MAJOR,
+# ifdef COMPILER_VERSION_MINOR
+ '.', COMPILER_VERSION_MINOR,
+# ifdef COMPILER_VERSION_PATCH
+ '.', COMPILER_VERSION_PATCH,
+# ifdef COMPILER_VERSION_TWEAK
+ '.', COMPILER_VERSION_TWEAK,
+# endif
+# endif
+# endif
+ ']','\0'};
+#endif
+
+/* Construct a string literal encoding the internal version number. */
+#ifdef COMPILER_VERSION_INTERNAL
+char const info_version_internal[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
+ 'i','n','t','e','r','n','a','l','[',
+ COMPILER_VERSION_INTERNAL,']','\0'};
+#endif
+
+/* Construct a string literal encoding the version number components. */
+#ifdef SIMULATE_VERSION_MAJOR
+char const info_simulate_version[] = {
+ 'I', 'N', 'F', 'O', ':',
+ 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
+ SIMULATE_VERSION_MAJOR,
+# ifdef SIMULATE_VERSION_MINOR
+ '.', SIMULATE_VERSION_MINOR,
+# ifdef SIMULATE_VERSION_PATCH
+ '.', SIMULATE_VERSION_PATCH,
+# ifdef SIMULATE_VERSION_TWEAK
+ '.', SIMULATE_VERSION_TWEAK,
+# endif
+# endif
+# endif
+ ']','\0'};
+#endif
+
+/* Construct the string literal in pieces to prevent the source from
+ getting matched. Store it in a pointer rather than an array
+ because some compilers will just produce instructions to fill the
+ array rather than assigning a pointer to a static array. */
+char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
+char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
+
+
+
+
+#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
+# if defined(__INTEL_CXX11_MODE__)
+# if defined(__cpp_aggregate_nsdmi)
+# define CXX_STD 201402L
+# else
+# define CXX_STD 201103L
+# endif
+# else
+# define CXX_STD 199711L
+# endif
+#elif defined(_MSC_VER) && defined(_MSVC_LANG)
+# define CXX_STD _MSVC_LANG
+#else
+# define CXX_STD __cplusplus
+#endif
+
+const char* info_language_dialect_default = "INFO" ":" "dialect_default["
+#if CXX_STD > 201703L
+ "20"
+#elif CXX_STD >= 201703L
+ "17"
+#elif CXX_STD >= 201402L
+ "14"
+#elif CXX_STD >= 201103L
+ "11"
+#else
+ "98"
+#endif
+"]";
+
+/*--------------------------------------------------------------------------*/
+
+int main(int argc, char* argv[])
+{
+ int require = 0;
+ require += info_compiler[argc];
+ require += info_platform[argc];
+#ifdef COMPILER_VERSION_MAJOR
+ require += info_version[argc];
+#endif
+#ifdef COMPILER_VERSION_INTERNAL
+ require += info_version_internal[argc];
+#endif
+#ifdef SIMULATE_ID
+ require += info_simulate[argc];
+#endif
+#ifdef SIMULATE_VERSION_MAJOR
+ require += info_simulate_version[argc];
+#endif
+#if defined(__CRAYXE) || defined(__CRAYXC)
+ require += info_cray[argc];
+#endif
+ require += info_language_dialect_default[argc];
+ (void)argv;
+ return require;
+}
diff --git a/src/util/CMakeFiles/CMakeError.log b/src/util/CMakeFiles/CMakeError.log
new file mode 100644
index 000000000..707ef686b
--- /dev/null
+++ b/src/util/CMakeFiles/CMakeError.log
@@ -0,0 +1,90 @@
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags:
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: -c
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: --c++
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: --ec++
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags:
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: -c
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: --c++
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: --ec++
+
+The output was:
+No such file or directory
+
+
+Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
+Compiler: CMAKE_CXX_COMPILER-NOTFOUND
+Build flags:
+Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3
+
+The output was:
+No such file or directory
+
+
diff --git a/src/util/CMakeFiles/CMakeOutput.log b/src/util/CMakeFiles/CMakeOutput.log
new file mode 100644
index 000000000..2d4e9dc0c
--- /dev/null
+++ b/src/util/CMakeFiles/CMakeOutput.log
@@ -0,0 +1,227 @@
+The system is: Linux - 5.4.0-28-generic - x86_64
+Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
+Compiler: /usr/bin/cc
+Build flags:
+Id flags:
+
+The output was:
+0
+
+
+Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
+
+The C compiler identification is GNU, found in "/home/ethomson/libgit2/libgit2/src/util/CMakeFiles/3.16.3/CompilerIdC/a.out"
+
+Determining if the C compiler works passed with the following output:
+Change Dir: /home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/make cmTC_64db5/fast && /usr/bin/make -f CMakeFiles/cmTC_64db5.dir/build.make CMakeFiles/cmTC_64db5.dir/build
+make[1]: Entering directory '/home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_64db5.dir/testCCompiler.c.o
+/usr/bin/cc -o CMakeFiles/cmTC_64db5.dir/testCCompiler.c.o -c /home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp/testCCompiler.c
+Linking C executable cmTC_64db5
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_64db5.dir/link.txt --verbose=1
+/usr/bin/cc -rdynamic CMakeFiles/cmTC_64db5.dir/testCCompiler.c.o -o cmTC_64db5
+make[1]: Leaving directory '/home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp'
+
+
+
+Detecting C compiler ABI info compiled with the following output:
+Change Dir: /home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp
+
+Run Build Command(s):/usr/bin/make cmTC_d201c/fast && /usr/bin/make -f CMakeFiles/cmTC_d201c.dir/build.make CMakeFiles/cmTC_d201c.dir/build
+make[1]: Entering directory '/home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp'
+Building C object CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o
+/usr/bin/cc -v -o CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c
+Using built-in specs.
+COLLECT_GCC=/usr/bin/cc
+OFFLOAD_TARGET_NAMES=nvptx-none:hsa
+OFFLOAD_TARGET_DEFAULT=1
+Target: x86_64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
+Thread model: posix
+gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
+COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
+ /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccX56TiX.s
+GNU C17 (Ubuntu 9.3.0-10ubuntu2) version 9.3.0 (x86_64-linux-gnu)
+ compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
+
+GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
+ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
+ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"
+ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"
+#include "..." search starts here:
+#include <...> search starts here:
+ /usr/lib/gcc/x86_64-linux-gnu/9/include
+ /usr/local/include
+ /usr/include/x86_64-linux-gnu
+ /usr/include
+End of search list.
+GNU C17 (Ubuntu 9.3.0-10ubuntu2) version 9.3.0 (x86_64-linux-gnu)
+ compiled by GNU C version 9.3.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
+
+GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
+Compiler executable checksum: 18dc4c39b54390aa2b5013fb4339d43f
+COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
+ as -v --64 -o CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o /tmp/ccX56TiX.s
+GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34
+COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
+LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
+COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'
+Linking C executable cmTC_d201c
+/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d201c.dir/link.txt --verbose=1
+/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -o cmTC_d201c
+Using built-in specs.
+COLLECT_GCC=/usr/bin/cc
+COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
+OFFLOAD_TARGET_NAMES=nvptx-none:hsa
+OFFLOAD_TARGET_DEFAULT=1
+Target: x86_64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
+Thread model: posix
+gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
+COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
+LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
+COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_d201c' '-mtune=generic' '-march=x86-64'
+ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cc5nXExn.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_d201c /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_d201c' '-mtune=generic' '-march=x86-64'
+make[1]: Leaving directory '/home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp'
+
+
+
+Parsed C implicit include dir info from above output: rv=done
+ found start of include info
+ found start of implicit include info
+ add: [/usr/lib/gcc/x86_64-linux-gnu/9/include]
+ add: [/usr/local/include]
+ add: [/usr/include/x86_64-linux-gnu]
+ add: [/usr/include]
+ end of search list found
+ collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/9/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/9/include]
+ collapse include dir [/usr/local/include] ==> [/usr/local/include]
+ collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu]
+ collapse include dir [/usr/include] ==> [/usr/include]
+ implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include]
+
+
+Parsed C implicit link information from above output:
+ link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
+ ignore line: [Change Dir: /home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp]
+ ignore line: []
+ ignore line: [Run Build Command(s):/usr/bin/make cmTC_d201c/fast && /usr/bin/make -f CMakeFiles/cmTC_d201c.dir/build.make CMakeFiles/cmTC_d201c.dir/build]
+ ignore line: [make[1]: Entering directory '/home/ethomson/libgit2/libgit2/src/util/CMakeFiles/CMakeTmp']
+ ignore line: [Building C object CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o]
+ ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c]
+ ignore line: [Using built-in specs.]
+ ignore line: [COLLECT_GCC=/usr/bin/cc]
+ ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa]
+ ignore line: [OFFLOAD_TARGET_DEFAULT=1]
+ ignore line: [Target: x86_64-linux-gnu]
+ ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
+ ignore line: [Thread model: posix]
+ ignore line: [gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) ]
+ ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
+ ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccX56TiX.s]
+ ignore line: [GNU C17 (Ubuntu 9.3.0-10ubuntu2) version 9.3.0 (x86_64-linux-gnu)]
+ ignore line: [ compiled by GNU C version 9.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP]
+ ignore line: []
+ ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
+ ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"]
+ ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"]
+ ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"]
+ ignore line: [#include "..." search starts here:]
+ ignore line: [#include <...> search starts here:]
+ ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/include]
+ ignore line: [ /usr/local/include]
+ ignore line: [ /usr/include/x86_64-linux-gnu]
+ ignore line: [ /usr/include]
+ ignore line: [End of search list.]
+ ignore line: [GNU C17 (Ubuntu 9.3.0-10ubuntu2) version 9.3.0 (x86_64-linux-gnu)]
+ ignore line: [ compiled by GNU C version 9.3.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP]
+ ignore line: []
+ ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
+ ignore line: [Compiler executable checksum: 18dc4c39b54390aa2b5013fb4339d43f]
+ ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
+ ignore line: [ as -v --64 -o CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o /tmp/ccX56TiX.s]
+ ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34]
+ ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/]
+ ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/]
+ ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64']
+ ignore line: [Linking C executable cmTC_d201c]
+ ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d201c.dir/link.txt --verbose=1]
+ ignore line: [/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -o cmTC_d201c ]
+ ignore line: [Using built-in specs.]
+ ignore line: [COLLECT_GCC=/usr/bin/cc]
+ ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper]
+ ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa]
+ ignore line: [OFFLOAD_TARGET_DEFAULT=1]
+ ignore line: [Target: x86_64-linux-gnu]
+ ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
+ ignore line: [Thread model: posix]
+ ignore line: [gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2) ]
+ ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/]
+ ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/]
+ ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_d201c' '-mtune=generic' '-march=x86-64']
+ link line: [ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cc5nXExn.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_d201c /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o]
+ arg [/usr/lib/gcc/x86_64-linux-gnu/9/collect2] ==> ignore
+ arg [-plugin] ==> ignore
+ arg [/usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so] ==> ignore
+ arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] ==> ignore
+ arg [-plugin-opt=-fresolution=/tmp/cc5nXExn.res] ==> ignore
+ arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
+ arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
+ arg [-plugin-opt=-pass-through=-lc] ==> ignore
+ arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
+ arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
+ arg [--build-id] ==> ignore
+ arg [--eh-frame-hdr] ==> ignore
+ arg [-m] ==> ignore
+ arg [elf_x86_64] ==> ignore
+ arg [--hash-style=gnu] ==> ignore
+ arg [--as-needed] ==> ignore
+ arg [-export-dynamic] ==> ignore
+ arg [-dynamic-linker] ==> ignore
+ arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
+ arg [-pie] ==> ignore
+ arg [-znow] ==> ignore
+ arg [-zrelro] ==> ignore
+ arg [-o] ==> ignore
+ arg [cmTC_d201c] ==> ignore
+ arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o] ==> ignore
+ arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o] ==> ignore
+ arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o] ==> ignore
+ arg [-L/usr/lib/gcc/x86_64-linux-gnu/9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9]
+ arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu]
+ arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib]
+ arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
+ arg [-L/lib/../lib] ==> dir [/lib/../lib]
+ arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
+ arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
+ arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..]
+ arg [CMakeFiles/cmTC_d201c.dir/CMakeCCompilerABI.c.o] ==> ignore
+ arg [-lgcc] ==> lib [gcc]
+ arg [--push-state] ==> ignore
+ arg [--as-needed] ==> ignore
+ arg [-lgcc_s] ==> lib [gcc_s]
+ arg [--pop-state] ==> ignore
+ arg [-lc] ==> lib [c]
+ arg [-lgcc] ==> lib [gcc]
+ arg [--push-state] ==> ignore
+ arg [--as-needed] ==> ignore
+ arg [-lgcc_s] ==> lib [gcc_s]
+ arg [--pop-state] ==> ignore
+ arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o] ==> ignore
+ arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] ==> ignore
+ collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9] ==> [/usr/lib/gcc/x86_64-linux-gnu/9]
+ collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
+ collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> [/usr/lib]
+ collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
+ collapse library dir [/lib/../lib] ==> [/lib]
+ collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
+ collapse library dir [/usr/lib/../lib] ==> [/usr/lib]
+ collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> [/usr/lib]
+ implicit libs: [gcc;gcc_s;c;gcc;gcc_s]
+ implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib]
+ implicit fwks: []
+
+
diff --git a/src/util/CMakeFiles/cmake.check_cache b/src/util/CMakeFiles/cmake.check_cache
new file mode 100644
index 000000000..3dccd7317
--- /dev/null
+++ b/src/util/CMakeFiles/cmake.check_cache
@@ -0,0 +1 @@
+# This file is generated by cmake for dependency checking of the CMakeCache.txt file
diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt
new file mode 100644
index 000000000..965fd4cb0
--- /dev/null
+++ b/src/util/CMakeLists.txt
@@ -0,0 +1,34 @@
+include(SelectHashes)
+
+list(APPEND UTIL_INCLUDES
+ "${COMMON_INCLUDES}"
+ "${libgit2_BINARY_DIR}/src"
+ "${libgit2_SOURCE_DIR}/src/util")
+
+# Collect sourcefiles
+file(GLOB SRC_UTIL_H
+ "${libgit2_SOURCE_DIR}/include/git2.h"
+ "${libgit2_SOURCE_DIR}/include/git2/*.h"
+ "${libgit2_SOURCE_DIR}/include/git2/sys/*.h")
+list(SORT SRC_UTIL_H)
+
+file(GLOB SRC_UTIL *.c *.h ${SRC_SHA1} allocators/*.c allocators/*.h)
+list(SORT SRC_UTIL)
+
+if(WIN32 AND NOT CYGWIN)
+ file(GLOB SRC_UTIL_OS win32/*.c win32/*.h)
+ list(SORT SRC_UTIL_OS)
+else()
+ file(GLOB SRC_UTIL_OS unix/*.c unix/*.h)
+ list(SORT SRC_UTIL_OS)
+endif()
+
+# Utility functions shared with other parts of the libgit2
+set(UTIL_SOURCES ${SRC_UTIL} ${SRC_UTIL_OS})
+add_library(util OBJECT ${UTIL_SOURCES})
+list(APPEND UTIL_OBJECTS ${COMMON_OBJECTS})
+list(APPEND UTIL_OBJECTS $<TARGET_OBJECTS:util>)
+
+target_include_directories(util PRIVATE ${UTIL_INCLUDES} PUBLIC ${libgit2_SOURCE_DIR}/include)
+target_include_directories(util SYSTEM PRIVATE ${UTIL_SYSTEM_INCLUDES})
+
diff --git a/src/libgit2/alloc.c b/src/util/alloc.c
index 51c4d8029..51c4d8029 100644
--- a/src/libgit2/alloc.c
+++ b/src/util/alloc.c
diff --git a/src/libgit2/alloc.h b/src/util/alloc.h
index 04fb7e101..d6a0fa38d 100644
--- a/src/libgit2/alloc.h
+++ b/src/util/alloc.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_alloc_h__
-#define INCLUDE_alloc_h__
+#ifndef INCLUDE_util_alloc_h__
+#define INCLUDE_util_alloc_h__
#include "git2/sys/alloc.h"
diff --git a/src/libgit2/allocators/stdalloc.c b/src/util/allocators/stdalloc.c
index c4938e32b..c4938e32b 100644
--- a/src/libgit2/allocators/stdalloc.c
+++ b/src/util/allocators/stdalloc.c
diff --git a/src/libgit2/allocators/stdalloc.h b/src/util/allocators/stdalloc.h
index fa23fe6e3..a1dd8c232 100644
--- a/src/libgit2/allocators/stdalloc.h
+++ b/src/util/allocators/stdalloc.h
@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_allocators_stdalloc_h__
-#define INCLUDE_allocators_stdalloc_h__
+#ifndef INCLUDE_util_allocators_stdalloc_h__
+#define INCLUDE_util_allocators_stdalloc_h__
-#include "common.h"
+#include "git2_util.h"
#include "alloc.h"
diff --git a/src/libgit2/allocators/win32_crtdbg.c b/src/util/allocators/win32_crtdbg.c
index 1187e2fcd..1187e2fcd 100644
--- a/src/libgit2/allocators/win32_crtdbg.c
+++ b/src/util/allocators/win32_crtdbg.c
diff --git a/src/libgit2/allocators/win32_crtdbg.h b/src/util/allocators/win32_crtdbg.h
index 754c6b6fb..a7c0fc20a 100644
--- a/src/libgit2/allocators/win32_crtdbg.h
+++ b/src/util/allocators/win32_crtdbg.h
@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_allocators_crtdbg_h
-#define INCLUDE_allocators_crtdbg_h
+#ifndef INCLUDE_util_allocators_crtdbg_h
+#define INCLUDE_util_allocators_crtdbg_h
-#include "common.h"
+#include "git2_util.h"
#include "alloc.h"
diff --git a/src/libgit2/array.h b/src/util/array.h
index 03537e796..03537e796 100644
--- a/src/libgit2/array.h
+++ b/src/util/array.h
diff --git a/src/libgit2/assert_safe.h b/src/util/assert_safe.h
index 8c261100f..8c261100f 100644
--- a/src/libgit2/assert_safe.h
+++ b/src/util/assert_safe.h
diff --git a/src/libgit2/buf_text.c b/src/util/buf_text.c
index b35ce278f..b35ce278f 100644
--- a/src/libgit2/buf_text.c
+++ b/src/util/buf_text.c
diff --git a/src/libgit2/buf_text.h b/src/util/buf_text.h
index b805dc624..c161f150d 100644
--- a/src/libgit2/buf_text.h
+++ b/src/util/buf_text.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_buf_text_h__
-#define INCLUDE_buf_text_h__
+#ifndef INCLUDE_util_buf_text_h__
+#define INCLUDE_util_buf_text_h__
-#include "common.h"
+#include "git2_util.h"
#include "buffer.h"
diff --git a/src/libgit2/buffer.c b/src/util/buffer.c
index e50b40977..e50b40977 100644
--- a/src/libgit2/buffer.c
+++ b/src/util/buffer.c
diff --git a/src/libgit2/buffer.h b/src/util/buffer.h
index c845c7de5..5c2d28c33 100644
--- a/src/libgit2/buffer.h
+++ b/src/util/buffer.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_buffer_h__
-#define INCLUDE_buffer_h__
+#ifndef INCLUDE_util_buffer_h__
+#define INCLUDE_util_buffer_h__
-#include "common.h"
+#include "git2_util.h"
#include "git2/strarray.h"
#include "git2/userbuf.h"
diff --git a/src/libgit2/cc-compat.h b/src/util/cc-compat.h
index 7ade561f3..b7cc43638 100644
--- a/src/libgit2/cc-compat.h
+++ b/src/util/cc-compat.h
@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_cc_compat_h__
-#define INCLUDE_cc_compat_h__
+#ifndef INCLUDE_util_cc_compat_h__
+#define INCLUDE_util_cc_compat_h__
#include <stdarg.h>
diff --git a/src/util/errors.h b/src/util/errors.h
new file mode 100644
index 000000000..9463e1c50
--- /dev/null
+++ b/src/util/errors.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#ifndef INCLUDE_util_errors_h__
+#define INCLUDE_util_errors_h__
+
+#include "git2_util.h"
+
+/**
+ * Set error message for user callback if needed.
+ *
+ * If the error code in non-zero and no error message is set, this
+ * sets a generic error message.
+ *
+ * @return This always returns the `error_code` parameter.
+ */
+GIT_INLINE(int) git_error_set_after_callback_function(
+ int error_code, const char *action)
+{
+ if (error_code) {
+ const git_error *e = git_error_last();
+ if (!e || !e->message)
+ git_error_set(e ? e->klass : GIT_ERROR_CALLBACK,
+ "%s callback returned %d", action, error_code);
+ }
+ return error_code;
+}
+
+#ifdef GIT_WIN32
+#define git_error_set_after_callback(code) \
+ git_error_set_after_callback_function((code), __FUNCTION__)
+#else
+#define git_error_set_after_callback(code) \
+ git_error_set_after_callback_function((code), __func__)
+#endif
+
+#endif
diff --git a/src/libgit2/features.h.in b/src/util/features.h.in
index e000de5e0..9fe7d2b13 100644
--- a/src/libgit2/features.h.in
+++ b/src/util/features.h.in
@@ -16,6 +16,10 @@
#cmakedefine GIT_USE_STAT_MTIME_NSEC 1
#cmakedefine GIT_USE_FUTIMENS 1
+#cmakedefine GIT_USE_QSORT_R_BSD
+#cmakedefine GIT_USE_QSORT_R_GNU
+#cmakedefine GIT_USE_QSORT_S
+
#cmakedefine GIT_REGEX_REGCOMP_L
#cmakedefine GIT_REGEX_REGCOMP
#cmakedefine GIT_REGEX_PCRE
diff --git a/src/libgit2/futils.c b/src/util/futils.c
index 2ad8a1b80..f023af8a4 100644
--- a/src/libgit2/futils.c
+++ b/src/util/futils.c
@@ -11,9 +11,6 @@
#include "strmap.h"
#include "hash.h"
#include <ctype.h>
-#if GIT_WIN32
-#include "win32/findfile.h"
-#endif
int git_futils_mkpath2file(const char *file_path, const mode_t mode)
{
diff --git a/src/libgit2/futils.h b/src/util/futils.h
index 4668d7b63..3d50d2bb7 100644
--- a/src/libgit2/futils.h
+++ b/src/util/futils.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_futils_h__
-#define INCLUDE_futils_h__
+#ifndef INCLUDE_util_futils_h__
+#define INCLUDE_util_futils_h__
-#include "common.h"
+#include "git2_util.h"
#include "map.h"
#include "posix.h"
diff --git a/src/util/git2_util.h b/src/util/git2_util.h
new file mode 100644
index 000000000..2249ef751
--- /dev/null
+++ b/src/util/git2_util.h
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_git_util_h__
+#define INCLUDE_git_util_h__
+
+#ifndef LIBGIT2_NO_FEATURES_H
+# include "generated/features.h"
+#endif
+
+#include "git2/common.h"
+#include "git2/sys/errors.h"
+#include "cc-compat.h"
+
+/** Declare a function as always inlined. */
+#if defined(_MSC_VER)
+# define GIT_INLINE(type) static __inline type
+#elif defined(__GNUC__)
+# define GIT_INLINE(type) static __inline__ type
+#else
+# define GIT_INLINE(type) static type
+#endif
+
+/** Support for gcc/clang __has_builtin intrinsic */
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifdef GIT_WIN32
+
+# include <io.h>
+# include <direct.h>
+# include <winsock2.h>
+# include <windows.h>
+# include <ws2tcpip.h>
+# include "win32/msvc-compat.h"
+# include "win32/mingw-compat.h"
+# include "win32/win32-compat.h"
+# include "win32/w32_common.h"
+# include "win32/version.h"
+# include "win32/error.h"
+# ifdef GIT_THREADS
+# include "win32/thread.h"
+# endif
+
+#else
+
+# include <unistd.h>
+# include <strings.h>
+# ifdef GIT_THREADS
+# include <pthread.h>
+# include <sched.h>
+# endif
+#define GIT_STDLIB_CALL
+
+#ifdef GIT_USE_STAT_ATIMESPEC
+# define st_atim st_atimespec
+# define st_ctim st_ctimespec
+# define st_mtim st_mtimespec
+#endif
+
+# include <arpa/inet.h>
+
+#endif
+
+#include "git2/types.h"
+#include "git2/errors.h"
+#include "thread-utils.h"
+#include "integer.h"
+#include "errors.h"
+#include "assert_safe.h"
+
+#include "posix.h"
+
+#define DEFAULT_BUFSIZE 65536
+#define FILEIO_BUFSIZE DEFAULT_BUFSIZE
+#define FILTERIO_BUFSIZE DEFAULT_BUFSIZE
+#define NETIO_BUFSIZE DEFAULT_BUFSIZE
+
+/**
+ * Check a pointer allocation result, returning -1 if it failed.
+ */
+#define GIT_ERROR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
+
+/**
+ * Check a buffer allocation result, returning -1 if it failed.
+ */
+#define GIT_ERROR_CHECK_ALLOC_BUF(buf) if ((void *)(buf) == NULL || git_buf_oom(buf)) { return -1; }
+
+/**
+ * Check a return value and propagate result if non-zero.
+ */
+#define GIT_ERROR_CHECK_ERROR(code) \
+ do { int _err = (code); if (_err) return _err; } while (0)
+
+/**
+ * Check a versioned structure for validity
+ */
+GIT_INLINE(int) git_error__check_version(const void *structure, unsigned int expected_max, const char *name)
+{
+ unsigned int actual;
+
+ if (!structure)
+ return 0;
+
+ actual = *(const unsigned int*)structure;
+ if (actual > 0 && actual <= expected_max)
+ return 0;
+
+ git_error_set(GIT_ERROR_INVALID, "invalid version %d on %s", actual, name);
+ return -1;
+}
+#define GIT_ERROR_CHECK_VERSION(S,V,N) if (git_error__check_version(S,V,N) < 0) return -1
+
+/**
+ * Initialize a structure with a version.
+ */
+GIT_INLINE(void) git__init_structure(void *structure, size_t len, unsigned int version)
+{
+ memset(structure, 0, len);
+ *((int*)structure) = version;
+}
+#define GIT_INIT_STRUCTURE(S,V) git__init_structure(S, sizeof(*S), V)
+
+#define GIT_INIT_STRUCTURE_FROM_TEMPLATE(PTR,VERSION,TYPE,TPL) do { \
+ TYPE _tmpl = TPL; \
+ GIT_ERROR_CHECK_VERSION(&(VERSION), _tmpl.version, #TYPE); \
+ memcpy((PTR), &_tmpl, sizeof(_tmpl)); } while (0)
+
+
+/** Check for additive overflow, setting an error if would occur. */
+#define GIT_ADD_SIZET_OVERFLOW(out, one, two) \
+ (git__add_sizet_overflow(out, one, two) ? (git_error_set_oom(), 1) : 0)
+
+/** Check for additive overflow, setting an error if would occur. */
+#define GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize) \
+ (git__multiply_sizet_overflow(out, nelem, elsize) ? (git_error_set_oom(), 1) : 0)
+
+/** Check for additive overflow, failing if it would occur. */
+#define GIT_ERROR_CHECK_ALLOC_ADD(out, one, two) \
+ if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { return -1; }
+
+#define GIT_ERROR_CHECK_ALLOC_ADD3(out, one, two, three) \
+ if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
+ GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { return -1; }
+
+#define GIT_ERROR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
+ if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
+ GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
+ GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { return -1; }
+
+#define GIT_ERROR_CHECK_ALLOC_ADD5(out, one, two, three, four, five) \
+ if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
+ GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
+ GIT_ADD_SIZET_OVERFLOW(out, *(out), four) || \
+ GIT_ADD_SIZET_OVERFLOW(out, *(out), five)) { return -1; }
+
+/** Check for multiplicative overflow, failing if it would occur. */
+#define GIT_ERROR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
+ if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { return -1; }
+
+/* NOTE: other git_error functions are in the public errors.h header file */
+
+#include "util.h"
+
+#endif
diff --git a/src/libgit2/hash.c b/src/util/hash.c
index 405c46a9a..405c46a9a 100644
--- a/src/libgit2/hash.c
+++ b/src/util/hash.c
diff --git a/src/libgit2/hash.h b/src/util/hash.h
index 017bb286c..41c98be11 100644
--- a/src/libgit2/hash.h
+++ b/src/util/hash.h
@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_h__
-#define INCLUDE_hash_h__
+#ifndef INCLUDE_util_hash_h__
+#define INCLUDE_util_hash_h__
-#include "common.h"
+#include "git2_util.h"
#include "git2/oid.h"
diff --git a/src/libgit2/hash/sha1.h b/src/util/hash/sha1.h
index fb8d62f80..9e15f0ac2 100644
--- a/src/libgit2/hash/sha1.h
+++ b/src/util/hash/sha1.h
@@ -5,10 +5,10 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_sha1_h__
-#define INCLUDE_hash_sha1_h__
+#ifndef INCLUDE_util_hash_sha1_h__
+#define INCLUDE_util_hash_sha1_h__
-#include "common.h"
+#include "git2_util.h"
typedef struct git_hash_sha1_ctx git_hash_sha1_ctx;
diff --git a/src/libgit2/hash/sha1/collisiondetect.c b/src/util/hash/sha1/collisiondetect.c
index e6a126780..e6a126780 100644
--- a/src/libgit2/hash/sha1/collisiondetect.c
+++ b/src/util/hash/sha1/collisiondetect.c
diff --git a/src/libgit2/hash/sha1/collisiondetect.h b/src/util/hash/sha1/collisiondetect.h
index eb88e86c1..cb58acb87 100644
--- a/src/libgit2/hash/sha1/collisiondetect.h
+++ b/src/util/hash/sha1/collisiondetect.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_sha1_collisiondetect_h__
-#define INCLUDE_hash_sha1_collisiondetect_h__
+#ifndef INCLUDE_util_hash_sha1_collisiondetect_h__
+#define INCLUDE_util_hash_sha1_collisiondetect_h__
#include "hash/sha1.h"
diff --git a/src/libgit2/hash/sha1/common_crypto.c b/src/util/hash/sha1/common_crypto.c
index 0449a3c9d..0449a3c9d 100644
--- a/src/libgit2/hash/sha1/common_crypto.c
+++ b/src/util/hash/sha1/common_crypto.c
diff --git a/src/libgit2/hash/sha1/common_crypto.h b/src/util/hash/sha1/common_crypto.h
index a5fcfb33e..b41ca1cd3 100644
--- a/src/libgit2/hash/sha1/common_crypto.h
+++ b/src/util/hash/sha1/common_crypto.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_sha1_common_crypto_h__
-#define INCLUDE_hash_sha1_common_crypto_h__
+#ifndef INCLUDE_util_hash_sha1_common_crypto_h__
+#define INCLUDE_util_hash_sha1_common_crypto_h__
#include "hash/sha1.h"
diff --git a/src/libgit2/hash/sha1/generic.c b/src/util/hash/sha1/generic.c
index 607fe3a43..607fe3a43 100644
--- a/src/libgit2/hash/sha1/generic.c
+++ b/src/util/hash/sha1/generic.c
diff --git a/src/libgit2/hash/sha1/generic.h b/src/util/hash/sha1/generic.h
index e4cc6026b..c673c6177 100644
--- a/src/libgit2/hash/sha1/generic.h
+++ b/src/util/hash/sha1/generic.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_sha1_generic_h__
-#define INCLUDE_hash_sha1_generic_h__
+#ifndef INCLUDE_util_hash_sha1_generic_h__
+#define INCLUDE_util_hash_sha1_generic_h__
#include "hash/sha1.h"
diff --git a/src/libgit2/hash/sha1/mbedtls.c b/src/util/hash/sha1/mbedtls.c
index e44343fcf..e44343fcf 100644
--- a/src/libgit2/hash/sha1/mbedtls.c
+++ b/src/util/hash/sha1/mbedtls.c
diff --git a/src/libgit2/hash/sha1/mbedtls.h b/src/util/hash/sha1/mbedtls.h
index 15f7462a4..78c675ca8 100644
--- a/src/libgit2/hash/sha1/mbedtls.h
+++ b/src/util/hash/sha1/mbedtls.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_sha1_mbedtls_h__
-#define INCLUDE_hash_sha1_mbedtls_h__
+#ifndef INCLUDE_util_hash_sha1_mbedtls_h__
+#define INCLUDE_util_hash_sha1_mbedtls_h__
#include "hash/sha1.h"
diff --git a/src/libgit2/hash/sha1/openssl.c b/src/util/hash/sha1/openssl.c
index ba3212ff2..ba3212ff2 100644
--- a/src/libgit2/hash/sha1/openssl.c
+++ b/src/util/hash/sha1/openssl.c
diff --git a/src/libgit2/hash/sha1/openssl.h b/src/util/hash/sha1/openssl.h
index a223ca03e..7c560728d 100644
--- a/src/libgit2/hash/sha1/openssl.h
+++ b/src/util/hash/sha1/openssl.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_sha1_openssl_h__
-#define INCLUDE_hash_sha1_openssl_h__
+#ifndef INCLUDE_util_hash_sha1_openssl_h__
+#define INCLUDE_util_hash_sha1_openssl_h__
#include "hash/sha1.h"
diff --git a/src/libgit2/hash/sha1/sha1dc/sha1.c b/src/util/hash/sha1/sha1dc/sha1.c
index 9d3cf81d4..9d3cf81d4 100644
--- a/src/libgit2/hash/sha1/sha1dc/sha1.c
+++ b/src/util/hash/sha1/sha1dc/sha1.c
diff --git a/src/libgit2/hash/sha1/sha1dc/sha1.h b/src/util/hash/sha1/sha1dc/sha1.h
index 1e4e94be5..1e4e94be5 100644
--- a/src/libgit2/hash/sha1/sha1dc/sha1.h
+++ b/src/util/hash/sha1/sha1dc/sha1.h
diff --git a/src/libgit2/hash/sha1/sha1dc/ubc_check.c b/src/util/hash/sha1/sha1dc/ubc_check.c
index b3beff2af..b3beff2af 100644
--- a/src/libgit2/hash/sha1/sha1dc/ubc_check.c
+++ b/src/util/hash/sha1/sha1dc/ubc_check.c
diff --git a/src/libgit2/hash/sha1/sha1dc/ubc_check.h b/src/util/hash/sha1/sha1dc/ubc_check.h
index d7e17dc73..d7e17dc73 100644
--- a/src/libgit2/hash/sha1/sha1dc/ubc_check.h
+++ b/src/util/hash/sha1/sha1dc/ubc_check.h
diff --git a/src/libgit2/hash/sha1/win32.c b/src/util/hash/sha1/win32.c
index c73695665..5136a58dc 100644
--- a/src/libgit2/hash/sha1/win32.c
+++ b/src/util/hash/sha1/win32.c
@@ -7,7 +7,7 @@
#include "win32.h"
-#include "global.h"
+#include "runtime.h"
#include <wincrypt.h>
#include <strsafe.h>
@@ -129,7 +129,7 @@ int git_hash_sha1_global_init(void)
if ((error = hash_cng_prov_init()) < 0)
error = hash_cryptoapi_prov_init();
- git__on_shutdown(sha1_shutdown);
+ git_runtime_shutdown_register(sha1_shutdown);
return error;
}
diff --git a/src/libgit2/hash/sha1/win32.h b/src/util/hash/sha1/win32.h
index 791d20a42..92e615b59 100644
--- a/src/libgit2/hash/sha1/win32.h
+++ b/src/util/hash/sha1/win32.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_hash_sha1_win32_h__
-#define INCLUDE_hash_sha1_win32_h__
+#ifndef INCLUDE_util_hash_sha1_win32_h__
+#define INCLUDE_util_hash_sha1_win32_h__
#include "hash/sha1.h"
diff --git a/src/libgit2/integer.h b/src/util/integer.h
index 067c0be1f..56cdcebfa 100644
--- a/src/libgit2/integer.h
+++ b/src/util/integer.h
@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_integer_h__
-#define INCLUDE_integer_h__
+#ifndef INCLUDE_util_integer_h__
+#define INCLUDE_util_integer_h__
/** @return true if p fits into the range of a size_t */
GIT_INLINE(int) git__is_sizet(int64_t p)
diff --git a/src/libgit2/khash.h b/src/util/khash.h
index 40e2d1848..40e2d1848 100644
--- a/src/libgit2/khash.h
+++ b/src/util/khash.h
diff --git a/src/libgit2/map.h b/src/util/map.h
index 6328d8cf4..c921e6a27 100644
--- a/src/libgit2/map.h
+++ b/src/util/map.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_map_h__
-#define INCLUDE_map_h__
+#ifndef INCLUDE_util_map_h__
+#define INCLUDE_util_map_h__
-#include "common.h"
+#include "git2_util.h"
/* p_mmap() prot values */
diff --git a/src/libgit2/net.c b/src/util/net.c
index 6d8a95dac..2b85ea2d5 100644
--- a/src/libgit2/net.c
+++ b/src/util/net.c
@@ -6,7 +6,6 @@
*/
#include "net.h"
-#include "netops.h"
#include <ctype.h>
#include "git2/errors.h"
diff --git a/src/libgit2/net.h b/src/util/net.h
index 7e72db13f..5422a0a44 100644
--- a/src/libgit2/net.h
+++ b/src/util/net.h
@@ -7,7 +7,7 @@
#ifndef INCLUDE_net_h__
#define INCLUDE_net_h__
-#include "common.h"
+#include "git2_util.h"
typedef struct git_net_url {
char *scheme;
diff --git a/src/util/oid.c b/src/util/oid.c
new file mode 100644
index 000000000..847682651
--- /dev/null
+++ b/src/util/oid.c
@@ -0,0 +1,444 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#include "oid.h"
+
+#include "git2/oid.h"
+#include <string.h>
+#include <limits.h>
+
+static char to_hex[] = "0123456789abcdef";
+
+static int oid_error_invalid(const char *msg)
+{
+ git_error_set(GIT_ERROR_INVALID, "unable to parse OID - %s", msg);
+ return -1;
+}
+
+int git_oid_fromstrn(git_oid *out, const char *str, size_t length)
+{
+ size_t p;
+ int v;
+
+ assert(out && str);
+
+ if (!length)
+ return oid_error_invalid("too short");
+
+ if (length > GIT_OID_HEXSZ)
+ return oid_error_invalid("too long");
+
+ memset(out->id, 0, GIT_OID_RAWSZ);
+
+ for (p = 0; p < length; p++) {
+ v = git__fromhex(str[p]);
+ if (v < 0)
+ return oid_error_invalid("contains invalid characters");
+
+ out->id[p / 2] |= (unsigned char)(v << (p % 2 ? 0 : 4));
+ }
+
+ return 0;
+}
+
+int git_oid_fromstrp(git_oid *out, const char *str)
+{
+ return git_oid_fromstrn(out, str, strlen(str));
+}
+
+int git_oid_fromstr(git_oid *out, const char *str)
+{
+ return git_oid_fromstrn(out, str, GIT_OID_HEXSZ);
+}
+
+GIT_INLINE(char) *fmt_one(char *str, unsigned int val)
+{
+ *str++ = to_hex[val >> 4];
+ *str++ = to_hex[val & 0xf];
+ return str;
+}
+
+int git_oid_nfmt(char *str, size_t n, const git_oid *oid)
+{
+ size_t i, max_i;
+
+ if (!oid) {
+ memset(str, 0, n);
+ return 0;
+ }
+ if (n > GIT_OID_HEXSZ) {
+ memset(&str[GIT_OID_HEXSZ], 0, n - GIT_OID_HEXSZ);
+ n = GIT_OID_HEXSZ;
+ }
+
+ max_i = n / 2;
+
+ for (i = 0; i < max_i; i++)
+ str = fmt_one(str, oid->id[i]);
+
+ if (n & 1)
+ *str++ = to_hex[oid->id[i] >> 4];
+
+ return 0;
+}
+
+int git_oid_fmt(char *str, const git_oid *oid)
+{
+ return git_oid_nfmt(str, GIT_OID_HEXSZ, oid);
+}
+
+int git_oid_pathfmt(char *str, const git_oid *oid)
+{
+ size_t i;
+
+ str = fmt_one(str, oid->id[0]);
+ *str++ = '/';
+ for (i = 1; i < sizeof(oid->id); i++)
+ str = fmt_one(str, oid->id[i]);
+
+ return 0;
+}
+
+char *git_oid_allocfmt(const git_oid *oid)
+{
+ char *str = git__malloc(GIT_OID_HEXSZ + 1);
+ if (!str)
+ return NULL;
+ git_oid_nfmt(str, GIT_OID_HEXSZ + 1, oid);
+ return str;
+}
+
+char *git_oid_tostr(char *out, size_t n, const git_oid *oid)
+{
+ if (!out || n == 0)
+ return "";
+
+ if (n > GIT_OID_HEXSZ + 1)
+ n = GIT_OID_HEXSZ + 1;
+
+ git_oid_nfmt(out, n - 1, oid); /* allow room for terminating NUL */
+ out[n - 1] = '\0';
+
+ return out;
+}
+
+int git_oid__parse(
+ git_oid *oid, const char **buffer_out,
+ const char *buffer_end, const char *header)
+{
+ const size_t sha_len = GIT_OID_HEXSZ;
+ const size_t header_len = strlen(header);
+
+ const char *buffer = *buffer_out;
+
+ if (buffer + (header_len + sha_len + 1) > buffer_end)
+ return -1;
+
+ if (memcmp(buffer, header, header_len) != 0)
+ return -1;
+
+ if (buffer[header_len + sha_len] != '\n')
+ return -1;
+
+ if (git_oid_fromstr(oid, buffer + header_len) < 0)
+ return -1;
+
+ *buffer_out = buffer + (header_len + sha_len + 1);
+
+ return 0;
+}
+
+void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid)
+{
+ char hex_oid[GIT_OID_HEXSZ];
+
+ git_oid_fmt(hex_oid, oid);
+ git_buf_puts(buf, header);
+ git_buf_put(buf, hex_oid, GIT_OID_HEXSZ);
+ git_buf_putc(buf, '\n');
+}
+
+int git_oid_fromraw(git_oid *out, const unsigned char *raw)
+{
+ memcpy(out->id, raw, sizeof(out->id));
+ return 0;
+}
+
+int git_oid_cpy(git_oid *out, const git_oid *src)
+{
+ memcpy(out->id, src->id, sizeof(out->id));
+ return 0;
+}
+
+int git_oid_cmp(const git_oid *a, const git_oid *b)
+{
+ return git_oid__cmp(a, b);
+}
+
+int git_oid_equal(const git_oid *a, const git_oid *b)
+{
+ return (git_oid__cmp(a, b) == 0);
+}
+
+int git_oid_ncmp(const git_oid *oid_a, const git_oid *oid_b, size_t len)
+{
+ const unsigned char *a = oid_a->id;
+ const unsigned char *b = oid_b->id;
+
+ if (len > GIT_OID_HEXSZ)
+ len = GIT_OID_HEXSZ;
+
+ while (len > 1) {
+ if (*a != *b)
+ return 1;
+ a++;
+ b++;
+ len -= 2;
+ };
+
+ if (len)
+ if ((*a ^ *b) & 0xf0)
+ return 1;
+
+ return 0;
+}
+
+int git_oid_strcmp(const git_oid *oid_a, const char *str)
+{
+ const unsigned char *a;
+ unsigned char strval;
+ int hexval;
+
+ for (a = oid_a->id; *str && (a - oid_a->id) < GIT_OID_RAWSZ; ++a) {
+ if ((hexval = git__fromhex(*str++)) < 0)
+ return -1;
+ strval = (unsigned char)(hexval << 4);
+ if (*str) {
+ if ((hexval = git__fromhex(*str++)) < 0)
+ return -1;
+ strval |= hexval;
+ }
+ if (*a != strval)
+ return (*a - strval);
+ }
+
+ return 0;
+}
+
+int git_oid_streq(const git_oid *oid_a, const char *str)
+{
+ return git_oid_strcmp(oid_a, str) == 0 ? 0 : -1;
+}
+
+int git_oid_is_zero(const git_oid *oid_a)
+{
+ const unsigned char *a = oid_a->id;
+ unsigned int i;
+ for (i = 0; i < GIT_OID_RAWSZ; ++i, ++a)
+ if (*a != 0)
+ return 0;
+ return 1;
+}
+
+int git_oid_iszero(const git_oid *oid_a)
+{
+ return git_oid_is_zero(oid_a);
+}
+
+typedef short node_index;
+
+typedef union {
+ const char *tail;
+ node_index children[16];
+} trie_node;
+
+struct git_oid_shorten {
+ trie_node *nodes;
+ size_t node_count, size;
+ int min_length, full;
+};
+
+static int resize_trie(git_oid_shorten *self, size_t new_size)
+{
+ self->nodes = git__reallocarray(self->nodes, new_size, sizeof(trie_node));
+ GIT_ERROR_CHECK_ALLOC(self->nodes);
+
+ if (new_size > self->size) {
+ memset(&self->nodes[self->size], 0x0, (new_size - self->size) * sizeof(trie_node));
+ }
+
+ self->size = new_size;
+ return 0;
+}
+
+static trie_node *push_leaf(git_oid_shorten *os, node_index idx, int push_at, const char *oid)
+{
+ trie_node *node, *leaf;
+ node_index idx_leaf;
+
+ if (os->node_count >= os->size) {
+ if (resize_trie(os, os->size * 2) < 0)
+ return NULL;
+ }
+
+ idx_leaf = (node_index)os->node_count++;
+
+ if (os->node_count == SHRT_MAX) {
+ os->full = 1;
+ return NULL;
+ }
+
+ node = &os->nodes[idx];
+ node->children[push_at] = -idx_leaf;
+
+ leaf = &os->nodes[idx_leaf];
+ leaf->tail = oid;
+
+ return node;
+}
+
+git_oid_shorten *git_oid_shorten_new(size_t min_length)
+{
+ git_oid_shorten *os;
+
+ assert((size_t)((int)min_length) == min_length);
+
+ os = git__calloc(1, sizeof(git_oid_shorten));
+ if (os == NULL)
+ return NULL;
+
+ if (resize_trie(os, 16) < 0) {
+ git__free(os);
+ return NULL;
+ }
+
+ os->node_count = 1;
+ os->min_length = (int)min_length;
+
+ return os;
+}
+
+void git_oid_shorten_free(git_oid_shorten *os)
+{
+ if (os == NULL)
+ return;
+
+ git__free(os->nodes);
+ git__free(os);
+}
+
+
+/*
+ * What wizardry is this?
+ *
+ * This is just a memory-optimized trie: basically a very fancy
+ * 16-ary tree, which is used to store the prefixes of the OID
+ * strings.
+ *
+ * Read more: http://en.wikipedia.org/wiki/Trie
+ *
+ * Magic that happens in this method:
+ *
+ * - Each node in the trie is an union, so it can work both as
+ * a normal node, or as a leaf.
+ *
+ * - Each normal node points to 16 children (one for each possible
+ * character in the oid). This is *not* stored in an array of
+ * pointers, because in a 64-bit arch this would be sucking
+ * 16*sizeof(void*) = 128 bytes of memory per node, which is
+ * insane. What we do is store Node Indexes, and use these indexes
+ * to look up each node in the om->index array. These indexes are
+ * signed shorts, so this limits the amount of unique OIDs that
+ * fit in the structure to about 20000 (assuming a more or less uniform
+ * distribution).
+ *
+ * - All the nodes in om->index array are stored contiguously in
+ * memory, and each of them is 32 bytes, so we fit 2x nodes per
+ * cache line. Convenient for speed.
+ *
+ * - To differentiate the leafs from the normal nodes, we store all
+ * the indexes towards a leaf as a negative index (indexes to normal
+ * nodes are positives). When we find that one of the children for
+ * a node has a negative value, that means it's going to be a leaf.
+ * This reduces the amount of indexes we have by two, but also reduces
+ * the size of each node by 1-4 bytes (the amount we would need to
+ * add a `is_leaf` field): this is good because it allows the nodes
+ * to fit cleanly in cache lines.
+ *
+ * - Once we reach an empty children, instead of continuing to insert
+ * new nodes for each remaining character of the OID, we store a pointer
+ * to the tail in the leaf; if the leaf is reached again, we turn it
+ * into a normal node and use the tail to create a new leaf.
+ *
+ * This is a pretty good balance between performance and memory usage.
+ */
+int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
+{
+ int i;
+ bool is_leaf;
+ node_index idx;
+
+ if (os->full) {
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
+ return -1;
+ }
+
+ if (text_oid == NULL)
+ return os->min_length;
+
+ idx = 0;
+ is_leaf = false;
+
+ for (i = 0; i < GIT_OID_HEXSZ; ++i) {
+ int c = git__fromhex(text_oid[i]);
+ trie_node *node;
+
+ if (c == -1) {
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - invalid hex value");
+ return -1;
+ }
+
+ node = &os->nodes[idx];
+
+ if (is_leaf) {
+ const char *tail;
+
+ tail = node->tail;
+ node->tail = NULL;
+
+ node = push_leaf(os, idx, git__fromhex(tail[0]), &tail[1]);
+ if (node == NULL) {
+ if (os->full)
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
+ return -1;
+ }
+ }
+
+ if (node->children[c] == 0) {
+ if (push_leaf(os, idx, c, &text_oid[i + 1]) == NULL) {
+ if (os->full)
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
+ return -1;
+ }
+ break;
+ }
+
+ idx = node->children[c];
+ is_leaf = false;
+
+ if (idx < 0) {
+ node->children[c] = idx = -idx;
+ is_leaf = true;
+ }
+ }
+
+ if (++i > os->min_length)
+ os->min_length = i;
+
+ return os->min_length;
+}
+
diff --git a/src/libgit2/oid.h b/src/util/oid.h
index 84231ffca..8e3e38e1c 100644
--- a/src/libgit2/oid.h
+++ b/src/util/oid.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_oid_h__
-#define INCLUDE_oid_h__
+#ifndef INCLUDE_util_oid_h__
+#define INCLUDE_util_oid_h__
-#include "common.h"
+#include "git2_util.h"
#include "git2/oid.h"
diff --git a/src/libgit2/path.c b/src/util/path.c
index f97cceddd..6781be24f 100644
--- a/src/libgit2/path.c
+++ b/src/util/path.c
@@ -8,7 +8,7 @@
#include "path.h"
#include "posix.h"
-#include "repository.h"
+#include "futils.h"
#ifdef GIT_WIN32
#include "win32/posix.h"
#include "win32/w32_buffer.h"
diff --git a/src/libgit2/path.h b/src/util/path.h
index 5e8590dee..8ae0125dd 100644
--- a/src/libgit2/path.h
+++ b/src/util/path.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_path_h__
-#define INCLUDE_path_h__
+#ifndef INCLUDE_util_path_h__
+#define INCLUDE_util_path_h__
-#include "common.h"
+#include "git2_util.h"
#include "posix.h"
#include "buffer.h"
diff --git a/src/libgit2/pool.c b/src/util/pool.c
index baae91882..baae91882 100644
--- a/src/libgit2/pool.c
+++ b/src/util/pool.c
diff --git a/src/libgit2/pool.h b/src/util/pool.h
index 969d0e7fe..fd4ca0459 100644
--- a/src/libgit2/pool.h
+++ b/src/util/pool.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_pool_h__
-#define INCLUDE_pool_h__
+#ifndef INCLUDE_util_pool_h__
+#define INCLUDE_util_pool_h__
-#include "common.h"
+#include "git2_util.h"
#include "vector.h"
diff --git a/src/libgit2/posix.c b/src/util/posix.c
index fbaa7c3ca..fbaa7c3ca 100644
--- a/src/libgit2/posix.c
+++ b/src/util/posix.c
diff --git a/src/libgit2/posix.h b/src/util/posix.h
index eef667762..5b1e9cf8a 100644
--- a/src/libgit2/posix.h
+++ b/src/util/posix.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_posix_h__
-#define INCLUDE_posix_h__
+#ifndef INCLUDE_util_posix_h__
+#define INCLUDE_util_posix_h__
-#include "common.h"
+#include "git2_util.h"
#include <fcntl.h>
#include <time.h>
diff --git a/src/libgit2/runtime.c b/src/util/runtime.c
index 1228a3ced..0ff4e2a5d 100644
--- a/src/libgit2/runtime.c
+++ b/src/util/runtime.c
@@ -5,7 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "common.h"
+#include "git2_util.h"
#include "runtime.h"
static git_runtime_shutdown_fn shutdown_callback[32];
diff --git a/src/libgit2/runtime.h b/src/util/runtime.h
index be2e37a60..095161a49 100644
--- a/src/libgit2/runtime.h
+++ b/src/util/runtime.h
@@ -7,7 +7,7 @@
#ifndef INCLUDE_runtime_h__
#define INCLUDE_runtime_h__
-#include "common.h"
+#include "git2_util.h"
typedef int (*git_runtime_init_fn)(void);
typedef void (*git_runtime_shutdown_fn)(void);
diff --git a/src/libgit2/strmap.c b/src/util/strmap.c
index c6e5b6dc7..c6e5b6dc7 100644
--- a/src/libgit2/strmap.c
+++ b/src/util/strmap.c
diff --git a/src/libgit2/strmap.h b/src/util/strmap.h
index 9f5e4cc8b..dc80d96e5 100644
--- a/src/libgit2/strmap.h
+++ b/src/util/strmap.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_strmap_h__
-#define INCLUDE_strmap_h__
+#ifndef INCLUDE_util_strmap_h__
+#define INCLUDE_util_strmap_h__
-#include "common.h"
+#include "git2_util.h"
/** A map with C strings as key. */
typedef struct kh_str_s git_strmap;
diff --git a/src/libgit2/strnlen.h b/src/util/strnlen.h
index eecfe3c02..9aaadc0e4 100644
--- a/src/libgit2/strnlen.h
+++ b/src/util/strnlen.h
@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_strlen_h__
-#define INCLUDE_strlen_h__
+#ifndef INCLUDE_util_strlen_h__
+#define INCLUDE_util_strlen_h__
#if defined(__MINGW32__) || defined(__sun) || defined(__APPLE__) || defined(__MidnightBSD__) ||\
(defined(_MSC_VER) && _MSC_VER < 1500)
diff --git a/src/libgit2/thread-utils.c b/src/util/thread-utils.c
index e5ec6a843..28251f964 100644
--- a/src/libgit2/thread-utils.c
+++ b/src/util/thread-utils.c
@@ -5,7 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "common.h"
+#include "git2_util.h"
#include "thread-utils.h"
#ifdef _WIN32
diff --git a/src/libgit2/thread-utils.h b/src/util/thread-utils.h
index c4191b934..aaa45ae1f 100644
--- a/src/libgit2/thread-utils.h
+++ b/src/util/thread-utils.h
@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_thread_utils_h__
-#define INCLUDE_thread_utils_h__
+#ifndef INCLUDE_util_thread_utils_h__
+#define INCLUDE_util_thread_utils_h__
#if defined(__GNUC__) && defined(GIT_THREADS)
# if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1))
diff --git a/src/libgit2/tsort.c b/src/util/tsort.c
index 8d1ed9787..6fa4573de 100644
--- a/src/libgit2/tsort.c
+++ b/src/util/tsort.c
@@ -5,7 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "common.h"
+#include "git2_util.h"
/**
* An array-of-pointers implementation of Python's Timsort
diff --git a/src/libgit2/unix/map.c b/src/util/unix/map.c
index 7f9076e19..d068ae7ff 100644
--- a/src/libgit2/unix/map.c
+++ b/src/util/unix/map.c
@@ -5,7 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "common.h"
+#include "git2_util.h"
#include "git2/common.h"
diff --git a/src/libgit2/unix/posix.h b/src/util/unix/posix.h
index 4fa725013..e8536d88e 100644
--- a/src/libgit2/unix/posix.h
+++ b/src/util/unix/posix.h
@@ -4,12 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_unix_posix_h__
-#define INCLUDE_unix_posix_h__
-
-#ifndef LIBGIT2_NO_FEATURES_H
-# include "git2/sys/features.h"
-#endif
+#ifndef INCLUDE_util_unix_posix_h__
+#define INCLUDE_util_unix_posix_h__
#include <stdio.h>
#include <dirent.h>
diff --git a/src/libgit2/unix/pthread.h b/src/util/unix/pthread.h
index 55f4ae227..363e7721c 100644
--- a/src/libgit2/unix/pthread.h
+++ b/src/util/unix/pthread.h
@@ -5,8 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_unix_pthread_h__
-#define INCLUDE_unix_pthread_h__
+#ifndef INCLUDE_util_unix_pthread_h__
+#define INCLUDE_util_unix_pthread_h__
typedef struct {
pthread_t thread;
diff --git a/src/libgit2/unix/realpath.c b/src/util/unix/realpath.c
index 893bac87b..41321f604 100644
--- a/src/libgit2/unix/realpath.c
+++ b/src/util/unix/realpath.c
@@ -5,7 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "common.h"
+#include "git2_util.h"
#include "git2/common.h"
diff --git a/src/libgit2/util.c b/src/util/util.c
index ec12e7443..e37f26fcb 100644
--- a/src/libgit2/util.c
+++ b/src/util/util.c
@@ -5,10 +5,9 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
+#include "git2_util.h"
#include "util.h"
-#include "common.h"
-
#ifdef GIT_WIN32
# include "win32/utf-conv.h"
# include "win32/w32_buffer.h"
diff --git a/src/libgit2/util.h b/src/util/util.h
index 06a10f58e..cdfc9c239 100644
--- a/src/libgit2/util.h
+++ b/src/util/util.h
@@ -4,17 +4,16 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_util_h__
-#define INCLUDE_util_h__
+#ifndef INCLUDE_util_util_h__
+#define INCLUDE_util_util_h__
-#include "common.h"
+#include "git2_util.h"
#ifndef GIT_WIN32
# include <ctype.h>
#endif
#include "buffer.h"
-#include "common.h"
#include "strnlen.h"
#include "thread-utils.h"
diff --git a/src/libgit2/varint.c b/src/util/varint.c
index 9ffc1d744..9ffc1d744 100644
--- a/src/libgit2/varint.c
+++ b/src/util/varint.c
diff --git a/src/libgit2/varint.h b/src/util/varint.h
index 652e22486..3117c2f10 100644
--- a/src/libgit2/varint.h
+++ b/src/util/varint.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_varint_h__
-#define INCLUDE_varint_h__
+#ifndef INCLUDE_util_varint_h__
+#define INCLUDE_util_varint_h__
-#include "common.h"
+#include "git2_util.h"
#include <stdint.h>
diff --git a/src/libgit2/vector.c b/src/util/vector.c
index b51e7644b..b51e7644b 100644
--- a/src/libgit2/vector.c
+++ b/src/util/vector.c
diff --git a/src/libgit2/vector.h b/src/util/vector.h
index cc4c314d5..cb6bee4ed 100644
--- a/src/libgit2/vector.h
+++ b/src/util/vector.h
@@ -4,10 +4,10 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
-#ifndef INCLUDE_vector_h__
-#define INCLUDE_vector_h__
+#ifndef INCLUDE_util_vector_h__
+#define INCLUDE_util_vector_h__
-#include "common.h"
+#include "git2_util.h"
typedef int (*git_vector_cmp)(const void *, const void *);
diff --git a/src/libgit2/win32/dir.c b/src/util/win32/dir.c
index 44052caf0..44052caf0 100644
--- a/src/libgit2/win32/dir.c
+++ b/src/util/win32/dir.c
diff --git a/src/libgit2/win32/dir.h b/src/util/win32/dir.h
index acd64729e..b6b968829 100644
--- a/src/libgit2/win32/dir.h
+++ b/src/util/win32/dir.h
@@ -7,8 +7,7 @@
#ifndef INCLUDE_win32_dir_h__
#define INCLUDE_win32_dir_h__
-#include "common.h"
-
+#include "git2_util.h"
#include "w32_util.h"
struct git__dirent {
diff --git a/src/libgit2/win32/error.c b/src/util/win32/error.c
index 3a52fb5a9..3a52fb5a9 100644
--- a/src/libgit2/win32/error.c
+++ b/src/util/win32/error.c
diff --git a/src/libgit2/win32/error.h b/src/util/win32/error.h
index 9e81141ce..fd53b7f99 100644
--- a/src/libgit2/win32/error.h
+++ b/src/util/win32/error.h
@@ -8,7 +8,7 @@
#ifndef INCLUDE_win32_error_h__
#define INCLUDE_win32_error_h__
-#include "common.h"
+#include "git2_util.h"
extern char *git_win32_get_error_message(DWORD error_code);
diff --git a/src/libgit2/win32/map.c b/src/util/win32/map.c
index e2ce737de..00dc749a2 100644
--- a/src/libgit2/win32/map.c
+++ b/src/util/win32/map.c
@@ -5,7 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "common.h"
+#include "git2_util.h"
#include "map.h"
#include <errno.h>
diff --git a/src/libgit2/win32/mingw-compat.h b/src/util/win32/mingw-compat.h
index aa2bef98d..aa2bef98d 100644
--- a/src/libgit2/win32/mingw-compat.h
+++ b/src/util/win32/mingw-compat.h
diff --git a/src/libgit2/win32/msvc-compat.h b/src/util/win32/msvc-compat.h
index 4cf471f1d..4cf471f1d 100644
--- a/src/libgit2/win32/msvc-compat.h
+++ b/src/util/win32/msvc-compat.h
diff --git a/src/libgit2/win32/path_w32.c b/src/util/win32/path_w32.c
index 18b43e728..18b43e728 100644
--- a/src/libgit2/win32/path_w32.c
+++ b/src/util/win32/path_w32.c
diff --git a/src/libgit2/win32/path_w32.h b/src/util/win32/path_w32.h
index dab8b96fa..0b29693a3 100644
--- a/src/libgit2/win32/path_w32.h
+++ b/src/util/win32/path_w32.h
@@ -7,7 +7,8 @@
#ifndef INCLUDE_win32_path_w32_h__
#define INCLUDE_win32_path_w32_h__
-#include "common.h"
+#include "git2_util.h"
+#include "path_w32.h"
#include "vector.h"
/**
diff --git a/src/libgit2/win32/posix.h b/src/util/win32/posix.h
index f115088b4..027b3f1e0 100644
--- a/src/libgit2/win32/posix.h
+++ b/src/util/win32/posix.h
@@ -7,10 +7,8 @@
#ifndef INCLUDE_win32_posix_h__
#define INCLUDE_win32_posix_h__
-#include "common.h"
#include "../posix.h"
#include "win32-compat.h"
-#include "path_w32.h"
#include "utf-conv.h"
#include "dir.h"
diff --git a/src/libgit2/win32/posix_w32.c b/src/util/win32/posix_w32.c
index 5a5e92158..040f0a347 100644
--- a/src/libgit2/win32/posix_w32.c
+++ b/src/util/win32/posix_w32.c
@@ -5,14 +5,13 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
-#include "common.h"
+#include "git2_util.h"
#include "../posix.h"
#include "../futils.h"
#include "path.h"
#include "path_w32.h"
#include "utf-conv.h"
-#include "repository.h"
#include "reparse.h"
#include "buffer.h"
#include <errno.h>
diff --git a/src/libgit2/win32/reparse.h b/src/util/win32/reparse.h
index 5f7408a1b..5f7408a1b 100644
--- a/src/libgit2/win32/reparse.h
+++ b/src/util/win32/reparse.h
diff --git a/src/libgit2/win32/thread.c b/src/util/win32/thread.c
index 7940289ae..7940289ae 100644
--- a/src/libgit2/win32/thread.c
+++ b/src/util/win32/thread.c
diff --git a/src/libgit2/win32/thread.h b/src/util/win32/thread.h
index 8305036b4..184762e2a 100644
--- a/src/libgit2/win32/thread.h
+++ b/src/util/win32/thread.h
@@ -8,7 +8,7 @@
#ifndef INCLUDE_win32_thread_h__
#define INCLUDE_win32_thread_h__
-#include "common.h"
+#include "git2_util.h"
#if defined (_MSC_VER)
# define GIT_RESTRICT __restrict
diff --git a/src/libgit2/win32/utf-conv.c b/src/util/win32/utf-conv.c
index 4bde3023a..4bde3023a 100644
--- a/src/libgit2/win32/utf-conv.c
+++ b/src/util/win32/utf-conv.c
diff --git a/src/libgit2/win32/utf-conv.h b/src/util/win32/utf-conv.h
index 6090a4b35..120d647ef 100644
--- a/src/libgit2/win32/utf-conv.h
+++ b/src/util/win32/utf-conv.h
@@ -7,7 +7,7 @@
#ifndef INCLUDE_win32_utf_conv_h__
#define INCLUDE_win32_utf_conv_h__
-#include "common.h"
+#include "git2_util.h"
#include <wchar.h>
diff --git a/src/libgit2/win32/version.h b/src/util/win32/version.h
index 79667697f..79667697f 100644
--- a/src/libgit2/win32/version.h
+++ b/src/util/win32/version.h
diff --git a/src/libgit2/win32/w32_buffer.c b/src/util/win32/w32_buffer.c
index b78a7e6f3..b78a7e6f3 100644
--- a/src/libgit2/win32/w32_buffer.c
+++ b/src/util/win32/w32_buffer.c
diff --git a/src/libgit2/win32/w32_buffer.h b/src/util/win32/w32_buffer.h
index 43298e4a7..b4ea67a5a 100644
--- a/src/libgit2/win32/w32_buffer.h
+++ b/src/util/win32/w32_buffer.h
@@ -7,7 +7,7 @@
#ifndef INCLUDE_win32_w32_buffer_h__
#define INCLUDE_win32_w32_buffer_h__
-#include "common.h"
+#include "git2_util.h"
#include "../buffer.h"
diff --git a/src/libgit2/win32/w32_common.h b/src/util/win32/w32_common.h
index f9e74b947..f9e74b947 100644
--- a/src/libgit2/win32/w32_common.h
+++ b/src/util/win32/w32_common.h
diff --git a/src/libgit2/win32/w32_crtdbg_stacktrace.c b/src/util/win32/w32_crtdbg_stacktrace.c
index 72bd32332..72bd32332 100644
--- a/src/libgit2/win32/w32_crtdbg_stacktrace.c
+++ b/src/util/win32/w32_crtdbg_stacktrace.c
diff --git a/src/libgit2/win32/w32_crtdbg_stacktrace.h b/src/util/win32/w32_crtdbg_stacktrace.h
index a3cfefb27..479dd7cff 100644
--- a/src/libgit2/win32/w32_crtdbg_stacktrace.h
+++ b/src/util/win32/w32_crtdbg_stacktrace.h
@@ -7,7 +7,7 @@
#ifndef INCLUDE_win32_w32_crtdbg_stacktrace_h__
#define INCLUDE_win32_w32_crtdbg_stacktrace_h__
-#include "common.h"
+#include "git2_util.h"
#if defined(GIT_MSVC_CRTDBG)
diff --git a/src/libgit2/win32/w32_stack.c b/src/util/win32/w32_stack.c
index 7f7a0374e..7f7a0374e 100644
--- a/src/libgit2/win32/w32_stack.c
+++ b/src/util/win32/w32_stack.c
diff --git a/src/libgit2/win32/w32_stack.h b/src/util/win32/w32_stack.h
index b42ff3441..5b71d1991 100644
--- a/src/libgit2/win32/w32_stack.h
+++ b/src/util/win32/w32_stack.h
@@ -8,7 +8,7 @@
#ifndef INCLUDE_win32_w32_stack_h__
#define INCLUDE_win32_w32_stack_h__
-#include "common.h"
+#include "git2_util.h"
#if defined(GIT_MSVC_CRTDBG)
diff --git a/src/libgit2/win32/w32_util.c b/src/util/win32/w32_util.c
index fe4b75bae..fe4b75bae 100644
--- a/src/libgit2/win32/w32_util.c
+++ b/src/util/win32/w32_util.c
diff --git a/src/libgit2/win32/w32_util.h b/src/util/win32/w32_util.h
index d7f9d3da6..a86f0058d 100644
--- a/src/libgit2/win32/w32_util.h
+++ b/src/util/win32/w32_util.h
@@ -8,7 +8,7 @@
#ifndef INCLUDE_win32_w32_util_h__
#define INCLUDE_win32_w32_util_h__
-#include "common.h"
+#include "git2_util.h"
#include "utf-conv.h"
#include "posix.h"
diff --git a/src/libgit2/win32/win32-compat.h b/src/util/win32/win32-compat.h
index dee40a438..dee40a438 100644
--- a/src/libgit2/win32/win32-compat.h
+++ b/src/util/win32/win32-compat.h
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 6f8a18ec0..6f1ede1bf 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -5,6 +5,11 @@ IF(NOT PYTHONINTERP_FOUND)
"Make sure python is available, or pass -DBUILD_CLAR=OFF to skip building the tests")
ENDIF()
+GET_PROPERTY(LIBGIT2_OBJECTS GLOBAL PROPERTY libgit2_objects)
+GET_PROPERTY(LIBGIT2_INCLUDES GLOBAL PROPERTY libgit2_includes)
+GET_PROPERTY(LIBGIT2_SYSTEM_INCLUDES GLOBAL PROPERTY libgit2_system_includes)
+GET_PROPERTY(LIBGIT2_LIBS GLOBAL PROPERTY libgit2_libs)
+
SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/resources/")
SET(CLAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
@@ -42,7 +47,7 @@ ADD_EXECUTABLE(libgit2_clar ${SRC_CLAR} ${SRC_TEST} ${LIBGIT2_OBJECTS})
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES C_STANDARD 90)
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
-TARGET_INCLUDE_DIRECTORIES(libgit2_clar PRIVATE ../src PUBLIC ../include)
+TARGET_INCLUDE_DIRECTORIES(libgit2_clar PRIVATE ../src/util ../src/libgit2 PUBLIC ../include)
TARGET_LINK_LIBRARIES(libgit2_clar ${LIBGIT2_LIBS})
IDE_SPLIT_SOURCES(libgit2_clar)