ext/libyajl2/extconf.rb in libyajl2-1.2.0 vs ext/libyajl2/extconf.rb in libyajl2-2.0.0
- old
+ new
@@ -1,8 +1,9 @@
-require 'rbconfig'
-require 'fileutils'
+require "rbconfig"
+require "fileutils"
+require "shellwords"
if ENV["USE_SYSTEM_LIBYAJL2"]
File.open("Makefile", "w+") do |f|
f.write <<EOF
# dummy Makefile when we're not really installing
@@ -30,25 +31,25 @@
def self.libyajl2_vendor_dir
LIBYAJL2_VENDOR_DIR
end
def self.prefix
- PREFIX
+ PREFIX.shellescape
end
def self.deps
- require 'mkmf'
+ require "mkmf"
end
def self.setup_env
- RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
+ RbConfig::MAKEFILE_CONFIG["CC"] = ENV["CC"] if ENV["CC"]
# set some sane defaults
- if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc|clang/
+ if RbConfig::MAKEFILE_CONFIG["CC"] =~ /gcc|clang/
# magic flags copied from upstream yajl build system (-std=c99 is necessary for older gcc)
$CFLAGS << " -std=c99 -pedantic -Wpointer-arith -Wno-format-y2k -Wstrict-prototypes -Wmissing-declarations -Wnested-externs -Wextra -Wundef -Wwrite-strings -Wold-style-definition -Wredundant-decls -Wno-unused-parameter -Wno-sign-compare -Wmissing-prototypes"
- $CFLAGS << " -O2" # match what the upstream uses for optimization
+ $CFLAGS << " -O2" # match what the upstream uses for optimization
# create the implib on windows
if windows?
$LDFLAGS << " -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--out-implib=libyajldll.a -Wl,--output-def,libyajl.def"
end
@@ -93,11 +94,11 @@
# on windows the Makefile will try to export Init_libyajl which is wrong because we aren't a ruby lib.
# i could not figure out how to tell mkmf.rb to stop being so helpful, so instead will just patch it here.
if windows?
makefile = IO.read("Makefile")
- makefile.gsub!(/\$\(DEFFILE\)/, '')
- File.open("Makefile", 'w+') {|f| f.write(makefile) }
+ makefile.gsub!(/\$\(DEFFILE\)/, "")
+ File.open("Makefile", "w+") { |f| f.write(makefile) }
end
system("pwd")
# we cheat and build it right away...
system("make >make.out 2>&1") || raise # rubinius doesn't like the output this generates