Module: ExtconfHelper

Defined in:
ext/altprintf/extconf_helper.rb

Constant Summary collapse

BASE_DIR =
File.join(__dir__, '../../../')
SRC_DIR =
File.join(BASE_DIR, 'subprojects/libaltprintf/src/')
BUILD_DIR =
File.join(BASE_DIR, 'build')
LIB_DIR =
File.join(BUILD_DIR, 'subprojects/libaltprintf/')
INC_DIR =
File.join(BASE_DIR, 'subprojects/libaltprintf/include')

Class Method Summary collapse

Class Method Details

.dev_setupObject



12
13
14
15
16
17
18
19
20
21
22
# File 'ext/altprintf/extconf_helper.rb', line 12

def dev_setup
  unless find_header('altprintf.h', INC_DIR)
    $stderr.puts("couldn't find header 'altprintf.h'")
    exit(1)
  end

  unless find_library('altprintf', 'apf_parse', LIB_DIR)
    $stderr.puts("you haven't built libaltprintf yet")
    exit(1)
  end
end

.setup(mode = 'release') ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'ext/altprintf/extconf_helper.rb', line 24

def setup(mode = 'release')
  puts "extconf setting up #{mode}"
  case mode
  when 'release'
    # do nothing
  when 'dev'
    dev_setup
  else
    raise(ArgumentError, "invalid mode #{mode}")
  end

  create_header
  create_makefile('altprintf/altprintf')
end