| 
									
										
										
										
											2024-08-15 07:59:49 -07:00
										 |  |  | # typed: strict | 
					
						
							| 
									
										
										
										
											2023-03-27 19:35:28 -07:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  | module OS | 
					
						
							|  |  |  |   module Mac | 
					
						
							|  |  |  |     module Formula | 
					
						
							|  |  |  |       extend T::Helpers | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       requires_ancestor { ::Formula } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       sig { returns(T::Boolean) } | 
					
						
							|  |  |  |       def valid_platform? | 
					
						
							|  |  |  |         requirements.none?(LinuxRequirement) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       sig { | 
					
						
							|  |  |  |         params( | 
					
						
							|  |  |  |           install_prefix: T.any(String, Pathname), | 
					
						
							|  |  |  |           install_libdir: T.any(String, Pathname), | 
					
						
							|  |  |  |           find_framework: String, | 
					
						
							|  |  |  |         ).returns(T::Array[String]) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST") | 
					
						
							| 
									
										
										
										
											2024-09-20 12:31:15 +01:00
										 |  |  |         args = super | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # Avoid false positives for clock_gettime support on 10.11. | 
					
						
							|  |  |  |         # CMake cache entries for other weak symbols may be added here as needed. | 
					
						
							|  |  |  |         args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0" if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         # Ensure CMake is using the same SDK we are using. | 
					
						
							| 
									
										
										
										
											2025-08-21 00:56:28 +08:00
										 |  |  |         args << "-DCMAKE_OSX_SYSROOT=#{T.must(MacOS.sdk_for_formula(self)).path}" if MacOS.sdk_root_needed? | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |         args | 
					
						
							| 
									
										
										
										
											2024-09-13 12:22:52 -07:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2025-02-21 16:49:11 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |       sig { | 
					
						
							|  |  |  |         params( | 
					
						
							|  |  |  |           prefix:       T.any(String, Pathname), | 
					
						
							| 
									
										
										
										
											2025-02-21 17:07:29 +01:00
										 |  |  |           release_mode: Symbol, | 
					
						
							| 
									
										
										
										
											2025-02-21 16:49:11 +01:00
										 |  |  |         ).returns(T::Array[String]) | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2025-02-21 17:07:29 +01:00
										 |  |  |       def std_zig_args(prefix: self.prefix, release_mode: :fast) | 
					
						
							| 
									
										
										
										
											2025-02-21 16:49:11 +01:00
										 |  |  |         args = super | 
					
						
							| 
									
										
										
										
											2025-02-21 19:10:41 +01:00
										 |  |  |         args << "-fno-rosetta" if ::Hardware::CPU.arm? | 
					
						
							| 
									
										
										
										
											2025-02-21 16:49:11 +01:00
										 |  |  |         args | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2024-09-13 12:22:52 -07:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2023-11-15 19:52:21 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2023-03-27 19:35:28 -07:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2024-09-05 19:56:32 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-18 15:33:49 -07:00
										 |  |  | Formula.prepend(OS::Mac::Formula) |