File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ LDFLAGS := -shared
1818# on Mac OS X, one should set instead:
1919# LDFLAGS := -bundle -undefined dynamic_lookup
2020
21+ ifeq ($(shell uname) ,Darwin)
22+ LDFLAGS := -bundle -undefined dynamic_lookup
23+ C_SO_NAME := librestychash.dylib
24+ endif
25+
2126MY_CFLAGS := $(CFLAGS ) -DBUILDING_SO
2227MY_LDFLAGS := $(LDFLAGS ) -fvisibility=hidden
2328
Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ local function load_shared_lib(so_name)
5555
5656 local cpath = package.cpath
5757
58+ local postfix = " .so"
59+ if ffi .os == " OSX" then
60+ postfix = " .dylib"
61+ end
62+ so_name = so_name .. postfix
63+
5864 for k , _ in string_gmatch (cpath , " [^;]+" ) do
5965 local fpath = string_match (k , " (.*/)" )
6066 fpath = fpath .. so_name
@@ -74,9 +80,9 @@ local _M = {}
7480local mt = { __index = _M }
7581
7682
77- local clib = load_shared_lib (" librestychash.so " )
83+ local clib = load_shared_lib (" librestychash" )
7884if not clib then
79- error (" can not load librestychash.so " )
85+ error (" can not load librestychash" )
8086end
8187
8288local CONSISTENT_POINTS = 160 -- points per server
You can’t perform that action at this time.
0 commit comments