Browse files

Initial commit

Scaffolding for stm_erl
  • Loading branch information...
0 parents commit 53eb5e054897758f59e0f3eaf61967b54e3db6ae @ian-plosker committed Feb 11, 2012
Showing with 100 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +33 −0 c_src/build_deps.sh
  3. BIN c_src/tinySTM-1.0.3.tgz
  4. BIN rebar
  5. +9 −0 rebar.config
  6. +12 −0 src/stm_erl.app.src
  7. +16 −0 src/stm_erl_app.erl
  8. +28 −0 src/stm_erl_sup.erl
2 .gitignore
@@ -0,0 +1,2 @@
+c_src/tinySTM-*/
+ebin/
33 c_src/build_deps.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+TINYSTM_VSN="1.0.3"
+
+set -e
+
+if [ `basename $PWD` != "c_src" ]; then
+ pushd c_src
+fi
+
+BASEDIR="$PWD"
+
+case "$1" in
+ clean)
+ rm -rf tinySTM-$TINYSTM_VSN
+ ;;
+
+ test)
+ (cd tinySTM-$TINYSTM_VSN && make check)
+
+ ;;
+ *)
+ export NOTLS=1
+
+ if [ ! -d tinySTM-$TINYSTM_VSN ]; then
+ tar -xzf tinySTM-$TINYSTM_VSN.tgz
+ fi
+
+ (cd tinySTM-$TINYSTM_VSN && make all)
+
+ ;;
+esac
+
BIN c_src/tinySTM-1.0.3.tgz
Binary file not shown.
BIN rebar
Binary file not shown.
9 rebar.config
@@ -0,0 +1,9 @@
+{so_name, "stm_erl.so"}.
+
+{port_sources, ["c_src/*.c"]}.
+
+{port_envs, []}.
+
+{pre_hooks, [{compile, "c_src/build_deps.sh"}]}.
+
+{post_hooks, [{clean, "c_src/build_deps.sh clean"}]}.
12 src/stm_erl.app.src
@@ -0,0 +1,12 @@
+{application, stm_erl,
+ [
+ {description, ""},
+ {vsn, "1"},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {mod, { stm_erl_app, []}},
+ {env, []}
+ ]}.
16 src/stm_erl_app.erl
@@ -0,0 +1,16 @@
+-module(stm_erl_app).
+
+-behaviour(application).
+
+%% Application callbacks
+-export([start/2, stop/1]).
+
+%% ===================================================================
+%% Application callbacks
+%% ===================================================================
+
+start(_StartType, _StartArgs) ->
+ stm_erl_sup:start_link().
+
+stop(_State) ->
+ ok.
28 src/stm_erl_sup.erl
@@ -0,0 +1,28 @@
+
+-module(stm_erl_sup).
+
+-behaviour(supervisor).
+
+%% API
+-export([start_link/0]).
+
+%% Supervisor callbacks
+-export([init/1]).
+
+%% Helper macro for declaring children of supervisor
+-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
+
+%% ===================================================================
+%% API functions
+%% ===================================================================
+
+start_link() ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+%% ===================================================================
+%% Supervisor callbacks
+%% ===================================================================
+
+init([]) ->
+ {ok, { {one_for_one, 5, 10}, []} }.
+

0 comments on commit 53eb5e0

Please sign in to comment.