Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save luislavena/741352 to your computer and use it in GitHub Desktop.
Save luislavena/741352 to your computer and use it in GitHub Desktop.
From b58b1e80ed916ab269efc46e117de3c7e5ac4ea6 Mon Sep 17 00:00:00 2001
From: Luis Lavena <luislavena@gmail.com>
Date: Tue, 14 Dec 2010 20:37:56 -0300
Subject: [PATCH 2/2] Explode if libgit2 or zlib are missing
Makefile should not be created if one of these libraries
are missing.
Add proper checks and better message on failure.
---
ext/rugged/extconf.rb | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/ext/rugged/extconf.rb b/ext/rugged/extconf.rb
index 8244b56..4432edb 100644
--- a/ext/rugged/extconf.rb
+++ b/ext/rugged/extconf.rb
@@ -1,9 +1,20 @@
require 'mkmf'
-dir_config("rugged")
+dir_config("git2")
+dir_config("z")
-have_library("git2")
-have_library('z')
+def asplode(missing)
+ abort <<-error
+#{missing} is missing, Try installing or compiling it first.
+You can provide configuration options to alternate places:
-create_makefile("rugged/rugged")
+ --with-git2-dir=...
+ --with-z-dir=...
+
+error
+end
+asplode('libgit2') unless have_library("git2")
+asplode('zlib') unless have_library('z')
+
+create_makefile("rugged/rugged")
--
1.7.3.1.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment