Skip to content

Commit

Permalink
nifs: change install dir to the "priv" folder, properly find its path
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Kruber committed Jun 10, 2016
1 parent 886c73f commit 38e18a4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ SCALARIS_UNITTEST_YAWS_PORT ?= 8000
SCALARIS_JTEST_NAME ?= jtest_boot

NIFS_SRC_CPP=$(wildcard src/nifs/*.cpp)
NIFS_SO=$(subst src/nifs,bin,$(NIFS_SRC_CPP:.cpp=.so))
NIFS_SO=$(subst src/nifs,priv,$(NIFS_SRC_CPP:.cpp=.so))

all: Makefile nifs compile tags
#all: compile dialyzer java test docs
Expand Down Expand Up @@ -610,7 +610,7 @@ rrd-init:

nifs: $(NIFS_SO)

bin/%.so: src/nifs/%.cpp Makefile
priv/%.so: src/nifs/%.cpp Makefile
@CXX@ @NIFFLAGS@ -I@ERLANG_ROOT_DIR@/erts-@ERLANG_LIB_VER_erts@/include @CXXFLAGS@ -fPIC -o $@ $<

install-doc: doc
Expand Down
1 change: 1 addition & 0 deletions priv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.so
15 changes: 14 additions & 1 deletion src/time/clocks.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,20 @@
-spec init() -> ok.
init() ->
%% loads the shared library
SoName = filename:join(filename:join(code:lib_dir(scalaris), bin), ?MODULE),
SoName =
case code:priv_dir(scalaris) of
{error, bad_name} ->
case filelib:is_dir(filename:join(["..", priv])) of
true ->
filename:join(["..", priv, ?MODULE]);
_ ->
filename:join(
[filename:dirname(code:where_is_file("scalaris.beam")),
"..", priv, ?MODULE])
end;
Dir ->
filename:join(Dir, ?MODULE)
end,
erlang:load_nif(SoName, 0).

-spec get_monotonic_clock() -> failed | {non_neg_integer(), non_neg_integer()}.
Expand Down

0 comments on commit 38e18a4

Please sign in to comment.