Skip to content

Commit b4071b4

Browse files
committed
Add openssl 3.5 builds
1 parent 765c402 commit b4071b4

File tree

4 files changed

+187
-2
lines changed

4 files changed

+187
-2
lines changed

configs/components/openssl-3.5.rb

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
#####
2+
# Component release information:
3+
# https://github.com/openssl/openssl/releases
4+
# 3.5 isn't latest openssl, but latest LTS: https://openssl-library.org/policies/releasestrat/index.html
5+
#####
6+
component 'openssl' do |pkg, settings, platform|
7+
pkg.version '3.5.5'
8+
pkg.sha256sum 'b28c91532a8b65a1f983b4c28b7488174e4a01008e29ce8e69bd789f28bc2a89'
9+
pkg.url "https://github.com/openssl/openssl/releases/download/openssl-#{pkg.get_version}/openssl-#{pkg.get_version}.tar.gz"
10+
pkg.mirror "#{settings[:buildsources_url]}/openssl-#{pkg.get_version}.tar.gz"
11+
12+
#############################
13+
# ENVIRONMENT, FLAGS, TARGETS
14+
#############################
15+
16+
if platform.name =~ /^(amazon-|el-|redhat-|redhatfips-|fedora-)/
17+
pkg.build_requires 'perl-core'
18+
elsif platform.is_solaris?
19+
# perl is installed in platform definition
20+
else
21+
pkg.build_requires 'perl'
22+
end
23+
24+
target = sslflags = ''
25+
cflags = settings[:cflags]
26+
ldflags = settings[:ldflags]
27+
28+
if platform.is_windows?
29+
pkg.environment 'PATH', "$(shell cygpath -u #{settings[:gcc_bindir]}):$(PATH)"
30+
pkg.environment 'CYGWIN', settings[:cygwin]
31+
pkg.environment 'MAKE', platform[:make]
32+
33+
target = platform.architecture == 'x64' ? 'mingw64' : 'mingw'
34+
elsif platform.is_aix?
35+
# REMIND: why not PATH?
36+
pkg.environment 'CC', '/opt/freeware/bin/gcc'
37+
38+
cflags = "#{settings[:cflags]} -static-libgcc"
39+
# see https://github.com/openssl/openssl/issues/18007 about -latomic
40+
# see https://www.ibm.com/docs/en/aix/7.2?topic=l-ld-command about -R<path>, which is equivalent to -rpath
41+
ldflags = "#{settings[:ldflags]} -Wl,-R#{settings[:libdir]} -latomic -lm"
42+
target = 'aix-gcc'
43+
elsif platform.is_solaris?
44+
pkg.environment 'PATH', '/opt/csw/bin:$(PATH):/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin'
45+
if !platform.is_cross_compiled? && platform.architecture == 'sparc'
46+
pkg.environment 'CC', '/opt/pl-build-tools/bin/gcc'
47+
gcc_lib = "/opt/pl-build-tools/#{settings[:platform_triple]}/lib"
48+
else
49+
pkg.environment 'CC', '/opt/csw/bin/gcc'
50+
gcc_lib = "/opt/csw/#{settings[:platform_triple]}/lib"
51+
end
52+
cflags = "#{settings[:cflags]} -fPIC"
53+
ldflags = "-R#{gcc_lib} -Wl,-rpath=#{settings[:libdir]} -L#{gcc_lib}"
54+
target = platform.architecture =~ /86/ ? 'solaris-x86-gcc' : 'solaris-sparcv9-gcc'
55+
elsif platform.is_macos?
56+
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
57+
pkg.environment 'CFLAGS', settings[:cflags]
58+
pkg.environment 'CC', settings[:cc]
59+
pkg.environment 'MACOSX_DEPLOYMENT_TARGET', settings[:deployment_target]
60+
61+
target = if platform.architecture == 'arm64'
62+
'darwin64-arm64'
63+
else
64+
'darwin64-x86_64'
65+
end
66+
elsif platform.is_linux?
67+
pkg.environment 'PATH', '/opt/pl-build-tools/bin:$(PATH):/usr/local/bin'
68+
69+
ldflags = "#{settings[:ldflags]} -Wl,-z,relro"
70+
case platform.architecture
71+
when /86$/
72+
target = 'linux-elf'
73+
sslflags = '386'
74+
when /aarch64$/
75+
target = 'linux-aarch64'
76+
when /ppc64le|ppc64el/ # Little-endian
77+
target = 'linux-ppc64le'
78+
when /64$/
79+
target = 'linux-x86_64'
80+
when 'armhf'
81+
target = 'linux-armv4'
82+
end
83+
end
84+
85+
####################
86+
# BUILD REQUIREMENTS
87+
####################
88+
89+
pkg.build_requires "runtime-#{settings[:runtime_project]}"
90+
91+
###########
92+
# CONFIGURE
93+
###########
94+
95+
# Defining --libdir ensures that we avoid the multilib (lib/ vs. lib64/) problem,
96+
# since configure uses the existence of a lib64 directory to determine
97+
# if it should install its own libs into a multilib dir. Yay OpenSSL!
98+
configure_flags = [
99+
"--prefix=#{settings[:prefix]}",
100+
'--libdir=lib',
101+
"--openssldir=#{settings[:prefix]}/ssl",
102+
'shared',
103+
'no-gost',
104+
target,
105+
sslflags,
106+
'no-camellia',
107+
'no-md2',
108+
'no-ssl3',
109+
'no-ssl3-method',
110+
'no-dtls1-method',
111+
'no-dtls1_2-method',
112+
'no-aria',
113+
'no-bf',
114+
'no-cast',
115+
'no-des',
116+
'no-rc5',
117+
'no-mdc2',
118+
'no-rmd160',
119+
'no-whirlpool'
120+
]
121+
122+
if settings[:use_legacy_openssl_algos]
123+
pkg.apply_patch 'resources/patches/openssl/openssl-3-activate-legacy-algos.patch'
124+
else
125+
configure_flags << 'no-legacy' << 'no-md4'
126+
end
127+
128+
# Individual projects may provide their own openssl configure flags:
129+
project_flags = settings[:openssl_extra_configure_flags] || []
130+
perl_exec = ''
131+
perl_exec = '/opt/freeware/bin/perl' if platform.is_aix?
132+
configure_flags << project_flags
133+
134+
pkg.environment 'CFLAGS', cflags
135+
pkg.environment 'LDFLAGS', ldflags
136+
pkg.configure do
137+
["#{perl_exec} ./Configure #{configure_flags.join(' ')}"]
138+
end
139+
140+
#######
141+
# BUILD
142+
#######
143+
144+
build_commands = []
145+
146+
if platform.is_windows? && platform.architecture == 'x86'
147+
# mingw-w32 5.2.0 has a bug in include/winnt.h that declares GetCurrentFiber
148+
# with __CRT_INLINE, which results in the function not being inlined and
149+
# generates a linker error: undefined reference to `GetCurrentFiber'.
150+
# This only affects 32-bit builds
151+
# See https://github.com/openssl/openssl/issues/513
152+
# See https://github.com/mingw-w64/mingw-w64/commit/8da1aae7a7ff5bf996878dc8fe30a0e01e210e5a
153+
pkg.add_source('file://resources/patches/windows/FORCEINLINE-i686-w64-mingw32-winnt.h')
154+
build_commands << "#{platform.patch} --dir #{settings[:gcc_root]}/#{settings[:platform_triple]} --strip=2 --fuzz=0 --ignore-whitespace --no-backup-if-mismatch < ../FORCEINLINE-i686-w64-mingw32-winnt.h"
155+
end
156+
157+
build_commands << "#{platform[:make]} depend"
158+
build_commands << platform[:make]
159+
160+
pkg.build do
161+
build_commands
162+
end
163+
164+
#########
165+
# INSTALL
166+
#########
167+
168+
install_prefix = platform.is_windows? ? '' : 'INSTALL_PREFIX=/'
169+
install_commands = []
170+
171+
if platform.is_aix?
172+
# "Removes any currently unused modules in kernel and library memory."
173+
install_commands << 'slibclean'
174+
end
175+
176+
# Skip man and html docs
177+
install_commands << "#{platform[:make]} #{install_prefix} install_sw install_ssldirs"
178+
install_commands << "rm -f #{settings[:prefix]}/bin/c_rehash"
179+
180+
pkg.install do
181+
install_commands
182+
end
183+
184+
pkg.install_file 'LICENSE.txt', "#{settings[:prefix]}/share/doc/openssl-#{pkg.get_version}/LICENSE"
185+
end

configs/projects/_shared-agent-settings.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@
148148
# Load default compiler settings
149149
instance_eval File.read('configs/projects/_shared-compiler-settings.rb')
150150

151-
proj.setting(:openssl_version, '3.0')
152-
153151
if platform.is_windows?
154152
proj.setting(:gcc_root, '/usr/x86_64-w64-mingw32/sys-root/mingw')
155153
proj.setting(:gcc_bindir, "#{proj.gcc_root}/bin")

configs/projects/agent-runtime-main.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Set preferred component versions if they differ from defaults:
33
proj.setting :ruby_version, '3.2' # Leave the .Z out for Ruby 3.2
44
proj.setting :rubygem_highline_version, '3.0.1'
5+
proj.setting :openssl_version, '3.0'
56

67
########
78
# Load shared agent settings

configs/projects/agent-runtime-ruby4.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Set preferred component versions if they differ from defaults:
33
proj.setting :ruby_version, '4.0' # Leave the .Z out for Ruby 3.2
44
proj.setting :rubygem_highline_version, '3.1.2'
5+
proj.setting :openssl_version, '3.5'
56

67
########
78
# Load shared agent settings

0 commit comments

Comments
 (0)