Skip to content

Commit

Permalink
nokogumbo-import: get cross-compiling working on windows
Browse files Browse the repository at this point in the history
Note that we're using a new feature in mini_portile 2.5.1 to pass
environment variables to `#execute` for the subprocess.

This allows us to pass a single command string to `Process.spawn` and
take advantage of the subshell's command substitution (e.g.,
rake-compiler's "MAKE=nice make -j`nproc`").

This also allows us to have environment variables with embedded spaces
without worrying about cross-platform escaping (e.g., "CFLAGS=-fPIC -g").
  • Loading branch information
flavorjones committed Apr 29, 2021
1 parent 19c1b02 commit 5c6f7c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/nokogiri/extconf.rb
Expand Up @@ -897,8 +897,10 @@ def install

def compile
cflags = concat_flags(ENV["CFLAGS"], "-fPIC", "-g")
command = [make_cmd, "CC=#{gcc_cmd}", "CFLAGS=#{cflags}"]
execute("compile", command)

env = {"CC" => gcc_cmd, "CFLAGS" => cflags}

execute("compile", make_cmd, {env: env})
end
end
end
Expand Down

0 comments on commit 5c6f7c1

Please sign in to comment.