ext/dualcone/extconf.rb in dualcone-0.0.1 vs ext/dualcone/extconf.rb in dualcone-1.0.0
- old
+ new
@@ -1,35 +1,36 @@
# frozen_string_literal: true
require 'mkmf'
+# :stopdoc:
+
cflags = %w[
- -march=native -fno-exceptions -pipe
- -fstack-protector-strong -fPIC -Wall -Werror
- -Wno-missing-braces
+ -march=native -mtune=generic -pipe -fno-plt
+ -fstack-protector-strong -fPIC
]
if ENV['DEBUG']
cflags.unshift('-O0', '-g')
else
- cflags.unshift('-Os')
+ cflags.unshift('-O2')
end
-LIBHYDROGEN_DIR = File.join(__dir__, '..', '..', 'vendor', 'libhydrogen')
+libhydrogen_dir = File.join(__dir__, '..', '..', 'vendor', 'libhydrogen')
abort 'ERROR: make is required to build libhydrogen.' unless find_executable('make')
append_cflags(cflags)
# Build the bundled version of libhydrogen in vendor
-Dir.chdir(LIBHYDROGEN_DIR) do
+Dir.chdir(libhydrogen_dir) do
system('make clean')
system("export CFLAGS='#{cflags.join(' ')}'; make")
system('PREFIX=. make install')
# Ensure that our bundled version of libhydrogen is always used
- $DEFLIBPATH.unshift("#{LIBHYDROGEN_DIR}/lib")
- dir_config('hydrogen', "#{LIBHYDROGEN_DIR}/include", "#{LIBHYDROGEN_DIR}/lib")
+ $DEFLIBPATH.unshift("#{libhydrogen_dir}/lib")
+ dir_config('hydrogen', "#{libhydrogen_dir}/include", "#{libhydrogen_dir}/lib")
end
abort 'ERROR: Failed to build libhydrogen.' unless have_library('hydrogen') && have_header('hydrogen.h')
create_makefile('dualcone/dualcone')