Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rebar packaging for "piqi_src" virtual Erlang application

  • Loading branch information...
commit 41305c25f5ef50ee5242bc34ee21d0fca1160afb 1 parent 9746ade
@alavrik authored
View
1  .gitignore
@@ -1,4 +1,5 @@
build
+ebin
*.[oa]
View
5 make/Makefile.ocaml
@@ -6,6 +6,11 @@ OCAMLPATH = $(OCAMLFIND_DESTDIR)
export OCAMLFIND_DESTDIR OCAMLPATH
+# make sure camlp4o produces pretty-printed text instead of AST
+CAMLP4_O = $(CAMLP4)o -printer o
+export OCAMLP4_O
+
+
.PHONY: piqi-all pre_target post_target
View
4 piqi-erlang/src/Makefile
@@ -49,8 +49,8 @@ test: beams
done
-$(ERL_APP_FILE): $(ERL_APP_FILE).templ
- sed -e 's;%VSN%;$(VSN);' $< > $@
+$(ERL_APP_FILE): $(ERL_APP_FILE).src
+ sed -e 's/git/"$(VSN)"/' $< > $@
$(PIQI_ERL_FILES) $(PIQI_HRL_FILES): $(PIQI_FILES)
View
29 piqi-erlang/src/Makefile.piqi
@@ -0,0 +1,29 @@
+.PHONY: all clean
+
+
+PIQI_FILES = piqi-rpc.piqi piqi-tools.piqi piqi.piqi
+
+PIQI_ERL_FILES = piqi_rpc_piqi.erl piqi_tools_piqi.erl piqi_piqi.erl
+PIQI_HRL_FILES = piqi_rpc_piqi.hrl piqi_tools_piqi.hrl piqi_piqi.hrl
+
+PIQI_ERLANG_FILES = $(PIQI_ERL_FILES) $(PIQI_HRL_FILES)
+
+
+PIQIC = $(PIQI_BIN_DIR)/piqic-$(shell uname -s)-$(shell uname -m)
+PIQIC_FLAGS= -I ../.. # add Piqi root diretory to the Piqi module search path
+
+
+all: $(PIQI_ERLANG_FILES)
+
+
+$(PIQI_ERLANG_FILES): $(PIQI_FILES)
+ for i in $^; do \
+ $(PIQIC) erlang $(PIQIC_FLAGS) $$i; \
+ done
+
+
+clean:
+ rm -f $(PIQI_ERLANG_FILES)
+
+
+# vim:ft=make
View
10 piqi-erlang/src/piqi.app.templ → piqi-erlang/src/piqi.app.src
@@ -1,10 +1,14 @@
{application, piqi,
[{description, "Piqi Library"},
- {vsn, "%VSN%"},
+ {vsn, git},
{modules, [
piqirun, piqirun_ext,
- piqi_tools, piqi_rpc_piqi, piqi_tools_piqi,
- piqi, piqi_app, piqi_sup]},
+ piqi, piqi_app, piqi_sup,
+ piqi_tools,
+ piqi_piqi, piqi_rpc_piqi, piqi_tools_piqi,
+ piqic_erlang_ext,
+ piqirun_tests
+ ]},
{registered, [piqi_tools, piqi_sup]},
{applications, [kernel, stdlib]},
{mod, {piqi_app, []}},
View
23 piqi-erlang/src/piqi.erl
@@ -18,6 +18,8 @@
-module(piqi).
-export([start/0, stop/0]).
+% utilities
+-export([get_command/1]).
% @doc start Piqi application
@@ -29,3 +31,24 @@ start() ->
stop() ->
application:stop(piqi).
+
+%
+% Utilities
+%
+
+
+-ifndef(PIQI_CROSS_PLATFORM).
+get_command(Name) -> Name.
+-else.
+get_command(Name) ->
+ PiqiDir =
+ case code:lib_dir(piqi) of
+ {error, Error} ->
+ erlang:error({"can't locate Piqi application: ", Error});
+ X -> X
+ end,
+ KernelName = os:cmd("uname -s"),
+ Machine = os:cmd("uname -m"),
+ lists:concat([filename:join(PiqiDir, Name), "-", KernelName, "-", Machine]).
+-endif.
+
View
2  piqi-erlang/src/piqi_tools.erl
@@ -124,7 +124,7 @@ stop() ->
%% @private
init([]) ->
- Command = "piqi server" ++ ?PIQI_FLAGS,
+ Command = piqi:get_command("piqi") ++ " server" ++ ?PIQI_FLAGS,
%Command = "tee ilog | piqi server --trace | tee olog",
Port = start_port_receiver(Command),
View
5 piqi-erlang/src/piqic_erlang_ext.erl
@@ -83,7 +83,7 @@ parse_args([_|T], Odir) ->
piqic_erlang(Args, CustomArgs) ->
PiqicErlang = lists:concat([
- "piqic erlang ", CustomArgs, join_args(Args)
+ piqi:get_command("piqic"), " erlang ", CustomArgs, join_args(Args)
]),
command(PiqicErlang).
@@ -121,7 +121,8 @@ piqic_erlang_ext(Mod, Args) ->
ExpandedPiqi = Filename ++ ".expanded.pb",
try
PiqicExpand = lists:concat([
- "piqic expand --erlang -b -o ", ExpandedPiqi, " ", join_args(Args)
+ piqi:get_command("piqic"),
+ " expand --erlang -b -o ", ExpandedPiqi, " ", join_args(Args)
]),
command(PiqicExpand),
View
4 piqi-rpc/src/Makefile
@@ -36,8 +36,8 @@ test: beams
done
-$(ERL_APP_FILE): $(ERL_APP_FILE).templ
- sed -e 's;%VSN%;$(VSN);' $< > $@
+$(ERL_APP_FILE): $(ERL_APP_FILE).src
+ sed -e 's/git/"$(VSN)"/' $< > $@
clean::
View
6 piqi-rpc/src/piqi_rpc.app.templ → piqi-rpc/src/piqi_rpc.app.src
@@ -1,13 +1,15 @@
{application, piqi_rpc, [
{description, "Piqi-RPC"},
- {vsn, "%VSN%"},
+ {vsn, git},
{modules, [
piqi_rpc,
piqi_rpc_app,
piqi_rpc_sup,
piqi_rpc_runtime,
piqi_rpc_monitor,
- piqi_http_rpc
+ piqi_rpc_http,
+ piqi_rpc_webmachine_resource,
+ piqic_erlang_rpc
]},
{registered, [piqi_rpc_monitor, piqi_rpc_sup]},
{applications, [
View
2  piqic/Makefile
@@ -44,7 +44,7 @@ debug: dc top
piqi_piqi.ml: $(wildcard *.piqi)
$(PIQICC) $(PIQICC_FLAGS) -o $@.tmp.ml \
--boot piqic-boot.piqi --piqi piqic.piqi --impl piqic-impl.piqi
- $(CAMLP4)o -o $@ $@.tmp.ml
+ $(CAMLP4_O) -o $@ $@.tmp.ml
clean::
View
2  piqicc/Makefile
@@ -23,7 +23,7 @@ piqi_piqi.ml: piqi_reboot $(wildcard *.piqi)
./piqi_reboot $(PIQICC_FLAGS) -o piqi_piqi.tmp.ml \
--boot piqicc-boot.piqi --piqi piqicc.piqi --impl piqicc-impl.piqi
rm -f *.cmo *.cmi
- $(CAMLP4)o -o piqi_piqi.3.ml piqi_piqi.tmp.ml
+ $(CAMLP4_O) -o piqi_piqi.3.ml piqi_piqi.tmp.ml
ln -sf piqi_piqi.3.ml $@
View
2  piqicc/Makefile.boot2
@@ -10,7 +10,7 @@ piqi_piqi.ml: boot/piqdefs.ml boot/piqast.ml.m4
m4 boot/piqast.ml.m4 >piqi_piqi.tmp.ml
./piqi_boot | sed -e 's/Piqtype.any/any/g' >>piqi_piqi.tmp.ml
rm -f *.cmo *.cmi
- $(CAMLP4)o -o piqi_piqi.1.ml piqi_piqi.tmp.ml
+ $(CAMLP4_O) -o piqi_piqi.1.ml piqi_piqi.tmp.ml
#ln -sf piqi_piqi.1.ml $@
echo '(*pp camlp4o -I `ocamlfind query piqi.syntax` pa_labelscope.cmo pa_openin.cmo *)' >$@
cat piqi_piqi.1.ml >>$@
View
2  piqicc/Makefile.reboot
@@ -11,7 +11,7 @@ piqi_piqi.ml: boot/piqdefs.ml
./piqi_boot2 >piqi_piqi.tmp.ml
./piqi_boot | sed -e 's/Piqtype.any/any/g' >>piqi_piqi.tmp.ml
rm -f *.cmo *.cmi
- $(CAMLP4)o -o piqi_piqi.2.ml piqi_piqi.tmp.ml
+ $(CAMLP4_O) -o piqi_piqi.2.ml piqi_piqi.tmp.ml
#ln -sf piqi_piqi.1.ml $@
echo '(*pp camlp4o -I `ocamlfind query piqi.syntax` pa_labelscope.cmo pa_openin.cmo *)' >$@
cat piqi_piqi.2.ml >>$@
View
2  piqilib/Makefile
@@ -62,7 +62,7 @@ piqi_piqi.ml: $(PIQI_PIQI)
# Note, using standard piqi.org/piqi-boot as boot module for piqicc
$(PIQICC) $(PIQICC_FLAGS) -o $@.tmp.ml \
--boot piqi-boot.piqi --piqi piqi.piqi --impl piqi-impl.piqi
- $(CAMLP4)o -o $@ $@.tmp.ml
+ $(CAMLP4_O) -o $@ $@.tmp.ml
#NOTE: when installing, uninstall first to avoid "already installed" error
View
6 src/piqi_src.app.src
@@ -0,0 +1,6 @@
+{application, piqi_src,
+ [{description, "Piqi project source code"},
+ {vsn, git},
+ {modules, []},
+ {applications, [kernel, stdlib]},
+ {env, []}]}.
Please sign in to comment.
Something went wrong with that request. Please try again.