Class: RubyWasm::OpenSSLProduct
- Inherits:
-
AutoconfProduct
- Object
- BuildProduct
- AutoconfProduct
- RubyWasm::OpenSSLProduct
- Defined in:
- lib/ruby_wasm/build/product/openssl.rb
Constant Summary collapse
- OPENSSL_VERSION =
"3.2.0"
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #build(executor) ⇒ Object
- #configure_args ⇒ Object
- #destdir ⇒ Object
-
#initialize(build_dir, target, toolchain) ⇒ OpenSSLProduct
constructor
A new instance of OpenSSLProduct.
- #install_root ⇒ Object
- #name ⇒ Object
- #product_build_dir ⇒ Object
Methods inherited from AutoconfProduct
#system_triplet_args, #tools_args
Constructor Details
#initialize(build_dir, target, toolchain) ⇒ OpenSSLProduct
Returns a new instance of OpenSSLProduct.
9 10 11 12 13 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 9 def initialize(build_dir, target, toolchain) @build_dir = build_dir @target = target super(target, toolchain) end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 5 def target @target end |
Instance Method Details
#build(executor) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 63 def build(executor) return if File.exist?(File.join(install_root, "lib", "libssl.a")) executor.mkdir_p File.dirname(product_build_dir) executor.rm_rf product_build_dir executor.mkdir_p product_build_dir tarball_path = File.join(product_build_dir, "openssl-#{OPENSSL_VERSION}.tar.gz") executor.system "curl", "-o", tarball_path, "-L", "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz" executor.system "tar", "xzf", tarball_path, "-C", product_build_dir, "--strip-components=1" executor.system "./Configure", *configure_args, chdir: product_build_dir # Use "install_sw" instead of "install" because it tries to install docs and it's very slow. # OpenSSL build system doesn't have well support for parallel build, so force -j1. executor.system "make", "-j1", "install_dev", "DESTDIR=#{destdir}", chdir: product_build_dir end |
#configure_args ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 31 def configure_args args = %w[ gcc -static -no-asm -no-threads -no-afalgeng -no-ui-console -no-tests -no-sock -no-dgram --libdir=lib -Wl,--allow-undefined ] if @target.triple.start_with?("wasm32-unknown-wasi") args.concat %w[ -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_GETPID -DNO_CHMOD -DHAVE_FORK=0 ] end if @target.pic? args << "-fPIC" end args + tools_args end |
#destdir ⇒ Object
19 20 21 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 19 def destdir File.join(product_build_dir, "opt") end |
#install_root ⇒ Object
23 24 25 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 23 def install_root File.join(destdir, "usr", "local") end |
#name ⇒ Object
27 28 29 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 27 def name "openssl-#{OPENSSL_VERSION}-#{target}" end |
#product_build_dir ⇒ Object
15 16 17 |
# File 'lib/ruby_wasm/build/product/openssl.rb', line 15 def product_build_dir File.join(@build_dir, target.to_s, "openssl-#{OPENSSL_VERSION}") end |