Skip to content

Commit 5fee507

Browse files
author
Pete Walter
committed
ext: Fix the build with system libgit2 1.9.0
Update version.h parsing regexes for 1.9.0 and fix compilation test by including git2.h instead of directly including git2/version.h, which is no longer supported.
1 parent 762fd37 commit 5fee507

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/rugged/extconf.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ def self.run_cmake(timeout, args)
7171
major = minor = nil
7272

7373
File.readlines(File.join(LIBGIT2_DIR, "include", "git2", "version.h")).each do |line|
74-
if !major && (matches = line.match(/^#define LIBGIT2_VER_MAJOR\s+([0-9]+)$/))
74+
if !major && (matches = line.match(/^#define LIBGIT2_VERSION_MAJOR\s+([0-9]+)$/))
7575
major = matches[1]
7676
next
7777
end
7878

79-
if !minor && (matches = line.match(/^#define LIBGIT2_VER_MINOR\s+([0-9]+)$/))
79+
if !minor && (matches = line.match(/^#define LIBGIT2_VERSION_MINOR\s+([0-9]+)$/))
8080
minor = matches[1]
8181
next
8282
end
@@ -85,9 +85,9 @@ def self.run_cmake(timeout, args)
8585
end
8686

8787
try_compile(<<-SRC) or abort "libgit2 version is not compatible, expected ~> #{major}.#{minor}.0"
88-
#include <git2/version.h>
88+
#include <git2.h>
8989
90-
#if LIBGIT2_VER_MAJOR != #{major} || LIBGIT2_VER_MINOR != #{minor}
90+
#if LIBGIT2_VERSION_MAJOR != #{major} || LIBGIT2_VERSION_MINOR != #{minor}
9191
#error libgit2 version is not compatible
9292
#endif
9393
SRC

0 commit comments

Comments
 (0)