| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-27 02:08:23 -07:00
										 |  |  | class Keg | 
					
						
							|  |  |  |   def change_dylib_id(id, file) | 
					
						
							|  |  |  |     return if file.dylib_id == id | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-27 02:08:23 -07:00
										 |  |  |     @require_relocation = true | 
					
						
							| 
									
										
										
										
											2019-11-29 14:54:41 -05:00
										 |  |  |     odebug "Changing dylib ID of #{file}\n  from #{file.dylib_id}\n    to #{id}" if ARGV.debug? | 
					
						
							| 
									
										
										
										
											2017-09-27 02:08:23 -07:00
										 |  |  |     MachO::Tools.change_dylib_id(file, id, strict: false) | 
					
						
							|  |  |  |   rescue MachO::MachOError | 
					
						
							| 
									
										
										
										
											2017-10-15 02:28:32 +02:00
										 |  |  |     onoe <<~EOS | 
					
						
							| 
									
										
										
										
											2017-09-27 02:08:23 -07:00
										 |  |  |       Failed changing dylib ID of #{file} | 
					
						
							|  |  |  |         from #{file.dylib_id} | 
					
						
							|  |  |  |           to #{id} | 
					
						
							|  |  |  |     EOS | 
					
						
							|  |  |  |     raise | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def change_install_name(old, new, file) | 
					
						
							|  |  |  |     return if old == new | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-27 02:08:23 -07:00
										 |  |  |     @require_relocation = true | 
					
						
							| 
									
										
										
										
											2019-11-29 14:54:41 -05:00
										 |  |  |     odebug "Changing install name in #{file}\n  from #{old}\n    to #{new}" if ARGV.debug? | 
					
						
							| 
									
										
										
										
											2017-09-27 02:08:23 -07:00
										 |  |  |     MachO::Tools.change_install_name(file, old, new, strict: false) | 
					
						
							|  |  |  |   rescue MachO::MachOError | 
					
						
							| 
									
										
										
										
											2017-10-15 02:28:32 +02:00
										 |  |  |     onoe <<~EOS | 
					
						
							| 
									
										
										
										
											2017-09-27 02:08:23 -07:00
										 |  |  |       Failed changing install name in #{file} | 
					
						
							|  |  |  |         from #{old} | 
					
						
							|  |  |  |           to #{new} | 
					
						
							|  |  |  |     EOS | 
					
						
							|  |  |  |     raise | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |