Skip to content

Commit

Permalink
Add pre-built "piqi" executable as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
alavrik committed Mar 12, 2013
1 parent f349fa1 commit 2c09b81
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -1,5 +1,9 @@
/ebin /ebin
/.eunit /.eunit
/deps

# created by get-deps
/priv/piqi-binary


# vim # vim
*.swp *.swp
Expand Down
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -23,6 +23,7 @@ clean:




distclean: clean distclean: clean
$(REBAR) delete-deps
rm -rf ebin deps rm -rf ebin deps




Expand Down
1 change: 1 addition & 0 deletions examples/addressbook/deps/piqi_binary
1 change: 1 addition & 0 deletions examples/custom-types/deps/piqi_binary
1 change: 1 addition & 0 deletions examples/untyped-json-xml/deps/piqi_binary
12 changes: 11 additions & 1 deletion rebar.config
Expand Up @@ -4,6 +4,12 @@
{sub_dirs, ["piqic-erlang"]}. {sub_dirs, ["piqic-erlang"]}.




{deps, [
% "piqi" binary executables pre-built for various platforms
{piqi_binary, "", {git, "git://github.com/alavrik/piqi-binary.git", {tag, "v0.6.1"}}, [raw]}
]}.


% tolerate edoc quirks by #ifndef-ing several adjacent -spec % tolerate edoc quirks by #ifndef-ing several adjacent -spec
{edoc_opts, [{preprocess, true}, {macros, [{'EDOC', 1}]}]}. {edoc_opts, [{preprocess, true}, {macros, [{'EDOC', 1}]}]}.


Expand All @@ -14,7 +20,11 @@




{post_hooks, [ {post_hooks, [
{clean, "make -C src -f Makefile.piqi clean"} {clean, "make -C src -f Makefile.piqi clean"},

{'get-deps', "rm -rf priv/piqi-binary"},
{'get-deps', "cp -a \"$REBAR_DEPS_DIR/piqi_binary\" priv/piqi-binary"},
{'delete-deps', "rm -rf priv/piqi-binary"}
]}. ]}.




Expand Down
5 changes: 2 additions & 3 deletions src/Makefile
@@ -1,7 +1,6 @@


# TODO: uncomment this once the the new (fixed) version of piqi is released #PIQI = piqi
#PIQI = ../priv/bin-"`uname -s`-`uname -m`"/piqi PIQI = ../priv/piqi-binary/"`uname -s`-`uname -m`"/piqi
PIQI = piqi


#PIQIC = ../piqic-erlang/piqic-erlang #PIQIC = ../piqic-erlang/piqic-erlang
PIQIC = ERL_FLAGS="-pa ../piqic-erlang/ebin" ../priv/bin/piqic-erlang PIQIC = ERL_FLAGS="-pa ../piqic-erlang/ebin" ../priv/bin/piqic-erlang
Expand Down
4 changes: 2 additions & 2 deletions src/piqi.erl
Expand Up @@ -46,9 +46,9 @@ find_piqi() ->
PiqiDir -> PiqiDir ->
KernelName = os:cmd("uname -s") -- "\n", KernelName = os:cmd("uname -s") -- "\n",
Machine = os:cmd("uname -m") -- "\n", Machine = os:cmd("uname -m") -- "\n",
BinDir = lists:concat(["bin-", KernelName, "-", Machine]), Arch = lists:concat([KernelName, "-", Machine]),
% path to "piqi" executable within "piqi" application directory % path to "piqi" executable within "piqi" application directory
FullName = filename:join([PiqiDir, "priv", BinDir, "piqi"]), FullName = filename:join([PiqiDir, "priv", "piqi-binary", Arch, "piqi"]),
case filelib:is_regular(FullName) of case filelib:is_regular(FullName) of
true -> true ->
FullName; FullName;
Expand Down
4 changes: 2 additions & 2 deletions src/piqic_erlang.erl
Expand Up @@ -210,9 +210,9 @@ get_cwd(_NewCwd) ->
find_piqi_executable() -> find_piqi_executable() ->
KernelName = os:cmd("uname -s") -- "\n", KernelName = os:cmd("uname -s") -- "\n",
Machine = os:cmd("uname -m") -- "\n", Machine = os:cmd("uname -m") -- "\n",
BinDir = lists:concat(["bin-", KernelName, "-", Machine]), Arch = lists:concat([KernelName, "-", Machine]),
% path to "piqi" executable within "piqi" application directory % path to "piqi" executable within "piqi" application directory
AppPath = filename:join(["priv", BinDir, "piqi"]), AppPath = filename:join(["priv", "piqi-binary", Arch, "piqi"]),
try try
case os:getenv("REBAR_DEPS_DIR") of case os:getenv("REBAR_DEPS_DIR") of
false -> false ->
Expand Down

0 comments on commit 2c09b81

Please sign in to comment.