Skip to content

Commit 212e07d

Browse files
committed
ext: hack to cross-compile zlib v1.2.13 on darwin
1 parent 76dbc8c commit 212e07d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ext/nokogiri/extconf.rb

+11-3
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,17 @@ def install
712712
else
713713
class << recipe
714714
def configure
715-
cflags = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
716-
execute("configure",
717-
["env", "CHOST=#{host}", "CFLAGS=#{cflags}", "./configure", "--static", configure_prefix])
715+
env = {}
716+
env["CFLAGS"] = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
717+
env["CHOST"] = host
718+
execute("configure", ["./configure", "--static", configure_prefix], { env: env })
719+
if darwin?
720+
# needed as of zlib 1.2.13
721+
Dir.chdir(work_path) do
722+
makefile = File.read("Makefile").gsub(/^AR=.*$/, "AR=#{host}-libtool")
723+
File.open("Makefile", "w") { |m| m.write(makefile) }
724+
end
725+
end
718726
end
719727
end
720728
end

0 commit comments

Comments
 (0)