File tree 1 file changed +41
-0
lines changed
1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# :stopdoc:
5
5
6
+ def gcc?
7
+ RbConfig ::CONFIG [ "GCC" ] == "yes"
8
+ end
9
+
10
+ def disable_optimization_build_flag ( flags )
11
+ if gcc?
12
+ expanded_flags = RbConfig . expand ( flags . dup )
13
+ optimization_option_pattern = /(^|\s )?-O\d (\s |$)?/
14
+ if optimization_option_pattern . match? ( expanded_flags )
15
+ expanded_flags . gsub ( optimization_option_pattern , '\\1-Og\\2' )
16
+ else
17
+ flags + " -Og"
18
+ end
19
+ else
20
+ flags
21
+ end
22
+ end
23
+
24
+ def enable_debug_build_flag ( flags )
25
+ if gcc?
26
+ expanded_flags = RbConfig . expand ( flags . dup )
27
+ debug_option_pattern = /(^|\s )-g(?:gdb)?\d ?(\s |$)/
28
+ if debug_option_pattern . match? ( expanded_flags )
29
+ expanded_flags . gsub ( debug_option_pattern , '\\1-ggdb3\\2' )
30
+ else
31
+ flags + " -ggdb3"
32
+ end
33
+ else
34
+ flags
35
+ end
36
+ end
37
+
38
+ checking_for ( checking_message ( "--enable-debug-build option" ) ) do
39
+ enable_debug_build = enable_config ( "debug-build" , false )
40
+ if enable_debug_build
41
+ $CFLAGS = disable_optimization_build_flag ( $CFLAGS)
42
+ $CFLAGS = enable_debug_build_flag ( $CFLAGS)
43
+ end
44
+ enable_debug_build
45
+ end
46
+
6
47
libffi_version = nil
7
48
have_libffi = false
8
49
bundle = enable_config ( 'bundled-libffi' )
You can’t perform that action at this time.
0 commit comments