Skip to content

Commit

Permalink
Merge pull request #680 from shubhamshinde360/PA-4774
Browse files Browse the repository at this point in the history
(PA-4774) Enable macOS 13 for agent-runtime main
  • Loading branch information
joshcooper authored Jul 10, 2023
2 parents 2a273a2 + 0a0f61b commit 0108dfc
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 6 deletions.
5 changes: 5 additions & 0 deletions configs/components/_base-ruby-augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb"
pkg.environment "LDFLAGS", settings[:ldflags]
end
elsif platform.is_macos? && platform.architecture == 'arm64' && platform.os_version.to_i >= 13
pkg.environment "PATH", "$(PATH):/opt/homebrew/bin"
pkg.environment 'CC', 'clang'
pkg.environment "LDFLAGS", settings[:ldflags]
ruby = File.join(ruby_bindir, 'ruby')
else
ruby = File.join(ruby_bindir, 'ruby')
end
Expand Down
2 changes: 2 additions & 0 deletions configs/components/_base-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
end
pkg.environment 'CC', 'clang -target arm64-apple-macos11' if platform.name =~ /osx-11/
pkg.environment 'CC', 'clang -target arm64-apple-macos12' if platform.name =~ /osx-12/
elsif platform.architecture == 'arm64' && platform.os_version.to_i >= 13
pkg.environment 'CC', 'clang'
end
end

Expand Down
13 changes: 11 additions & 2 deletions configs/components/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@
pkg.environment "PKG_CONFIG", "/opt/pl-build-tools/bin/pkg-config"
end
elsif platform.is_macos?
pkg.environment "PATH", "$(PATH):/usr/local/bin"
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
pkg.environment 'CFLAGS', settings[:cflags]
pkg.environment 'CPPFLAGS', settings[:cppflags]
pkg.environment "LDFLAGS", settings[:ldflags]
if platform.is_cross_compiled?
pkg.environment 'CC', 'clang -target arm64-apple-macos11' if platform.name =~ /osx-11/
pkg.environment 'CC', 'clang -target arm64-apple-macos12' if platform.name =~ /osx-12/
elsif platform.architecture == 'arm64' && platform.os_version.to_i >= 13
pkg.environment 'CC', 'clang'
end
end

Expand All @@ -120,7 +122,14 @@
end

# fix libtool linking on big sur
pkg.configure { ["/usr/local/bin/autoreconf --force --install"] } if platform.is_macos?
if platform.is_macos?
if platform.os_version.to_i >= 13 && platform.architecture == 'arm64'
pkg.configure { ["/opt/homebrew/bin/autoreconf --force --install"] }
else
pkg.configure { ["/usr/local/bin/autoreconf --force --install"] }
end
end


pkg.configure do
["./configure #{extra_config_flags} --prefix=#{settings[:prefix]} #{settings[:host]}"]
Expand Down
9 changes: 7 additions & 2 deletions configs/components/openssl-3.0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@
ldflags = "-R/opt/csw/#{settings[:platform_triple]}/lib -Wl,-rpath=#{settings[:libdir]} -L/opt/csw/#{settings[:platform_triple]}/lib"
target = platform.architecture =~ /86/ ? 'solaris-x86-gcc' : 'solaris-sparcv9-gcc'
elsif platform.is_macos?
pkg.environment 'PATH', '/opt/pl-build-tools/bin:$(PATH):/usr/local/bin'

target = if platform.is_cross_compiled?
if platform.os_version.to_i >= 13 && platform.architecture == 'arm64'
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
else
pkg.environment 'PATH', '/opt/pl-build-tools/bin:$(PATH):/usr/local/bin'
end

target = if platform.architecture == "arm64"
'darwin64-arm64'
else
'darwin64-x86_64'
Expand Down
5 changes: 4 additions & 1 deletion configs/components/ruby-3.2.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@

if platform.is_macos?
pkg.environment 'optflags', settings[:cflags]
pkg.environment 'PATH', '$(PATH):/usr/local/bin'
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'

elsif platform.is_windows?
pkg.environment 'optflags', settings[:cflags] + ' -O3'
pkg.environment 'MAKE', 'make'
Expand Down Expand Up @@ -237,6 +238,8 @@
# the ancient gcc version on sles-12-ppc64le does not understand -fstack-protector-strong, so remove the `strong` part
rbconfig_changes["LDFLAGS"] = "-L. -Wl,-rpath=/opt/puppetlabs/puppet/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/opt/puppetlabs/puppet/lib"
end
elsif platform.is_macos? && platform.architecture == 'arm64' && platform.os_version.to_i >= 13
rbconfig_changes["CC"] = 'clang'
elsif platform.is_windows?
if platform.architecture == "x64"
rbconfig_changes["CC"] = "x86_64-w64-mingw32-gcc"
Expand Down
4 changes: 4 additions & 0 deletions configs/components/yaml-cpp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
if platform.is_cross_compiled?
pkg.environment 'CXX', 'clang++ -target arm64-apple-macos11' if platform.name =~ /osx-11/
pkg.environment 'CXX', 'clang++ -target arm64-apple-macos12' if platform.name =~ /osx-12/
elsif platform.architecture == 'arm64' && platform.os_version.to_i >= 13
pkg.environment 'CXX', 'clang++'
cmake = "/opt/homebrew/bin/cmake" if platform.architecture == "arm64"
end

elsif platform.is_windows?
make = "#{settings[:gcc_bindir]}/mingw32-make"
mkdir = '/usr/bin/mkdir'
Expand Down
9 changes: 9 additions & 0 deletions configs/platforms/osx-13-arm64.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
platform 'osx-13-arm64' do |plat|
plat.inherit_from_default

packages = %w[automake cmake pkg-config yaml-cpp]
plat.provision_with "su test -c '/opt/homebrew/bin/brew install #{packages.join(' ')}'"

plat.output_dir File.join('apple', '13', 'PC1', 'arm64')
end

2 changes: 1 addition & 1 deletion configs/projects/_shared-agent-settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
# break gcc or clang if they try to use the RPATH values we forced.
proj.setting(:cppflags, "-I#{proj.includedir}")
proj.setting(:ldflags, "-L#{proj.libdir}")
if platform.is_cross_compiled?
if platform.architecture == 'arm64'
proj.setting(:cflags, "#{proj.cppflags}")
else
proj.setting(:cflags, "-march=core2 -msse4 #{proj.cppflags}")
Expand Down

0 comments on commit 0108dfc

Please sign in to comment.