Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gem 'packaging', *location_for(ENV['PACKAGING_LOCATION'] || '~> 0.105')
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.86'
gem 'rubocop-rake', '~> 0.7'
gem 'vanagon', *location_for(ENV['VANAGON_LOCATION'] || 'https://github.com/openvoxproject/vanagon#main')
gem 'vanagon', *location_for(ENV['VANAGON_LOCATION'] || 'https://github.com/openvoxproject/vanagon#archlinux')
# Need to update the openssl gem on MacOS to avoid SSL errors.
# https://www.rubyonmac.dev/certificate-verify-failed-unable-to-get-certificate-crl-openssl-ssl-sslerror
gem 'openssl', '~> 3' if RUBY_PLATFORM =~ /darwin/
Expand Down
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,17 @@ def run_command(cmd, silent: true, print_command: false, report_status: false)
output.chomp
end

begin
require 'rubocop/rake_task'
rescue LoadError
# Do nothing if no required gem installed
else
RuboCop::RakeTask.new(:rubocop) do |task|
# These make the rubocop experience maybe slightly less terrible
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
# Use Rubocop's Github Actions formatter if possible
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
end
end

Dir.glob(File.join('tasks/**/*.rake')).each { |file| load file }
2 changes: 1 addition & 1 deletion configs/components/_base-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# BUILD REQUIREMENTS
####################

pkg.build_requires "openssl-#{settings[:openssl_version]}"
pkg.build_requires(platform.is_archlinux? ? 'openssl' : "openssl-#{settings[:openssl_version]}")

#######
# BUILD
Expand Down
3 changes: 2 additions & 1 deletion configs/components/_base-rubygem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
# When cross-compiling, we can't use the rubygems we just built.
# Instead we use the host gem installation and override GEM_HOME. Yay?
pkg.environment 'GEM_HOME', settings[:gem_home]
pkg.environment 'GEM_PATH', settings[:gem_home]
gem_path = [settings[:gem_home], settings[:system_gem_path]].compact.join(':')
pkg.environment 'GEM_PATH', gem_path

# PA-25 in order to install gems in a cross-compiled environment we need to
# set RUBYLIB to include puppet and hiera, so that their gemspecs can resolve
Expand Down
2 changes: 1 addition & 1 deletion configs/components/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pkg.load_from_json('configs/components/curl.json')
pkg.mirror "#{settings[:buildsources_url]}/curl-#{pkg.get_version}.tar.gz"

pkg.build_requires "openssl-#{settings[:openssl_version]}"
pkg.build_requires(platform.is_archlinux? ? 'openssl' : "openssl-#{settings[:openssl_version]}")
pkg.build_requires 'puppet-ca-bundle-8.x'

ldflags = settings[:ldflags]
Expand Down
229 changes: 117 additions & 112 deletions configs/components/openssl-3.0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,132 +6,137 @@
# need to move to the 3.5.x LTS stream in the next year.
#####
component 'openssl' do |pkg, settings, platform|
pkg.load_from_json('configs/components/openssl-3.0.json')
pkg.mirror "#{settings[:buildsources_url]}/openssl-#{pkg.get_version}.tar.gz"
if platform.is_archlinux?
pkg.build_requires 'openssl'
pkg.install_only true
else
pkg.load_from_json('configs/components/openssl-3.0.json')
pkg.mirror "#{settings[:buildsources_url]}/openssl-#{pkg.get_version}.tar.gz"

#############################
# ENVIRONMENT, FLAGS, TARGETS
#############################
#############################
# ENVIRONMENT, FLAGS, TARGETS
#############################

if platform.is_rpm? && !platform.is_sles?
pkg.build_requires 'perl-core'
else
pkg.build_requires 'perl'
end
if platform.is_rpm? && !platform.is_sles?
pkg.build_requires 'perl-core'
else
pkg.build_requires 'perl'
end

target = sslflags = ''
cflags = settings[:cflags]
ldflags = settings[:ldflags]

if platform.is_windows?
pkg.environment 'PATH', "$(shell cygpath -u #{settings[:gcc_bindir]}):$(PATH)"
pkg.environment 'CYGWIN', settings[:cygwin]
pkg.environment 'MAKE', platform[:make]

target = 'mingw64'
elsif platform.is_macos?
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
pkg.environment 'CC', settings[:cc]
pkg.environment 'MACOSX_DEPLOYMENT_TARGET', settings[:deployment_target]

target = "darwin64-#{platform.architecture}"

elsif platform.is_linux?
pkg.environment 'PATH', '$(PATH):/usr/local/bin'

ldflags = "#{settings[:ldflags]} -Wl,-z,relro"
case platform.architecture
when /aarch64$/
target = 'linux-aarch64'
when /64$/
target = 'linux-x86_64'
when 'armhf'
target = 'linux-armv4'
target = sslflags = ''
cflags = settings[:cflags]
ldflags = settings[:ldflags]

if platform.is_windows?
pkg.environment 'PATH', "$(shell cygpath -u #{settings[:gcc_bindir]}):$(PATH)"
pkg.environment 'CYGWIN', settings[:cygwin]
pkg.environment 'MAKE', platform[:make]

target = 'mingw64'
elsif platform.is_macos?
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
pkg.environment 'CC', settings[:cc]
pkg.environment 'MACOSX_DEPLOYMENT_TARGET', settings[:deployment_target]

target = "darwin64-#{platform.architecture}"

elsif platform.is_linux?
pkg.environment 'PATH', '$(PATH):/usr/local/bin'

ldflags = "#{settings[:ldflags]} -Wl,-z,relro"
case platform.architecture
when /aarch64$/
target = 'linux-aarch64'
when /64$/
target = 'linux-x86_64'
when 'armhf'
target = 'linux-armv4'
end
end
end

####################
# BUILD REQUIREMENTS
####################

pkg.build_requires "runtime-#{settings[:runtime_project]}"

###########
# CONFIGURE
###########

# Defining --libdir ensures that we avoid the multilib (lib/ vs. lib64/) problem,
# since configure uses the existence of a lib64 directory to determine
# if it should install its own libs into a multilib dir. Yay OpenSSL!
configure_flags = [
"--prefix=#{settings[:prefix]}",
'--libdir=lib',
"--openssldir=#{settings[:prefix]}/ssl",
'shared',
'no-gost',
target,
sslflags,
'no-camellia',
'no-md2',
'no-ssl3',
'no-ssl3-method',
'no-dtls1-method',
'no-dtls1_2-method',
'no-aria',
# 'no-bf', pgcrypto is requires this cipher in postgres for OpenVoxDB
# 'no-cast', pgcrypto is requires this cipher in postgres for OpenVoxDB
# 'no-des', pgcrypto is requires this cipher in postgres for OpenVoxDB,
# should pgcrypto cease needing it, it will also be needed by ntlm
# and should only be enabled if "use_legacy_openssl_algos" is true.
'no-rc5',
'no-mdc2',
# 'no-rmd160', this is causing failures with pxp, remove once pxp-agent does not need it
'no-whirlpool'
]

if settings[:use_legacy_openssl_algos]
pkg.apply_patch 'resources/patches/openssl/openssl-3-activate-legacy-algos.patch'
else
configure_flags << 'no-legacy' << 'no-md4'
end
####################
# BUILD REQUIREMENTS
####################

pkg.build_requires "runtime-#{settings[:runtime_project]}"

###########
# CONFIGURE
###########

# Defining --libdir ensures that we avoid the multilib (lib/ vs. lib64/) problem,
# since configure uses the existence of a lib64 directory to determine
# if it should install its own libs into a multilib dir. Yay OpenSSL!
configure_flags = [
"--prefix=#{settings[:prefix]}",
'--libdir=lib',
"--openssldir=#{settings[:prefix]}/ssl",
'shared',
'no-gost',
target,
sslflags,
'no-camellia',
'no-md2',
'no-ssl3',
'no-ssl3-method',
'no-dtls1-method',
'no-dtls1_2-method',
'no-aria',
# 'no-bf', pgcrypto is requires this cipher in postgres for OpenVoxDB
# 'no-cast', pgcrypto is requires this cipher in postgres for OpenVoxDB
# 'no-des', pgcrypto is requires this cipher in postgres for OpenVoxDB,
# should pgcrypto cease needing it, it will also be needed by ntlm
# and should only be enabled if "use_legacy_openssl_algos" is true.
'no-rc5',
'no-mdc2',
# 'no-rmd160', this is causing failures with pxp, remove once pxp-agent does not need it
'no-whirlpool'
]

if settings[:use_legacy_openssl_algos]
pkg.apply_patch 'resources/patches/openssl/openssl-3-activate-legacy-algos.patch'
else
configure_flags << 'no-legacy' << 'no-md4'
end

# Individual projects may provide their own openssl configure flags:
project_flags = settings[:openssl_extra_configure_flags] || []
configure_flags << project_flags
# Individual projects may provide their own openssl configure flags:
project_flags = settings[:openssl_extra_configure_flags] || []
configure_flags << project_flags

pkg.environment 'CFLAGS', cflags
pkg.environment 'LDFLAGS', ldflags
pkg.configure do
["./Configure #{configure_flags.join(' ')}"]
end
pkg.environment 'CFLAGS', cflags
pkg.environment 'LDFLAGS', ldflags
pkg.configure do
["./Configure #{configure_flags.join(' ')}"]
end

#######
# BUILD
#######
#######
# BUILD
#######

build_commands = []
build_commands = []

build_commands << "#{platform[:make]} depend"
build_commands << platform[:make]
build_commands << "#{platform[:make]} depend"
build_commands << platform[:make]

pkg.build do
build_commands
end
pkg.build do
build_commands
end

#########
# INSTALL
#########
#########
# INSTALL
#########

install_prefix = platform.is_windows? ? '' : 'INSTALL_PREFIX=/'
install_commands = []
install_prefix = platform.is_windows? ? '' : 'INSTALL_PREFIX=/'
install_commands = []

# Skip man and html docs
install_commands << "#{platform[:make]} #{install_prefix} install_sw install_ssldirs"
install_commands << "rm -f #{settings[:prefix]}/bin/c_rehash"
# Skip man and html docs
install_commands << "#{platform[:make]} #{install_prefix} install_sw install_ssldirs"
install_commands << "rm -f #{settings[:prefix]}/bin/c_rehash"

pkg.install do
install_commands
end
pkg.install do
install_commands
end

pkg.install_file 'LICENSE.txt', "#{settings[:prefix]}/share/doc/openssl-#{pkg.get_version}/LICENSE"
pkg.install_file 'LICENSE.txt', "#{settings[:prefix]}/share/doc/openssl-#{pkg.get_version}/LICENSE"
end
end
2 changes: 1 addition & 1 deletion configs/components/puppet-ca-bundle-8.x.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
component 'puppet-ca-bundle-8.x' do |pkg, settings, platform|
pkg.load_from_json('configs/components/puppet-ca-bundle-8.x.json')

pkg.build_requires "openssl-#{settings[:openssl_version]}"
pkg.build_requires(platform.is_archlinux? ? 'openssl' : "openssl-#{settings[:openssl_version]}")

openssl_cmd = "#{settings[:bindir]}/openssl"

Expand Down
2 changes: 1 addition & 1 deletion configs/components/puppet-ca-bundle-main.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
component 'puppet-ca-bundle-main' do |pkg, settings, platform|
pkg.load_from_json('configs/components/puppet-ca-bundle-main.json')

pkg.build_requires "openssl-#{settings[:openssl_version]}"
pkg.build_requires(platform.is_archlinux? ? 'openssl' : "openssl-#{settings[:openssl_version]}")

openssl_cmd = "#{settings[:bindir]}/openssl"

Expand Down
Loading
Loading