File: extconf.rb

package info (click to toggle)
ruby-liquid-c 4.2.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 544 kB
  • sloc: ansic: 3,866; ruby: 1,135; makefile: 7
file content (26 lines) | stat: -rwxr-xr-x 1,006 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

require "mkmf"
$CFLAGS << " -std=c11 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-incompatible-pointer-types"
append_cflags("-fvisibility=hidden")
# In Ruby 2.6 and earlier, the Ruby headers did not have struct timespec defined
valid_headers = RbConfig::CONFIG["host_os"] !~ /linux/ || Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7")
pedantic = !ENV["LIQUID_C_PEDANTIC"].to_s.empty?
if pedantic && valid_headers
  $CFLAGS << " -Werror"
end
if ENV["DEBUG"] == "true"
  append_cflags("-fbounds-check")
  CONFIG["optflags"] = " -O0"
  # Hack to enable assertions since ruby/assert.h disables assertions unless
  # Ruby was compiled with -DRUBY_DEBUG.
  # https://github.com/ruby/ruby/blob/9e678cdbd054f78576a8f21b3f97cccc395ade22/include/ruby/assert.h#L36-L41
  $CFLAGS << " -DRUBY_DEBUG"
else
  $CFLAGS << " -DNDEBUG"
end

have_func "rb_hash_bulk_insert"

$warnflags&.gsub!(/-Wdeclaration-after-statement/, "")
create_makefile("liquid_c")