Commit d103620158bb5aca73bc0dad8a230ceda417ab47

Edward Thomson 2022-06-18T16:10:38

meta: generated `features.h` is now `git2_features.h` Linux has a /usr/include/features.h, which gets confusing; update this to `git2_features.h` and move it into the `util` directory.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d16cfe5..e108b2e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -171,12 +171,6 @@ endif()
 add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support")
 
 #
-# Configure support
-#
-
-configure_file(features.h.in git2/sys/features.h)
-
-#
 # Include child projects
 #
 
diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt
index 4f347e9..5274ab0 100644
--- a/src/cli/CMakeLists.txt
+++ b/src/cli/CMakeLists.txt
@@ -1,5 +1,5 @@
 set(CLI_INCLUDES
-	"${libgit2_BINARY_DIR}/src"
+	"${libgit2_BINARY_DIR}/src/util"
 	"${libgit2_SOURCE_DIR}/src/util"
 	"${libgit2_SOURCE_DIR}/src/cli"
 	"${libgit2_SOURCE_DIR}/include")
diff --git a/src/features.h.in b/src/features.h.in
deleted file mode 100644
index fbf0cab..0000000
--- a/src/features.h.in
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef INCLUDE_features_h__
-#define INCLUDE_features_h__
-
-#cmakedefine GIT_DEBUG_POOL 1
-#cmakedefine GIT_DEBUG_STRICT_ALLOC 1
-#cmakedefine GIT_DEBUG_STRICT_OPEN 1
-
-#cmakedefine GIT_THREADS 1
-#cmakedefine GIT_WIN32_LEAKCHECK 1
-
-#cmakedefine GIT_ARCH_64 1
-#cmakedefine GIT_ARCH_32 1
-
-#cmakedefine GIT_USE_ICONV 1
-#cmakedefine GIT_USE_NSEC 1
-#cmakedefine GIT_USE_STAT_MTIM 1
-#cmakedefine GIT_USE_STAT_MTIMESPEC 1
-#cmakedefine GIT_USE_STAT_MTIME_NSEC 1
-#cmakedefine GIT_USE_FUTIMENS 1
-
-#cmakedefine GIT_REGEX_REGCOMP_L
-#cmakedefine GIT_REGEX_REGCOMP
-#cmakedefine GIT_REGEX_PCRE
-#cmakedefine GIT_REGEX_PCRE2
-#cmakedefine GIT_REGEX_BUILTIN 1
-
-#cmakedefine GIT_QSORT_R_BSD
-#cmakedefine GIT_QSORT_R_GNU
-#cmakedefine GIT_QSORT_S
-
-#cmakedefine GIT_SSH 1
-#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
-
-#cmakedefine GIT_NTLM 1
-#cmakedefine GIT_GSSAPI 1
-#cmakedefine GIT_GSSFRAMEWORK 1
-
-#cmakedefine GIT_WINHTTP 1
-#cmakedefine GIT_HTTPS 1
-#cmakedefine GIT_OPENSSL 1
-#cmakedefine GIT_OPENSSL_DYNAMIC 1
-#cmakedefine GIT_SECURE_TRANSPORT 1
-#cmakedefine GIT_MBEDTLS 1
-
-#cmakedefine GIT_SHA1_COLLISIONDETECT 1
-#cmakedefine GIT_SHA1_WIN32 1
-#cmakedefine GIT_SHA1_COMMON_CRYPTO 1
-#cmakedefine GIT_SHA1_OPENSSL 1
-#cmakedefine GIT_SHA1_OPENSSL_DYNAMIC 1
-#cmakedefine GIT_SHA1_MBEDTLS 1
-
-#cmakedefine GIT_SHA256_BUILTIN 1
-#cmakedefine GIT_SHA256_WIN32 1
-#cmakedefine GIT_SHA256_COMMON_CRYPTO 1
-#cmakedefine GIT_SHA256_OPENSSL 1
-#cmakedefine GIT_SHA256_OPENSSL_DYNAMIC 1
-#cmakedefine GIT_SHA256_MBEDTLS 1
-
-#cmakedefine GIT_RAND_GETENTROPY 1
-#cmakedefine GIT_RAND_GETLOADAVG 1
-
-#endif
diff --git a/src/libgit2/CMakeLists.txt b/src/libgit2/CMakeLists.txt
index 0c7dddd..5fbb03d 100644
--- a/src/libgit2/CMakeLists.txt
+++ b/src/libgit2/CMakeLists.txt
@@ -8,7 +8,7 @@ set_target_properties(libgit2 PROPERTIES C_EXTENSIONS OFF)
 include(PkgBuildConfig)
 
 set(LIBGIT2_INCLUDES
-	"${PROJECT_BINARY_DIR}/src"
+	"${PROJECT_BINARY_DIR}/src/util"
 	"${PROJECT_SOURCE_DIR}/src/libgit2"
 	"${PROJECT_SOURCE_DIR}/src/util"
 	"${PROJECT_SOURCE_DIR}/include")
diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt
index b283395..bf62870 100644
--- a/src/util/CMakeLists.txt
+++ b/src/util/CMakeLists.txt
@@ -4,8 +4,10 @@ add_library(util OBJECT)
 set_target_properties(util PROPERTIES C_STANDARD 90)
 set_target_properties(util PROPERTIES C_EXTENSIONS OFF)
 
+configure_file(git2_features.h.in git2_features.h)
+
 set(UTIL_INCLUDES
-	"${PROJECT_BINARY_DIR}/src"
+	"${PROJECT_BINARY_DIR}/src/util"
 	"${PROJECT_SOURCE_DIR}/src/util"
 	"${PROJECT_SOURCE_DIR}/include")
 
diff --git a/src/util/git2_features.h.in b/src/util/git2_features.h.in
new file mode 100644
index 0000000..fbf0cab
--- /dev/null
+++ b/src/util/git2_features.h.in
@@ -0,0 +1,62 @@
+#ifndef INCLUDE_features_h__
+#define INCLUDE_features_h__
+
+#cmakedefine GIT_DEBUG_POOL 1
+#cmakedefine GIT_DEBUG_STRICT_ALLOC 1
+#cmakedefine GIT_DEBUG_STRICT_OPEN 1
+
+#cmakedefine GIT_THREADS 1
+#cmakedefine GIT_WIN32_LEAKCHECK 1
+
+#cmakedefine GIT_ARCH_64 1
+#cmakedefine GIT_ARCH_32 1
+
+#cmakedefine GIT_USE_ICONV 1
+#cmakedefine GIT_USE_NSEC 1
+#cmakedefine GIT_USE_STAT_MTIM 1
+#cmakedefine GIT_USE_STAT_MTIMESPEC 1
+#cmakedefine GIT_USE_STAT_MTIME_NSEC 1
+#cmakedefine GIT_USE_FUTIMENS 1
+
+#cmakedefine GIT_REGEX_REGCOMP_L
+#cmakedefine GIT_REGEX_REGCOMP
+#cmakedefine GIT_REGEX_PCRE
+#cmakedefine GIT_REGEX_PCRE2
+#cmakedefine GIT_REGEX_BUILTIN 1
+
+#cmakedefine GIT_QSORT_R_BSD
+#cmakedefine GIT_QSORT_R_GNU
+#cmakedefine GIT_QSORT_S
+
+#cmakedefine GIT_SSH 1
+#cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
+
+#cmakedefine GIT_NTLM 1
+#cmakedefine GIT_GSSAPI 1
+#cmakedefine GIT_GSSFRAMEWORK 1
+
+#cmakedefine GIT_WINHTTP 1
+#cmakedefine GIT_HTTPS 1
+#cmakedefine GIT_OPENSSL 1
+#cmakedefine GIT_OPENSSL_DYNAMIC 1
+#cmakedefine GIT_SECURE_TRANSPORT 1
+#cmakedefine GIT_MBEDTLS 1
+
+#cmakedefine GIT_SHA1_COLLISIONDETECT 1
+#cmakedefine GIT_SHA1_WIN32 1
+#cmakedefine GIT_SHA1_COMMON_CRYPTO 1
+#cmakedefine GIT_SHA1_OPENSSL 1
+#cmakedefine GIT_SHA1_OPENSSL_DYNAMIC 1
+#cmakedefine GIT_SHA1_MBEDTLS 1
+
+#cmakedefine GIT_SHA256_BUILTIN 1
+#cmakedefine GIT_SHA256_WIN32 1
+#cmakedefine GIT_SHA256_COMMON_CRYPTO 1
+#cmakedefine GIT_SHA256_OPENSSL 1
+#cmakedefine GIT_SHA256_OPENSSL_DYNAMIC 1
+#cmakedefine GIT_SHA256_MBEDTLS 1
+
+#cmakedefine GIT_RAND_GETENTROPY 1
+#cmakedefine GIT_RAND_GETLOADAVG 1
+
+#endif
diff --git a/src/util/git2_util.h b/src/util/git2_util.h
index ad3f1c7..c62dc24 100644
--- a/src/util/git2_util.h
+++ b/src/util/git2_util.h
@@ -7,8 +7,8 @@
 #ifndef INCLUDE_git2_util_h__
 #define INCLUDE_git2_util_h__
 
-#ifndef LIBGIT2_NO_FEATURES_H
-# include "git2/sys/features.h"
+#if !defined(LIBGIT2_NO_FEATURES_H)
+# include "git2_features.h"
 #endif
 
 #include "git2/common.h"