File tree 1 file changed +11
-1
lines changed 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,21 @@ defmodule Mix.Tasks.Compile.Rustler do
62
62
# TODO: Make build flavor specific
63
63
Enum . map ( Path . wildcard ( "#{ target_dir } /#{ compile_flavor } /lib#{ lib_name } .*" ) , fn
64
64
path ->
65
- file_name = Path . basename ( path )
65
+ file_name = platform_library_name ( Path . basename ( path ) )
66
66
File . cp! ( Path . absname ( path ) , "#{ Rustler . nif_lib_dir } /#{ file_name } " )
67
67
end )
68
68
end
69
69
70
+ def platform_library_name ( base_name ) do
71
+ ext = Path . extname ( base_name )
72
+ case ext do
73
+ # For macs we need to rename the .dylib so .so for the BEAM to load it.
74
+ # See issue #3.
75
+ ".dylib" -> Path . rootname ( base_name ) <> ".so"
76
+ _ -> base_name
77
+ end
78
+ end
79
+
70
80
def check_crate_env ( crate ) do
71
81
unless File . dir? ( crate ) do
72
82
Mix . shell . error Messages . message ( :no_crates_property_message )
You can’t perform that action at this time.
0 commit comments