This repository was archived by the owner on Oct 17, 2021. It is now read-only.
File tree 1 file changed +30
-4
lines changed
1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,39 @@ def install
19
19
"--disable-sandbox" ,
20
20
"--build-path" , buildpath . to_s
21
21
22
+ copy_toolchain_libraries!
23
+
22
24
libexec . install buildpath /"release/swift-doc" => "swift-doc"
23
25
libexec . install Dir [ buildpath /"release/*.bundle" ]
24
26
27
+ install_shim!
28
+ end
29
+
30
+ test do
31
+ system bin /"swift-doc"
32
+ end
33
+
34
+ private
35
+
36
+ # rubocop:disable Metrics/AbcSize
37
+ def copy_toolchain_libraries!
38
+ return unless Hardware ::CPU . intel? && Hardware ::CPU . is_64_bit?
39
+
40
+ macho = MachO . open ( buildpath /"release/swift-doc" )
41
+ return unless ( toolchain = macho . rpaths . find { |path | path . include? ( ".xctoolchain" ) } )
42
+
43
+ cp "#{ toolchain } /lib_InternalSwiftSyntaxParser.dylib" , buildpath , verbose : true
44
+ lib . install buildpath /"lib_InternalSwiftSyntaxParser.dylib"
45
+
46
+ macho . delete_rpath toolchain
47
+ macho . change_install_name "@rpath/lib_InternalSwiftSyntaxParser.dylib" ,
48
+ "#{ lib } /lib_InternalSwiftSyntaxParser.dylib"
49
+
50
+ macho . write!
51
+ end
52
+ # rubocop:enable Metrics/AbcSize
53
+
54
+ def install_shim!
25
55
( bin /"swift-doc" ) . tap do |path |
26
56
path . write <<~SHELL
27
57
#!/bin/sh
@@ -30,8 +60,4 @@ def install
30
60
chmod 0555 , path
31
61
end
32
62
end
33
-
34
- test do
35
- system "#{ bin } /swift-doc"
36
- end
37
63
end
You can’t perform that action at this time.
0 commit comments