diff --git a/ext/quickjsrb/extconf.rb b/ext/quickjsrb/extconf.rb index 2f3efea..2736707 100644 --- a/ext/quickjsrb/extconf.rb +++ b/ext/quickjsrb/extconf.rb @@ -16,25 +16,34 @@ append_cflags('-I$(srcdir)/quickjs') -append_cflags('-fwrapv') + append_cflags('-g') append_cflags('-O2') append_cflags('-Wall') append_cflags('-MMD') append_cflags('-MF') -append_cflags('-Wextra') -append_cflags('-Wno-sign-compare') -append_cflags('-Wno-missing-field-initializers') -append_cflags('-Wundef -Wuninitialized') -append_cflags('-Wunused -Wno-unused-parameter') -append_cflags('-Wwrite-strings') -append_cflags('-Wchar-subscripts -funsigned-char') -append_cflags('-D_GNU_SOURCE -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM') + +case CONFIG['arch'] +when /darwin/ + append_cflags('-Wextra') + append_cflags('-Wno-sign-compare') + append_cflags('-Wno-missing-field-initializers') + append_cflags('-Wundef -Wuninitialized') + append_cflags('-Wunused -Wno-unused-parameter') + append_cflags('-Wwrite-strings') + append_cflags('-Wchar-subscripts -funsigned-char') +else + append_cflags('-Wno-array-bounds -Wno-format-truncation') +end + +append_cflags('-fwrapv') +#$defs.push('-D_GNU_SOURCE -DCONFIG_VERSION=\"2024-02-14\"') +#$defs.push('-DCONFIG_BIGNUM') +$CFLAGS << ' ' << '-D_GNU_SOURCE -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM' abort('could not find quickjs.h') unless find_header('quickjs.h') abort('could not find cutils.h') unless find_header('cutils.h') abort('could not find quickjs-libc.h') unless find_header('quickjs-libc.h') -#abort('could not find libbf.h') unless find_header('libbf.h') # Makes all symbols private by default to avoid unintended conflict # with other gems. To explicitly export symbols you can use RUBY_FUNC_EXPORTED