2019-06-11 11:04:17 -04:00
|
|
|
#!/usr/bin/env ruby
|
2019-06-08 08:00:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2012-10-04 08:00:56 -04:00
|
|
|
require 'mkmf'
|
2013-05-20 10:57:41 -04:00
|
|
|
|
2019-06-11 11:04:17 -04:00
|
|
|
def cflags(*args)
|
|
|
|
args.each do |str|
|
|
|
|
$CFLAGS += " #{str.shellescape} "
|
|
|
|
end
|
|
|
|
end
|
2013-05-20 10:57:41 -04:00
|
|
|
|
2019-06-11 11:04:17 -04:00
|
|
|
def have_header!(*args)
|
|
|
|
exit 1 unless have_header(*args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def have_func!(header, *args)
|
|
|
|
exit 1 unless have_func(*args, header)
|
|
|
|
end
|
|
|
|
|
2019-06-11 11:18:38 -04:00
|
|
|
cflags '-std=c11'
|
|
|
|
cflags '-Wall'
|
|
|
|
cflags '-Wextra'
|
2019-06-11 11:04:17 -04:00
|
|
|
cflags '-fvisibility=hidden'
|
|
|
|
|
|
|
|
have_header! 'ruby/digest.h'
|
2019-06-11 11:14:45 -04:00
|
|
|
have_header! 'stdio.h'
|
|
|
|
have_header! 'string.h'
|
2019-06-11 11:04:17 -04:00
|
|
|
|
|
|
|
have_func! 'rb_str_set_len'
|
|
|
|
|
|
|
|
create_makefile 'digest/keccak' or exit 1
|