Skip to content

Commit 03e2351

Browse files
author
Daniel Domjan
committed
RUBY-32941 Only append to $CPPFLAGS instead of overriding them
`with_cppflags()` overrides `$CPPFLAGS` with the given argument and restores the original flags upon return. This can lead to the accidental removal of some include paths like the include path of `jemalloc`, so instead of overriding the flags, we only want to append to them. Note, there is `append_cflags()`, but it first checks if the flag is valid by compiling a simple snippet that includes `ruby.h` with `-Werror`. The internal sources, however, can emit warnings, which cause the check to fail.
1 parent 69ec40e commit 03e2351

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/debase/ruby_core_source.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def self.create_makefile_with_core(hdrs, name)
2828
# Check if core headers were already downloaded; if so, use them
2929
if RbConfig::CONFIG["rubyhdrdir"]
3030
dest_dir = RbConfig::CONFIG["rubyhdrdir"] + "/" + ruby_dir
31-
with_cppflags("-I" + dest_dir) {
31+
with_cppflags("#{$CPPFLAGS} -I#{dest_dir}") {
3232
if hdrs.call
3333
create_makefile(name)
3434
return true
@@ -40,7 +40,7 @@ def self.create_makefile_with_core(hdrs, name)
4040
dest_dir = deduce_packaged_source_dir(ruby_dir)
4141
no_source_abort(ruby_dir) unless File.directory?(dest_dir)
4242

43-
with_cppflags("-I" + dest_dir) {
43+
with_cppflags("#{$CPPFLAGS} -I#{dest_dir}") {
4444
if hdrs.call
4545
create_makefile(name)
4646
return true

0 commit comments

Comments
 (0)