Class: MRuby::Build
- Inherits:
-
Object
- Object
- MRuby::Build
- Defined in:
- lib/mruby_utils/build_helpers.rb
Instance Method Summary collapse
-
#configure_libssh2(openssl: false, threading: false, zlib: true, tiny: false, debug: false, source: nil) ⇒ Void
Configures how to compile libssh2.
-
#enable_optimizations ⇒ Void
(also: #enable_optimisations)
Enable compiler optimizations.
-
#glibc_version=(version) ⇒ Void
Set the proper include headers to ensure that the binary wont depend on newer versions of glibc.
-
#static=(value) ⇒ Void
Set to true to enable static build instead of dynamic linking.
Instance Method Details
#configure_libssh2(openssl: false, threading: false, zlib: true, tiny: false, debug: false, source: nil) ⇒ Void
Configures how to compile libssh2.
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/mruby_utils/build_helpers.rb', line 77 def configure_libssh2(openssl: false, threading: false, zlib: true, tiny: false, debug: false, source: nil) linker.libraries << 'crypto' if openssl [cc, cxx].each do |cc| cc.defines << 'MRB_SSH_TINY' if tiny cc.defines += %w[LIBSSH2_HAVE_ZLIB ZLIB_STATIC HAVE_UNISTD_H] if zlib cc.defines += %w[MRB_SSH_LINK_CRYPTO LIBSSH2_OPENSSL] if openssl cc.defines += %w[MBEDTLS_THREADING_PTHREAD MBEDTLS_THREADING_C] if threading cc.defines += %w[LIBSSH2DEBUG MRB_SSH_DEBUG] if debug end ENV['LIBSSH2_SOURCE'] = source if source end |
#enable_optimizations ⇒ Void Also known as: enable_optimisations
Enable compiler optimizations.
30 31 32 33 34 |
# File 'lib/mruby_utils/build_helpers.rb', line 30 def enable_optimizations [cc, cxx].each do |cc| cc.flags << (toolchains.include?('clang') ? '-Oz' : '-Os') end end |
#glibc_version=(version) ⇒ Void
Set the proper include headers to ensure that the binary wont depend on newer versions of glibc.
param [ String ] version The maximun supported glibc version.
54 55 56 57 58 59 60 |
# File 'lib/mruby_utils/build_helpers.rb', line 54 def glibc_version=(version) return if !ENV['GLIBC_HEADERS'] || is_a?(CrossBuild) [cc, cxx].each do |cc| cc.flags << "-include #{ENV['GLIBC_HEADERS']}/x64/force_link_glibc_#{version}.h" end end |
#static=(value) ⇒ Void
Set to true to enable static build instead of dynamic linking.
43 44 45 46 |
# File 'lib/mruby_utils/build_helpers.rb', line 43 def static=(value) linker.flags_before_libraries << "-Wl,-B#{value ? 'static' : 'dynamic'}" linker.flags_after_libraries << '-Wl,-Bdynamic' end |