Skip to content

Commit

Permalink
(PA-4774) Enable mac OS 13 for puppet runtime main
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamshinde360 committed Jul 5, 2023
1 parent 5331711 commit bb06563
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
10 changes: 7 additions & 3 deletions configs/components/_base-ruby-augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
pkg.build_requires "ruby-#{ruby_version}"
pkg.build_requires "augeas"

pkg.environment "PATH", "$(PATH):/opt/homebrew/bin:/opt/pl-build-tools/bin:/usr/local/bin:/opt/csw/bin:/usr/ccs/bin:/usr/sfw/bin"
pkg.environment "PATH", "$(PATH):/opt/pl-build-tools/bin:/usr/local/bin:/opt/csw/bin:/usr/ccs/bin:/usr/sfw/bin"
if platform.is_aix?
if platform.name == 'aix-7.1-ppc'
pkg.environment "CC", "/opt/pl-build-tools/bin/gcc"
Expand All @@ -40,15 +40,19 @@
pkg.environment "RUBY", host_ruby
end
ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb"
elsif platform.architecture == 'arm64'
elsif platform.is_cross_compiled?
if platform.is_linux? || platform.is_macos?
pkg.environment "RUBY", host_ruby
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/
pkg.environment 'CC', 'clang -target arm64-apple-macos13' if platform.name =~ /osx-13/
ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb"
pkg.environment "LDFLAGS", settings[:ldflags]
end
elsif platform.is_macos?
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
10 changes: 7 additions & 3 deletions configs/components/_base-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@
else
pkg.build_requires "ruby@#{ruby_version_y}"
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/
pkg.environment 'CC', 'clang -target arm64-apple-macos13' if platform.name =~ /osx-13/

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/
else
pkg.environment 'CC', 'clang'
end
end
end

Expand Down
5 changes: 3 additions & 2 deletions configs/components/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@
pkg.environment 'CFLAGS', settings[:cflags]
pkg.environment 'CPPFLAGS', settings[:cppflags]
pkg.environment "LDFLAGS", settings[:ldflags]
if platform.architecture == 'arm64'
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/
pkg.environment 'CC', 'clang -target arm64-apple-macos13' if platform.name =~ /osx-13/
else
pkg.environment 'CC', 'clang'
end
end

Expand Down
2 changes: 0 additions & 2 deletions configs/components/boost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
'clang++ -target arm64-apple-macos11'
elsif platform.is_cross_compiled? && platform.name =~ /osx-12/
'clang++ -target arm64-apple-macos12'
elsif platform.name =~ /osx-13/
'clang++ -target arm64-apple-macos13'
else
'clang++'
end
Expand Down
2 changes: 1 addition & 1 deletion configs/components/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
if platform.architecture == 'arm64' && platform.is_macos?
extra_cflags << '-mmacosx-version-min=11.0 -arch arm64' if platform.name =~ /osx-11/
extra_cflags << '-mmacosx-version-min=12.0 -arch arm64' if platform.name =~ /osx-12/
extra_cflags << '-mmacosx-version-min=12.0 -arch arm64' if platform.name =~ /osx-13/
extra_cflags << '-mmacosx-version-min=13.0 -arch arm64' if platform.name =~ /osx-13/
end

if (platform.is_solaris? && platform.os_version == "11") || platform.is_aix?
Expand Down
5 changes: 2 additions & 3 deletions configs/components/ruby-3.2.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@
end

rbconfig_changes = {}
if platform.is_macos? && platform.os_version.to_i >= 13
rbconfig_changes["CC"] = 'clang -target arm64-apple-macos13' if platform.name =~ /osx-13/
end
if platform.is_aix?
rbconfig_changes["CC"] = "gcc"
elsif platform.is_cross_compiled? || platform.is_solaris?
Expand All @@ -239,6 +236,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?
rbconfig_changes["CC"] = 'clang'
elsif platform.is_windows?
if platform.architecture == "x64"
rbconfig_changes["CC"] = "x86_64-w64-mingw32-gcc"
Expand Down
14 changes: 8 additions & 6 deletions configs/components/yaml-cpp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
elsif platform.is_macos?
cmake_toolchain_file = ""
cmake = "/usr/local/bin/cmake"
pkg.environment "PATH", "$(PATH):/opt/csw/bin"
if platform.architecture == 'arm64'
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/
pkg.environment 'CXX', 'clang++ -target arm64-apple-macos13' if platform.name =~ /osx-13/
if(platform.architecture == "arm64" and platform.os_version.to_i >= 13)
cmake = "/opt/homebrew/bin/cmake"
end
else
pkg.environment 'CXX', 'clang++'
end

# If the architecture of the mac OS is arm64, the cmake path should be set to homebrew bin
if platform.architecture == "arm64"
cmake = "/opt/homebrew/bin/cmake"
end
elsif platform.is_windows?
make = "#{settings[:gcc_bindir]}/mingw32-make"
Expand Down

0 comments on commit bb06563

Please sign in to comment.