Skip to content

Commit

Permalink
Merge pull request #897 from leshik/fix-cc
Browse files Browse the repository at this point in the history
Allow overriding `gcc` with the `CC` env var in `const_generator.rb` and `struct_generator.rb`
  • Loading branch information
larskanis committed Apr 15, 2021
2 parents 2cc0e53 + 928e3f9 commit 4430b6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/ffi/tools/const_generator.rb
Expand Up @@ -124,7 +124,8 @@ def calculate(options = {})
f.puts "\n\treturn 0;\n}"
f.flush

output = `gcc #{options[:cppflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1`
cc = ENV['CC'] || 'gcc'
output = `#{cc} #{options[:cppflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1`

unless $?.success? then
output = output.split("\n").map { |l| "\t#{l}" }.join "\n"
Expand Down
3 changes: 2 additions & 1 deletion lib/ffi/tools/struct_generator.rb
Expand Up @@ -82,7 +82,8 @@ def calculate(options = {})
f.puts "\n return 0;\n}"
f.flush

output = `gcc #{options[:cppflags]} #{options[:cflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1`
cc = ENV['CC'] || 'gcc'
output = `#{cc} #{options[:cppflags]} #{options[:cflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1`

unless $?.success? then
@found = false
Expand Down

0 comments on commit 4430b6d

Please sign in to comment.