Skip to content

Instantly share code, notes, and snippets.

@scottjg
Created January 27, 2013 09:35
Show Gist options
  • Save scottjg/4647558 to your computer and use it in GitHub Desktop.
Save scottjg/4647558 to your computer and use it in GitHub Desktop.
patch in charlock holmes to avoid using magic files
diff --git a/ext/charlock_holmes/encoding_detector.c b/ext/charlock_holmes/encoding_d
index 537e4a3..2c52e17 100644
--- a/ext/charlock_holmes/encoding_detector.c
+++ b/ext/charlock_holmes/encoding_detector.c
@@ -274,7 +274,7 @@ static VALUE rb_encdec__alloc(VALUE klass)
rb_raise(rb_eStandardError, "%s", u_errorName(status));
}
- detector->magic = magic_open(0);
+ detector->magic = magic_open(MAGIC_NO_CHECK_SOFT);
if (detector->magic == NULL) {
rb_raise(rb_eStandardError, "%s", magic_error(detector->magic));
}
diff --git a/ext/charlock_holmes/extconf.rb b/ext/charlock_holmes/extconf.rb
index f88049d..832322c 100644
--- a/ext/charlock_holmes/extconf.rb
+++ b/ext/charlock_holmes/extconf.rb
@@ -60,6 +60,7 @@ Dir.chdir("#{CWD}/src") do
sys("tar zxvf #{src}")
Dir.chdir(dir) do
sys("./configure --prefix=#{CWD}/dst/ --disable-shared --enable-static --with-pi
+ sys("patch -p0 < ../file-soft-check.patch")
sys("make -C src install")
sys("make -C magic install")
end
(END)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment