Top Level Namespace

Defined Under Namespace

Modules: OS, PandocRb

Constant Summary collapse

LIBDIR =
INCLUDEDIR =
HEADER_DIRS =
[
  File.join(stack_path['compiler-lib'], stack_path['compiler'], "rts"),
  File.join(stack_path['local-install-root'], "bin"),

  # /home/hsolo/.stack/programs/x86_64-linux/ghc-8.0.2/lib/ghc-8.0.2/include/
  File.join(stack_path['compiler-lib'], stack_path['compiler'], "include"),

  # .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/PandocRb.dylib/PandocRb.dylib-tmp/
  File.join(stack_path['dist-dir'], "build/PandocRb.dylib/PandocRb.dylib-tmp"),

  # Then search /usr/local for people that installed from source
  '/usr/local/include',

  # Check the ruby install locations
  INCLUDEDIR,

  # Finally fall back to /usr
  '/usr/include',
]
LIB_DIRS =
[
  # /home/hsolo/.stack/programs/x86_64-linux/ghc-8.0.2/lib/ghc-8.0.2/rts/
  File.join(stack_path['compiler-lib'], stack_path['compiler'], "rts"),
  File.join(stack_path['local-install-root'], "bin"),
  File.join(stack_path['dist-dir'], "build/PandocRb.dylib/PandocRb.dylib-tmp"), # PandocRb_stub.h
  File.join(stack_path['compiler-lib'], stack_path['compiler'], "include"),

  # First search /opt/local for macports
  '/opt/local/lib',

  # Then search /usr/local for people that installed from source
  '/usr/local/lib',

  # Check the ruby install locations
  LIBDIR,

  # Finally fall back to /usr
  '/usr/lib',
]

Instance Method Summary collapse

Instance Method Details

#stack_pathObject



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'ext/pandoc_rb/extconf.rb', line 42

def stack_path
  @stack_path ||= begin
    Dir.chdir(__dir__) do
      temp_stack_path = `stack path`.lines.map do |line|
        /^(?<var>[^:]+): (?<val>.*)$/ =~ line.chomp
        [var, File.absolute_path(val)]
      end.to_h
      temp_stack_path['compiler-lib'] = temp_stack_path['compiler-bin'].sub(/bin$/, 'lib')
      temp_stack_path['compiler'] = temp_stack_path['compiler-bin'].sub(/^.*\/([^\/]+)\/bin$/, '\1')
      temp_stack_path
    end
  end
end

#system_indent(command) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'ext/pandoc_rb/extconf.rb', line 26

def system_indent(command)
  puts "running #{command}"
  exit_status = system command
  if exit_status
    puts "ran #{command}"
  else
    puts ["failed:", "<command>", command.split(' '), "</command>"].flatten
    raise "#{command} failed"
  end
  exit_status
end