Skip to content

Instantly share code, notes, and snippets.

@taf2
Created November 19, 2009 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taf2/238745 to your computer and use it in GitHub Desktop.
Save taf2/238745 to your computer and use it in GitHub Desktop.
diff --git a/ext/extconf.rb b/ext/extconf.rb
index 9b1db02..1a82c42 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -17,6 +17,17 @@ elsif !have_library('curl') or !have_header('curl/curl.h')
EOM
end
+# Check arch flags
+archs = $CFLAGS.scan(/-arch\s(.*?)\s/).first # get the first arch flag
+if archs and archs.size >= 1
+ # need to reduce the number of archs...
+ # guess the first one is correct... at least the first one is probably the ruby installed arch...
+ # this could lead to compiled binaries that crash at runtime...
+ $CFLAGS.gsub!(/-arch\s(.*?)\s/,' ')
+ $CFLAGS << " -arch #{archs.first}"
+ puts "Selected arch: #{archs.first}"
+end
+
def define(s)
$defs.push( format("-D HAVE_%s", s.to_s.upcase) )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment