@@ -7,32 +7,7 @@ Pkg.add(Pkg.PackageSpec(name="ObjectFile", uuid="d8793406-e978-5875-9003-1fc021f
77using ObjectFile
88try
99
10- # Remove `.X.dylib` or just `.dylib`
11- function strip_soversion_macos (lib)
12- m = match (r" ^(.*?)(\.\d +)*\. dylib$" , lib)
13- if m != = nothing
14- return m. captures[1 ]
15- end
16- return lib
17- end
18-
19- # Remove `.so.X` or just `.so`
20- function strip_soversion_linux (lib)
21- m = match (r" ^(.*?)\. so(\.\d +)*$" , lib)
22- if m != = nothing
23- return m. captures[1 ]
24- end
25- return lib
26- end
27-
28- # Remove `-X.dll` or just `.dll`
29- function strip_soversion_windows (lib)
30- m = match (r" ^(.*?)(-\d +)*\. dll$" , lib)
31- if m != = nothing
32- return m. captures[1 ]
33- end
34- return lib
35- end
10+ strip_soversion (lib:: AbstractString ) = Base. BinaryPlatforms. parse_dl_name_version (lib)[1 ]
3611
3712 function get_deps_objectfile_macos (lib_path:: String )
3813 open (lib_path, " r" ) do io
5631 end
5732 end
5833 end
59-
60- libs = strip_soversion_macos .(raw_libs)
34+ libs = strip_soversion .(raw_libs)
6135 # Get rid of any self-referential links
62- self_lib = strip_soversion_macos (basename (lib_path))
36+ self_lib = strip_soversion (basename (lib_path))
6337 libs = filter (!= (self_lib), libs)
6438 return libs
6539 end
8660 end
8761 end
8862
89- libs = strip_soversion_linux .(raw_libs)
63+ libs = strip_soversion .(raw_libs)
9064 # Self-reference is typically not listed in NEEDED for ELF, so no explicit filter here.
9165 return libs
9266 end
11185 end
11286 end
11387
114- libs = strip_soversion_windows .(collect (raw_libs_set))
115- # Remove self-reference
116- self_lib = strip_soversion_windows (lowercase (basename (lib_path)))
88+ libs = strip_soversion .(collect (raw_libs_set))
89+ # Get rid of any self-referential links
90+ self_lib = strip_soversion (lowercase (basename (lib_path)))
11791 libs = filter (!= (self_lib), libs)
11892 return libs
11993 end
@@ -205,13 +179,10 @@ try
205179
206180 # Set up platform-specific functions
207181 if Sys. islinux () || Sys. isfreebsd ()
208- strip_soversion = strip_soversion_linux
209182 is_system_lib = Sys. islinux () ? is_system_lib_linux : is_system_lib_freebsd
210183 elseif Sys. isapple ()
211- strip_soversion = strip_soversion_macos
212184 is_system_lib = is_system_lib_macos
213185 elseif Sys. iswindows ()
214- strip_soversion = strip_soversion_windows
215186 is_system_lib = is_system_lib_windows
216187 else
217188 error (" Unsupported platform for `stdlib_dependencies.jl`. Only Linux, FreeBSD, macOS, and Windows are supported." )
0 commit comments