1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/ext/puma_http11/extconf.rb
Ruben Oliveira Chiavone 50185aec02
Fail build if compiling extensions raises warnings (#1953) (#2494)
* Fail build if compiling extensions raises warnings (#1953)

Make warning into errors and also fix all compiler warnings reported in
mini_ssl source code.

* Fix some compiler warnings and errors reported by checks

* Add MAKE_WARNINGS_INTO_ERRORS env variable

MAKE_WARNINGS_INTO_ERRORS environment variable toggles whether a build should
treat all warnings into errors or not.

Move appending WERRORFLAG to cflags after OpenSSL methods verification because
on some specifics builds this causes mkmf to wrongly detect methods in OpenSSL
headers.

* Add noentry to write date to avoid unused variables

* Ignore implicit-fallthrough warnings

Those warnings are related to ragel state machine generated code.

* Enforce no warnings on GH Actions

* Update History.md file reflecting latest changes
2020-12-01 06:51:16 -07:00

39 lines
1.2 KiB
Ruby

require 'mkmf'
dir_config("puma_http11")
if $mingw && RUBY_VERSION >= '2.4'
append_cflags '-fstack-protector-strong -D_FORTIFY_SOURCE=2'
append_ldflags '-fstack-protector-strong -l:libssp.a'
have_library 'ssp'
end
unless ENV["DISABLE_SSL"]
dir_config("openssl")
if %w'crypto libeay32'.find {|crypto| have_library(crypto, 'BIO_read')} and
%w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')}
have_header "openssl/bio.h"
# below is yes for 1.0.2 & later
have_func "DTLS_method" , "openssl/ssl.h"
# below are yes for 1.1.0 & later
have_func "TLS_server_method" , "openssl/ssl.h"
have_func "SSL_CTX_set_min_proto_version(NULL, 0)", "openssl/ssl.h"
end
end
if ENV["MAKE_WARNINGS_INTO_ERRORS"]
# Make all warnings into errors
# Except `implicit-fallthrough` since most failures comes from ragel state machine generated code
if respond_to? :append_cflags
append_cflags config_string 'WERRORFLAG'
append_cflags '-Wno-implicit-fallthrough'
else
$CFLAGS += ' ' << (config_string 'WERRORFLAG') << ' -Wno-implicit-fallthrough'
end
end
create_makefile("puma/puma_http11")