File: extconf.rb

package info (click to toggle)
ruby-rdiscount 2.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 412 kB
  • ctags: 578
  • sloc: ansic: 4,122; ruby: 447; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 1,188 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'mkmf'

dir_config('rdiscount')

have_library('markdown')

HAVE_RANDOM = have_func('random')
HAVE_SRANDOM = have_func('srandom')
HAVE_RAND = have_func('rand')
HAVE_SRAND = have_func('srand')

def sized_int(size, types)
  types.find { |type| check_sizeof(type) == 4 } ||
    abort("no int with size #{size}")
end

DWORD = sized_int(4, ["unsigned long", "unsigned int"])
WORD =  sized_int(2, ["unsigned int", "unsigned short"])
BYTE = "unsigned char"
VERSION = IO.read('VERSION').strip

open(File.join(File.dirname(__FILE__), "ruby-config.h"), "wb") do |f|
  f.write <<-EOF
// These data types may be already defined if building on Windows (using MinGW)
#ifndef DWORD
  #define DWORD #{DWORD}
#endif
#ifndef WORD
  #define WORD #{WORD}
#endif
#ifndef BYTE
  #define BYTE #{BYTE}
#endif
  EOF
end

$defs.push("-DVERSION=\\\"#{VERSION}\\\"")

# Post XCode 5.1 the command line tools on OS X treat unrecognised 
# command line options as errors and it's been seen that
# -multiply_definedsuppress can trickle from ruby build settings.
# Issue 115
if /darwin|mac os/.match RbConfig::CONFIG['host_os']
  $DLDFLAGS.gsub!("-multiply_definedsuppress", "")
end

create_makefile('rdiscount')