Permalink
Browse files

Use submodule for libgit2 instead of tgz

Avoids needing `tar` on Windows.
  • Loading branch information...
1 parent 0698efe commit 5ebfbc878943535251ab24b62e6915ec86002961 @scottjg scottjg committed Jun 22, 2012
Showing with 15 additions and 22 deletions.
  1. +3 −0 .gitmodules
  2. +0 −8 Rakefile
  3. +5 −13 ext/rugged/extconf.rb
  4. BIN ext/rugged/vendor/libgit2-dist.tar.gz
  5. +6 −1 rugged.gemspec
  6. +1 −0 vendor/libgit2
View
@@ -0,0 +1,3 @@
+[submodule "vendor/libgit2"]
+ path = vendor/libgit2
+ url = https://github.com/libgit2/libgit2.git
View
@@ -30,14 +30,6 @@ end
#
task :default => [:compile, :test]
-task :pack_dist do
- dir = File.dirname(File.expand_path(__FILE__))
- output = File.join(dir, 'ext', 'rugged', 'vendor', 'libgit2-dist.tar.gz')
- Dir.chdir(ENV['LIBGIT2_PATH']) do
- `git archive --format=tar --prefix=libgit2-dist/ HEAD | gzip > #{output}`
- end
-end
-
task :cover do
ruby 'test/coverage/cover.rb'
end
View
@@ -16,31 +16,23 @@ def sys(cmd)
if p = ENV['LIBGIT2_PATH']
$INCFLAGS[0,0] = " -I#{File.join(p, 'include')} "
$LDFLAGS << " -L#{p} "
-
unless have_library 'git2' and have_header 'git2.h'
STDERR.puts "ERROR: Invalid `LIBGIT2_PATH` environment"
exit(1)
end
else
CWD = File.expand_path(File.dirname(__FILE__))
-
- LIBGIT2_DIST = 'libgit2-dist.tar.gz'
- LIBGIT2_DIR = File.basename(LIBGIT2_DIST, '.tar.gz')
+ LIBGIT2_DIR = File.join(CWD, '..', '..', 'vendor', 'libgit2')
LIBGIT2_LIB_PATH = "#{CWD}/libgit2_embed.a"
if !File.exists?(LIBGIT2_LIB_PATH)
- Dir.chdir("#{CWD}/vendor") do
- FileUtils.rm_rf(LIBGIT2_DIR) if File.exists?(LIBGIT2_DIR)
-
- sys("tar zxvf #{LIBGIT2_DIST}")
- Dir.chdir(LIBGIT2_DIR) do
- sys("make -f Makefile.embed")
- FileUtils.cp "libgit2.a", LIBGIT2_LIB_PATH
- end
+ Dir.chdir(LIBGIT2_DIR) do
+ sys("make -f Makefile.embed")
+ FileUtils.cp 'libgit2.a', LIBGIT2_LIB_PATH
end
end
- $INCFLAGS[0,0] = " -I#{CWD}/vendor/#{LIBGIT2_DIR}/include "
+ $INCFLAGS[0,0] = " -I#{LIBGIT2_DIR}/include "
$LDFLAGS << " -L#{CWD} "
unless have_library 'git2_embed' and have_header 'git2.h'
Binary file not shown.
View
@@ -13,7 +13,12 @@ Gem::Specification.new do |s|
s.files += Dir.glob("man/**/*")
s.files += Dir.glob("test/**/*")
s.files += Dir.glob("ext/**/*.c") + Dir.glob("ext/**/*.h")
- s.files += ['ext/rugged/vendor/libgit2-dist.tar.gz']
+ s.files += Dir.glob("vendor/libgit2/include/**/*.h")
+ s.files += Dir.glob("vendor/libgit2/src/**/*.h")
+ s.files += Dir.glob("vendor/libgit2/src/**/*.c")
+ s.files += Dir.glob("vendor/libgit2/deps/**/*.h")
+ s.files += Dir.glob("vendor/libgit2/deps/**/*.c")
+ s.files += Dir.glob("vendor/libgit2/Makefile.embed")
s.extensions = ['ext/rugged/extconf.rb']
s.description = <<desc
Rugged is a Ruby bindings to the libgit2 linkable C Git library. This is
Submodule libgit2 added at 430af7

0 comments on commit 5ebfbc8

Please sign in to comment.