| 
									
										
										
										
											2020-10-10 14:16:11 +02:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2020-04-07 21:23:12 +02:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Formula | 
					
						
							| 
									
										
										
										
											2020-06-16 18:25:13 +02:00
										 |  |  |   undef shared_library | 
					
						
							| 
									
										
										
										
											2021-04-19 09:23:33 +01:00
										 |  |  |   undef rpath | 
					
						
							| 
									
										
										
										
											2021-07-22 00:43:46 +08:00
										 |  |  |   undef deuniversalize_machos | 
					
						
							| 
									
										
										
										
											2020-06-16 18:25:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-22 00:43:46 +08:00
										 |  |  |   sig { params(name: String, version: T.nilable(T.any(String, Integer))).returns(String) } | 
					
						
							| 
									
										
										
										
											2020-06-16 18:25:13 +02:00
										 |  |  |   def shared_library(name, version = nil) | 
					
						
							| 
									
										
										
										
											2020-12-23 15:43:07 -08:00
										 |  |  |     suffix = if version == "*" || (name == "*" && version.blank?) | 
					
						
							|  |  |  |       "{,.*}" | 
					
						
							|  |  |  |     elsif version.present? | 
					
						
							|  |  |  |       ".#{version}" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     "#{name}.so#{suffix}" | 
					
						
							| 
									
										
										
										
											2020-06-16 18:25:13 +02:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-22 00:43:46 +08:00
										 |  |  |   sig { returns(String) } | 
					
						
							| 
									
										
										
										
											2021-04-19 09:23:33 +01:00
										 |  |  |   def rpath | 
					
						
							|  |  |  |     "'$ORIGIN/../lib'" | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-22 00:43:46 +08:00
										 |  |  |   sig { params(targets: T.nilable(T.any(Pathname, String))).void } | 
					
						
							|  |  |  |   def deuniversalize_machos(*targets); end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-07 21:23:12 +02:00
										 |  |  |   class << self | 
					
						
							| 
									
										
										
										
											2020-07-21 12:50:22 +00:00
										 |  |  |     undef ignore_missing_libraries | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-10 21:20:46 +00:00
										 |  |  |     def ignore_missing_libraries(*libs) | 
					
						
							| 
									
										
										
										
											2020-07-21 12:50:22 +00:00
										 |  |  |       libraries = libs.flatten | 
					
						
							| 
									
										
										
										
											2020-07-21 10:43:28 -05:00
										 |  |  |       if libraries.any? { |x| !x.is_a?(String) && !x.is_a?(Regexp) } | 
					
						
							| 
									
										
										
										
											2020-07-21 12:50:22 +00:00
										 |  |  |         raise FormulaSpecificationError, "#{__method__} can handle Strings and Regular Expressions only" | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       allowed_missing_libraries.merge(libraries) | 
					
						
							| 
									
										
										
										
											2020-07-10 21:20:46 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2020-04-07 21:23:12 +02:00
										 |  |  |   end | 
					
						
							|  |  |  | end |