Improve "ext/digest/extconf.rb"

This commit is contained in:
Alex Kotov 2019-06-11 20:04:17 +05:00
parent d3a264d476
commit 61c2c18e6f
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

25
ext/digest/extconf.rb Normal file → Executable file
View file

@ -1,9 +1,26 @@
#!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
require 'mkmf' require 'mkmf'
have_header('ruby/digest.h') def cflags(*args)
have_func('rb_str_set_len') args.each do |str|
$CFLAGS += " #{str.shellescape} "
end
end
$CFLAGS << " -fvisibility=hidden" def have_header!(*args)
create_makefile('digest/keccak') exit 1 unless have_header(*args)
end
def have_func!(header, *args)
exit 1 unless have_func(*args, header)
end
cflags '-fvisibility=hidden'
have_header! 'ruby/digest.h'
have_func! 'rb_str_set_len'
create_makefile 'digest/keccak' or exit 1