Skip to content

Commit b551eb8

Browse files
committed
Append flags from environment variables.
According to the `mkmf.rb#init_mkmf`, there are command line options below. * `--with-cflags` to set the `cflags` * `--with-ldflags` to set the `ldflags` For example the following command compiles with the specified flags. Note that `MAKEFLAGS` is to print the compiler command lines. ``` $ MAKEFLAGS="V=1" \ bundle exec rake compile -- \ --with-cflags="-Wundef -Werror" \ --with-ldflags="-fstack-protector" ``` However, I couldn't find command line options to append the flags. And this commit is to append the `cflags` and `ldflags` by the environment variables. ``` $ MAKEFLAGS="V=1" \ RUBY_OPENSSL_EXTCFLAGS="-Wundef -Werror" \ RUBY_OPENSSL_EXTLDFLAGS="-fstack-protector" \ bundle exec rake compile ```
1 parent 22e601a commit b551eb8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/openssl/extconf.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919
Logging::message "=== OpenSSL for Ruby configurator ===\n"
2020

21+
# Append flags from environment variables.
22+
extcflags = ENV["RUBY_OPENSSL_EXTCFLAGS"]
23+
append_cflags(extcflags.split) if extcflags
24+
extldflags = ENV["RUBY_OPENSSL_EXTLDFLAGS"]
25+
append_ldflags(extldflags.split) if extldflags
26+
2127
##
2228
# Adds -DOSSL_DEBUG for compilation and some more targets when GCC is used
2329
# To turn it on, use: --with-debug or --enable-debug

0 commit comments

Comments
 (0)