[thrift] highly concurrent Erlang goodness
Summary:
* shim to use object-oriented code as gen_servers
* high(er) performance Erlang-style server and transport
* sane packaging based on otp-base, i.e. Makefiles and real structure
Test Plan: tutorial server offers the same (subset of) functionality as previous version
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665164 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/tools/.appgen/blank_app/Makefile b/lib/erl/tools/.appgen/blank_app/Makefile
new file mode 100755
index 0000000..0f2c8a8
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/Makefile
@@ -0,0 +1,7 @@
+MODULES = \
+ src
+
+all clean docs:
+ for dir in $(MODULES); do \
+ (cd $$dir; ${MAKE} $@); \
+ done
diff --git a/lib/erl/tools/.appgen/blank_app/include/blank_app.hrl b/lib/erl/tools/.appgen/blank_app/include/blank_app.hrl
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/include/blank_app.hrl
diff --git a/lib/erl/tools/.appgen/blank_app/src/Makefile b/lib/erl/tools/.appgen/blank_app/src/Makefile
new file mode 100755
index 0000000..13b06f0
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/src/Makefile
@@ -0,0 +1,112 @@
+# $Id: Makefile,v 1.3 2004/08/13 16:35:59 mlogan Exp $
+#
+include ../../../build/otp.mk
+include ../../../build/colors.mk
+include ../../../build/buildtargets.mk
+
+# ----------------------------------------------------
+# Application version
+# ----------------------------------------------------
+
+include ../vsn.mk
+APP_NAME=%%APP_NAME%%
+PFX=%%PFX%%
+VSN=$(%%APP_NAME_UPPER_CASE%%_VSN)
+
+# ----------------------------------------------------
+# Install directory specification
+# WARNING: INSTALL_DIR the command to install a directory.
+# INSTALL_DST is the target directory
+# ----------------------------------------------------
+INSTALL_DST = $(ERLANG_OTP)/lib/$(APP_NAME)-$(VSN)
+
+# ----------------------------------------------------
+# Target Specs
+# ----------------------------------------------------
+
+
+MODULES = $(shell ls *.erl | sed s/.erl//)
+MODULES_COMMA = $(shell ls *.erl | sed s/\\.erl/,/)
+
+HRL_FILES=
+INTERNAL_HRL_FILES= $(APP_NAME).hrl
+ERL_FILES= $(MODULES:%=%.erl)
+DOC_FILES=$(ERL_FILES)
+
+APP_FILE= $(APP_NAME).app
+APPUP_FILE= $(APP_NAME).appup
+
+APP_SRC= $(APP_FILE).src
+APPUP_SRC= $(APPUP_FILE).src
+
+APP_TARGET= $(EBIN)/$(APP_FILE)
+APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
+
+BEAMS= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+TARGET_FILES= $(BEAMS) $(APP_TARGET) $(APPUP_TARGET)
+
+WEB_TARGET=/var/yaws/www/$(APP_NAME)
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+
+ERL_FLAGS +=
+ERL_COMPILE_FLAGS += -I../include -I../../fslib/include -I../../system_status/include
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+
+all debug opt: $(EBIN) $(TARGET_FILES)
+
+#$(EBIN)/rm_logger.beam: $(APP_NAME).hrl
+include ../../../build/docs.mk
+
+# Note: In the open-source build clean must not destroy the preloaded
+# beam files.
+clean:
+ rm -f $(TARGET_FILES)
+ rm -f core
+ rm -rf $(EBIN)
+ rm -rf *html
+
+$(EBIN):
+ mkdir $(EBIN)
+
+# ----------------------------------------------------
+# Special Build Targets
+# ----------------------------------------------------
+
+$(APP_TARGET): $(APP_SRC) ../vsn.mk $(BEAMS)
+ sed -e 's;%VSN%;$(VSN);' \
+ -e 's;%PFX%;$(PFX);' \
+ -e 's;%APP_NAME%;$(APP_NAME);' \
+ -e 's;%MODULES%;%MODULES%$(MODULES_COMMA);' \
+ $< > $<".tmp"
+ sed -e 's/%MODULES%\(.*\),/\1/' \
+ $<".tmp" > $@
+ rm $<".tmp"
+
+
+$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
+ sed -e 's;%VSN%;$(VSN);' $< > $@
+
+$(WEB_TARGET): ../markup/*
+ rm -rf $(WEB_TARGET)
+ mkdir $(WEB_TARGET)
+ cp -r ../markup/ $(WEB_TARGET)
+ cp -r ../skins/ $(WEB_TARGET)
+
+# ----------------------------------------------------
+# Install Target
+# ----------------------------------------------------
+
+install: all $(WEB_TARGET)
+# $(INSTALL_DIR) $(INSTALL_DST)/src
+# $(INSTALL_DATA) $(ERL_FILES) $(INSTALL_DST)/src
+# $(INSTALL_DATA) $(INTERNAL_HRL_FILES) $(INSTALL_DST)/src
+# $(INSTALL_DIR) $(INSTALL_DST)/include
+# $(INSTALL_DATA) $(HRL_FILES) $(INSTALL_DST)/include
+# $(INSTALL_DIR) $(INSTALL_DST)/ebin
+# $(INSTALL_DATA) $(TARGET_FILES) $(INSTALL_DST)/ebin
diff --git a/lib/erl/tools/.appgen/blank_app/src/ba_server.erl b/lib/erl/tools/.appgen/blank_app/src/ba_server.erl
new file mode 100755
index 0000000..9a98f1c
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/src/ba_server.erl
@@ -0,0 +1,124 @@
+%%%-------------------------------------------------------------------
+%%% @doc
+%%% @end
+%%%-------------------------------------------------------------------
+-module(%%PFX%%_server).
+
+-behaviour(gen_server).
+%%--------------------------------------------------------------------
+%% Include files
+%%--------------------------------------------------------------------
+-include("%%APP_NAME%%.hrl").
+
+%%--------------------------------------------------------------------
+%% External exports
+%%--------------------------------------------------------------------
+-export([
+ start_link/0,
+ stop/0
+ ]).
+
+%%--------------------------------------------------------------------
+%% gen_server callbacks
+%%--------------------------------------------------------------------
+-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
+
+%%--------------------------------------------------------------------
+%% record definitions
+%%--------------------------------------------------------------------
+-record(state, {}).
+
+%%--------------------------------------------------------------------
+%% macro definitions
+%%--------------------------------------------------------------------
+-define(SERVER, ?MODULE).
+
+%%====================================================================
+%% External functions
+%%====================================================================
+%%--------------------------------------------------------------------
+%% @doc Starts the server.
+%% @spec start_link() -> {ok, pid()} | {error, Reason}
+%% @end
+%%--------------------------------------------------------------------
+start_link() ->
+ gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
+
+%%--------------------------------------------------------------------
+%% @doc Stops the server.
+%% @spec stop() -> ok
+%% @end
+%%--------------------------------------------------------------------
+stop() ->
+ gen_server:cast(?SERVER, stop).
+
+%%====================================================================
+%% Server functions
+%%====================================================================
+
+%%--------------------------------------------------------------------
+%% Function: init/1
+%% Description: Initiates the server
+%% Returns: {ok, State} |
+%% {ok, State, Timeout} |
+%% ignore |
+%% {stop, Reason}
+%%--------------------------------------------------------------------
+init([]) ->
+ {ok, #state{}}.
+
+%%--------------------------------------------------------------------
+%% Function: handle_call/3
+%% Description: Handling call messages
+%% Returns: {reply, Reply, State} |
+%% {reply, Reply, State, Timeout} |
+%% {noreply, State} |
+%% {noreply, State, Timeout} |
+%% {stop, Reason, Reply, State} | (terminate/2 is called)
+%% {stop, Reason, State} (terminate/2 is called)
+%%--------------------------------------------------------------------
+handle_call(Request, From, State) ->
+ Reply = ok,
+ {reply, Reply, State}.
+
+%%--------------------------------------------------------------------
+%% Function: handle_cast/2
+%% Description: Handling cast messages
+%% Returns: {noreply, State} |
+%% {noreply, State, Timeout} |
+%% {stop, Reason, State} (terminate/2 is called)
+%%--------------------------------------------------------------------
+handle_cast(stop, State) ->
+ {stop, normal, State};
+handle_cast(Msg, State) ->
+ {noreply, State}.
+
+%%--------------------------------------------------------------------
+%% Function: handle_info/2
+%% Description: Handling all non call/cast messages
+%% Returns: {noreply, State} |
+%% {noreply, State, Timeout} |
+%% {stop, Reason, State} (terminate/2 is called)
+%%--------------------------------------------------------------------
+handle_info(Info, State) ->
+ {noreply, State}.
+
+%%--------------------------------------------------------------------
+%% Function: terminate/2
+%% Description: Shutdown the server
+%% Returns: any (ignored by gen_server)
+%%--------------------------------------------------------------------
+terminate(Reason, State) ->
+ ok.
+
+%%--------------------------------------------------------------------
+%% Func: code_change/3
+%% Purpose: Convert process state when code is changed
+%% Returns: {ok, NewState}
+%%--------------------------------------------------------------------
+code_change(OldVsn, State, Extra) ->
+ {ok, State}.
+
+%%====================================================================
+%%% Internal functions
+%%====================================================================
diff --git a/lib/erl/tools/.appgen/blank_app/src/ba_sup.erl b/lib/erl/tools/.appgen/blank_app/src/ba_sup.erl
new file mode 100755
index 0000000..b5f48d1
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/src/ba_sup.erl
@@ -0,0 +1,74 @@
+%%%-------------------------------------------------------------------
+%%% @doc
+%%% @end
+%%%-------------------------------------------------------------------
+-module(%%PFX%%_sup).
+
+-behaviour(supervisor).
+%%--------------------------------------------------------------------
+%% Include files
+%%--------------------------------------------------------------------
+
+%%--------------------------------------------------------------------
+%% External exports
+%%--------------------------------------------------------------------
+-export([
+ start_link/1
+ ]).
+
+%%--------------------------------------------------------------------
+%% Internal exports
+%%--------------------------------------------------------------------
+-export([
+ init/1
+ ]).
+
+%%--------------------------------------------------------------------
+%% Macros
+%%--------------------------------------------------------------------
+-define(SERVER, ?MODULE).
+
+%%--------------------------------------------------------------------
+%% Records
+%%--------------------------------------------------------------------
+
+%%====================================================================
+%% External functions
+%%====================================================================
+%%--------------------------------------------------------------------
+%% @doc Starts the supervisor.
+%% @spec start_link(StartArgs) -> {ok, pid()} | Error
+%% @end
+%%--------------------------------------------------------------------
+start_link(StartArgs) ->
+ supervisor:start_link({local, ?SERVER}, ?MODULE, []).
+
+%%====================================================================
+%% Server functions
+%%====================================================================
+%%--------------------------------------------------------------------
+%% Func: init/1
+%% Returns: {ok, {SupFlags, [ChildSpec]}} |
+%% ignore |
+%% {error, Reason}
+%%--------------------------------------------------------------------
+init([]) ->
+ RestartStrategy = one_for_one,
+ MaxRestarts = 1000,
+ MaxTimeBetRestarts = 3600,
+
+ SupFlags = {RestartStrategy, MaxRestarts, MaxTimeBetRestarts},
+
+ ChildSpecs =
+ [
+ {%%PFX%%_server,
+ {%%PFX%%_server, start_link, []},
+ permanent,
+ 1000,
+ worker,
+ [%%PFX%%_server]}
+ ],
+ {ok,{SupFlags, ChildSpecs}}.
+%%====================================================================
+%% Internal functions
+%%====================================================================
diff --git a/lib/erl/tools/.appgen/blank_app/src/blank_app.app.src b/lib/erl/tools/.appgen/blank_app/src/blank_app.app.src
new file mode 100755
index 0000000..a1513fb
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/src/blank_app.app.src
@@ -0,0 +1,41 @@
+%%% -*- mode:erlang -*-
+{application, %APP_NAME%,
+ [
+ % A quick description of the application.
+ {description, "An Erlang Application."},
+
+ % The version of the applicaton
+ {vsn, "%VSN%"},
+
+ % All modules used by the application.
+ {modules,
+ [
+ %MODULES%
+ ]},
+
+ % All of the registered names the application uses. This can be ignored.
+ {registered, []},
+
+ % Applications that are to be started prior to this one. This can be ignored
+ % leave it alone unless you understand it well and let the .rel files in
+ % your release handle this.
+ {applications,
+ [
+ kernel,
+ stdlib
+ ]},
+
+ % OTP application loader will load, but not start, included apps. Again
+ % this can be ignored as well. To load but not start an application it
+ % is easier to include it in the .rel file followed by the atom 'none'
+ {included_applications, []},
+
+ % configuration parameters similar to those in the config file specified
+ % on the command line. can be fetched with gas:get_env
+ {env, []},
+
+ % The Module and Args used to start this application.
+ {mod, {%APP_NAME%, []}}
+ ]
+}.
+
diff --git a/lib/erl/tools/.appgen/blank_app/src/blank_app.appup.src b/lib/erl/tools/.appgen/blank_app/src/blank_app.appup.src
new file mode 100755
index 0000000..54a6383
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/src/blank_app.appup.src
@@ -0,0 +1 @@
+{"%VSN%",[],[]}.
diff --git a/lib/erl/tools/.appgen/blank_app/src/blank_app.erl b/lib/erl/tools/.appgen/blank_app/src/blank_app.erl
new file mode 100755
index 0000000..8db6fe0
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/src/blank_app.erl
@@ -0,0 +1,63 @@
+%%%-------------------------------------------------------------------
+%%% @doc
+%%% @end
+%%%-------------------------------------------------------------------
+-module(%%APP_NAME%%).
+
+-behaviour(application).
+%%--------------------------------------------------------------------
+%% Include files
+%%--------------------------------------------------------------------
+-include("%%APP_NAME%%.hrl").
+
+%%--------------------------------------------------------------------
+%% External exports
+%%--------------------------------------------------------------------
+-export([
+ start/2,
+ shutdown/0,
+ stop/1
+ ]).
+
+%%--------------------------------------------------------------------
+%% Macros
+%%--------------------------------------------------------------------
+
+%%--------------------------------------------------------------------
+%% Records
+%%--------------------------------------------------------------------
+
+%%====================================================================
+%% External functions
+%%====================================================================
+%%--------------------------------------------------------------------
+%% @doc The starting point for an erlang application.
+%% @spec start(Type, StartArgs) -> {ok, Pid} | {ok, Pid, State} | {error, Reason}
+%% @end
+%%--------------------------------------------------------------------
+start(Type, StartArgs) ->
+ case %%PFX%%_sup:start_link(StartArgs) of
+ {ok, Pid} ->
+ {ok, Pid};
+ Error ->
+ Error
+ end.
+
+%%--------------------------------------------------------------------
+%% @doc Called to shudown the %%APP_NAME%% application.
+%% @spec shutdown() -> ok
+%% @end
+%%--------------------------------------------------------------------
+shutdown() ->
+ application:stop(%%APP_NAME%%).
+
+%%====================================================================
+%% Internal functions
+%%====================================================================
+
+%%--------------------------------------------------------------------
+%% Called upon the termintion of an application.
+%%--------------------------------------------------------------------
+stop(State) ->
+ ok.
+
diff --git a/lib/erl/tools/.appgen/blank_app/vsn.mk b/lib/erl/tools/.appgen/blank_app/vsn.mk
new file mode 100755
index 0000000..9ba174b
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app/vsn.mk
@@ -0,0 +1 @@
+%%APP_NAME_UPPER_CASE%%_VSN=1.0
diff --git a/lib/erl/tools/.appgen/blank_app_rel/Makefile b/lib/erl/tools/.appgen/blank_app_rel/Makefile
new file mode 100755
index 0000000..5d35956
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app_rel/Makefile
@@ -0,0 +1,298 @@
+# ----------------------------------------------------
+# Make file for creating an otp release.
+# ----------------------------------------------------
+
+##
+# Basename of this release.
+##
+RELS=$(shell basename `pwd`)
+APP_NAME=$(shell echo $(RELS) | sed s/_rel$$//)
+
+include ../../build/otp.mk
+
+include ./vsn.mk
+
+#include $(ERL_TOP)/make/target.mk
+#include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+USR_LIBPATH=../../lib
+INSTALL_DIR=/usr/local/lib
+ABS_USER_LIBPATH=$(shell cd ../../lib;pwd)
+
+# ----------------------------------------------------
+# CREATE DIR STRUCTURE HERE
+# ----------------------------------------------------
+
+HTDOCS=$(wildcard $(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs/*.html) \
+ $(wildcard $(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs/*.htm) \
+ $(wildcard $(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs/*.yaws)
+BUILD_FILES=fs_boot_smithe.beam fs_lists.beam fs_lib.beam
+
+LOCAL_DIR=local
+#LOCAL_DIR=$(shell cat $(RELS).rel.src |grep -m 1 '$(APP_NAME)' |awk -F '"' '{printf "%s-%s", $$2,$$4}')
+
+DIR_STRUCTURE= \
+ $(LOCAL_DIR) \
+ $(LOCAL_DIR)/log/$(REL_VSN) \
+ $(LOCAL_DIR)/var/$(REL_VSN) \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/htdocs
+
+PRODUCTION_DIR_STRUCTURE= \
+ $(RELS) \
+ $(RELS)/release/$(REL_VSN) \
+ $(RELS)/stage \
+ $(RELS)/log/$(REL_VSN) \
+ $(RELS)/var/$(REL_VSN) \
+ $(RELS)/var/$(REL_VSN)/www \
+ $(RELS)/var/$(REL_VSN)/www/htdocs \
+ $(RELS)/var/$(REL_VSN)/www/conf
+
+# ----------------------------------------------------
+SCRIPT_AND_BOOT_FILES= \
+ $(RELS).script \
+ $(RELS).boot
+
+LOCAL_SCRIPT_AND_BOOT_FILES= \
+ $(LOCAL_DIR)/$(RELS).script \
+ $(LOCAL_DIR)/$(RELS).boot
+
+LOCAL_HTTP_CONF= \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/yaws.conf \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/mime.types
+
+PRODUCTION_HTTP_CONF= \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/yaws.conf \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/mime.types
+
+LOCAL_TARGET_FILES=$(LOCAL_HTTP_CONF) $(LOCAL_DIR)/$(RELS).config $(LOCAL_SCRIPT_AND_BOOT_FILES)
+
+LOCAL_TARGETS=$(LOCAL_DIR)/$(RELS).sh vsnit $(LOCAL_TARGET_FILES)
+
+PRODUCTION_TARGETS=$(RELS)/build/$(REL_VSN) \
+ $(RELS)/lib \
+ $(RELS)/stage/$(RELS).rel.src \
+ $(RELS)/stage/$(RELS).config.src \
+ $(RELS)/stage/yaws.conf.src \
+ $(RELS)/stage/$(RELS).sh.src \
+ $(RELS)/var/$(REL_VSN)/www/htdocs \
+ $(RELS)/install.sh \
+ $(RELS)/release/$(REL_VSN)/clean_release
+
+# ----------------------------------------------------
+# TARGETS
+# ----------------------------------------------------
+
+all debug opt instr script: $(DIR_STRUCTURE) $(LOCAL_TARGETS) $(PRODUCTION_DIR_STRUCTURE) $(PRODUCTION_TARGETS)
+ @echo $(HTDOCS)
+
+install: stage
+
+tar: $(RELS)-$(LOCATION)-$(REL_VSN).tgz
+
+$(DIR_STRUCTURE):
+ mkdir -p $@
+
+$(PRODUCTION_DIR_STRUCTURE):
+ mkdir -p $@
+
+clean:
+ $(RM) $(REL_SCRIPTS) $(TARGET_FILES)
+ $(RM) -r $(LOCAL_DIR) $(PRODN_DIR)
+ $(RM) $(RELS).rel
+ $(RM) -r $(RELS)
+ $(RM) $(RELS)*.tgz
+ $(RM) $(RELS).rel.src.tmp
+ $(RM) $(SCRIPT_AND_BOOT_FILES)
+
+docs:
+
+# ----------------------------------------------------
+# TARGETS FOR LOCAL MODE
+# ----------------------------------------------------
+
+# startup script for local mode
+$(LOCAL_DIR)/$(RELS).sh:
+ @echo '#!/bin/sh' > $@
+ @echo "cd $(CURDIR)/$(LOCAL_DIR)" >> $@
+ @echo "erl -name $${USER}_$(RELS) -boot $(RELS) -config $(RELS).config \$$@" >> $@
+ chmod +x $@
+ @echo
+ @echo "==== Start local node with \"sh $@\" ===="
+ @echo
+
+# Create the config file for local mode.
+$(LOCAL_DIR)/$(RELS).config: $(RELS).config.src
+ sed -e 's;%LOG_OTP%;$(CURDIR)/$(LOCAL_DIR)/log/$(REL_VSN);' \
+ -e 's;%VAR_OTP%;$(CURDIR)/$(LOCAL_DIR)/var/$(REL_VSN);' \
+ -e 's;%RELS%;$(RELS);g' \
+ -e 's;%HOME%;$(HOME);g' \
+ -e 's;%BROADCAST_ADDRESS%;$(BROADCAST_ADDRESS);g' \
+ -e 's;%CONTACT_NODE%;$(CONTACT_NODE);g' \
+ -e "s;%HOSTNAME%;`hostname --long`;" \
+ -e 's;%APP_NAME%;$(APP_NAME);' \
+ -e 's;%APP_VERSION%;$(APP_VERSION);g' \
+ $< > $@
+
+# Create the httpd conf file for local mode.
+$(LOCAL_DIR)/var/$(REL_VSN)/www/conf/yaws.conf: yaws.conf.src
+ sed -e 's;%VAR_OTP%;$(CURDIR)/$(LOCAL_DIR)/var/$(REL_VSN);' \
+ -e 's;%LOG_OTP%;$(CURDIR)/$(LOCAL_DIR)/log/$(REL_VSN);' \
+ -e 's;%HTDOC_ROOT%;$(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs;' \
+ -e 's;%APP_NAME%;$(APP_NAME);' \
+ -e 's;%RELS%;$(RELS);' \
+ -e 's;%USER%;$(USER);' \
+ -e 's;%HTDOC_ROOT%;$(ABS_USER_LIBPATH);' \
+ -e 's;%MHOST%;$(MHOST);' \
+ $< > $@
+
+# Create the config file for local mode.
+vsnit: $(RELS).rel.src
+ sed -e 's;%REL_VSN%;$(REL_VSN);' \
+ $< > $<.tmp
+
+# Create and position script and boot files for local mode.
+$(LOCAL_SCRIPT_AND_BOOT_FILES):
+ @ erl -pz $(USR_LIBPATH)/fslib/ebin \
+ -noshell \
+ -s fs_lib s_apply fs_boot_smithe make_script_and_boot "[\"$(ERL_RUN_TOP)/*\", \"$(USR_LIBPATH)\"]. " \
+ \"$$(basename `pwd`)".rel.src.tmp\". " \
+ "[local]. " \
+ -s init stop
+ cp $(SCRIPT_AND_BOOT_FILES) $(LOCAL_DIR)/
+
+$(LOCAL_DIR)/var/$(REL_VSN)/www/conf/mime.types: ../../build/mime.types
+ cp $< $@
+
+# ----------------------------------------------------
+# TARGETS FOR PRODUCTION MODE
+# ----------------------------------------------------
+$(RELS)/lib:
+ # For some reason this will not happen if added to PRODUCTION_DIR_STRUCTURE
+ mkdir $@
+ @ erl -pz $(RELS)/build/$(REL_VSN) \
+ -noshell \
+ -s fs_lib s_apply fs_boot_smithe stage_from_relsrc "[\"$(USR_LIBPATH)\"]. " \
+ \"$$(basename `pwd`)".rel.src\". " \
+ \"$@\"". " \
+ -s init stop
+
+# Move the htdocs from the local apps to the production htdoc root directory.
+$(RELS)/var/$(REL_VSN)/www/htdocs/: $(HTDOCS)
+ @mkdir -p $(RELS)/var/$(REL_VSN)/www/htdocs; \
+ for x in $(HTDOCS);do \
+ cp $$x $@; \
+ done
+
+# startup script for production mode
+$(RELS)/stage/$(RELS).sh.src:
+ @echo '#!/bin/sh' > $@
+ @echo "cd %INSTALL_DIR%/$(RELS)/release/$(REL_VSN)" >> $@
+ @echo "erl -name $(RELS) -boot $(RELS) -config $(RELS).config -detached \$$@" >> $@
+ chmod +x $@
+
+$(RELS)/build/$(REL_VSN): $(USR_LIBPATH)/fslib/ebin
+ mkdir -p $(RELS)/build/$(REL_VSN)
+ cp $</fs_boot_smithe.beam $@
+ cp $</fs_lib.beam $@
+ cp $</fs_lists.beam $@
+
+$(RELS)/stage/$(RELS).rel.src: $(RELS).rel.src.tmp
+ cp $< $@
+
+$(RELS)/stage/$(RELS).config.src: $(RELS).config.src
+ cp $< $@
+
+$(RELS)/stage/yaws.conf.src: yaws.conf.src
+ cp $< $@
+
+$(RELS)/install.sh:
+ @echo '#!/bin/sh' > $@
+ @echo "" >> $@
+ @echo "if [ \$$# -eq 1 ];then" >> $@
+ @echo " INSTALL_DIR=\$$1;" >> $@
+ @echo "else" >> $@
+ @echo " INSTALL_DIR=$(INSTALL_DIR);" >> $@
+ @echo "fi" >> $@
+ @echo "" >> $@
+ @echo "function munge() {" >> $@
+ @echo " sed -e \"s;%LOG_OTP%;\$$INSTALL_DIR/$(RELS)/log/$(REL_VSN);g\" \\" >> $@
+ @echo " -e \"s;%VAR_OTP%;\$$INSTALL_DIR/$(RELS)/var/$(REL_VSN);g\" \\" >> $@
+ @echo " -e \"s;%RELS%;$(RELS);g\" \\" >> $@
+ @echo " -e \"s;%REL_VSN%;$(REL_VSN);g\" \\" >> $@
+ @echo " -e \"s;%USER%;$$USER;g\" \\" >> $@
+ @echo " -e \"s;%HTDOC_ROOT%;\$$INSTALL_DIR/$(RELS)/var/$(REL_VSN)/www/htdocs;g\" \\" >> $@
+ @echo " -e \"s;%MHOST%;\`hostname\`;g\" \\" >> $@
+ @echo " -e \"s;%BROADCAST_ADDRESS%;$(BROADCAST_ADDRESS);g\" \\" >> $@
+ @echo " -e \"s;%INSTALL_DIR%;\$$INSTALL_DIR;g\" \\" >> $@
+ @echo " -e \"s;%CONTACT_NODE%;$(CONTACT_NODE);g\" \\" >> $@
+ @echo " -e \"s;%HOSTNAME%;\`hostname --long\`;g\" \\" >> $@
+ @echo " -e \"s;%APP_NAME%;$(APP_NAME);g\" \\" >> $@
+ @echo " -e \"s;%APP_VERSION%;$(APP_VERSION);g\" \\" >> $@
+ @echo ' $$1 > $$2' >> $@
+ @echo "}" >> $@
+ @echo "" >> $@
+ @echo "munge stage/yaws.conf.src var/$(REL_VSN)/www/conf/yaws.conf;" >> $@
+ @echo "munge stage/$(RELS).config.src release/$(REL_VSN)/$(RELS).config;" >> $@
+ @echo "munge stage/$(RELS).sh.src release/$(REL_VSN)/$(RELS).sh;" >> $@
+ @echo "munge stage/$(RELS).rel.src release/$(REL_VSN)/$(RELS).rel;" >> $@
+ @echo "chmod +x release/$(REL_VSN)/$(RELS).sh;" >> $@
+ @echo "" >> $@
+ @echo "cd ..;" >> $@
+ @echo "find $(RELS) | cpio -o > \$$INSTALL_DIR/$(RELS).cpio;" >> $@
+ @echo "cd -;" >> $@
+ @echo "cd \$$INSTALL_DIR; " >> $@
+ @echo "echo -n \"Unpacked: \"" >> $@
+ @echo "cpio -uid < $(RELS).cpio;" >> $@
+ @echo "rm $(RELS).cpio;" >> $@
+ @echo "" >> $@
+ @echo "echo \"pwd is \`pwd\`\";" >> $@
+ @echo "cd $(RELS);" >> $@
+ @echo " erl -pz build/$(REL_VSN) \\" >> $@
+ @echo " -noshell \\" >> $@
+ @echo -n " -s fs_lib s_apply fs_boot_smithe make_script_and_boot \"[\\\"$(ERL_RUN_TOP)/*\\\", \\\"lib/\\\"]. \" " >> $@
+ @echo -n "\"\\\"stage/$$(basename `pwd`).rel.src\\\". \" " >> $@
+ @echo -n "\"[local]. \" " >> $@
+ @echo "-s init stop | egrep '*terminate*|ERROR'" >> $@
+ @echo "if [ \$$? -eq 0 ]; then" >> $@
+ @echo "echo \"============================================\";" >> $@
+ @echo "echo \"STAGE FAILURE \$$? - Silence the discord.\";" >> $@
+ @echo "echo \"============================================\";" >> $@
+ @echo "exit 1;" >> $@
+ @echo "fi" >> $@
+ @echo "" >> $@
+ @echo "mv $(RELS).rel $(RELS).script $(RELS).boot release/$(REL_VSN);" >> $@
+ @echo "" >> $@
+ @echo "rm -r stage;" >> $@
+ @echo "rm -r build;" >> $@
+ @echo "cd -;" >> $@
+ @echo "" >> $@
+ @echo "chgrp -R erts $(RELS); " >> $@
+ @echo "chmod -R 775 $(RELS); " >> $@
+ @echo "cd -" >> $@
+ @echo "" >> $@
+ @echo "rm -f /usr/local/bin/$(APP_NAME);" >> $@
+ @echo "ln -s \$$INSTALL_DIR/$(RELS)/release/$(REL_VSN)/$(RELS).sh /usr/local/bin/$(APP_NAME);" >> $@
+ @echo "chgrp -R erts /usr/local/bin/$(APP_NAME); " >> $@
+ @echo "chmod -R 775 /usr/local/bin/$(APP_NAME); " >> $@
+ @echo "rm \$$INSTALL_DIR/$(RELS)/install.sh;" >> $@
+ @echo "echo -n $$'\e[0;32m'" >> $@
+ @echo "echo \"$(APP_NAME) installation to \$$INSTALL_DIR complete.\"" >> $@
+ @echo "echo -n $$'\e[0m'" >> $@
+ chmod +x $@
+
+
+stage: $(RELS)
+ cd $(RELS); \
+ ./install.sh; \
+ cd -
+
+$(RELS)/var/$(REL_VSN)/www/conf/mime.types: ../../build/mime.types
+ cp $< $@
+
+$(RELS)-$(LOCATION)-$(REL_VSN).tgz: $(RELS)
+ tar -zcvf $@ $<
+
+$(RELS)/release/$(REL_VSN)/clean_release: ../../tools/utilities/clean_release
+ cp $< $@
+
diff --git a/lib/erl/tools/.appgen/blank_app_rel/blank_app_rel.config.src b/lib/erl/tools/.appgen/blank_app_rel/blank_app_rel.config.src
new file mode 100755
index 0000000..c701c5a
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app_rel/blank_app_rel.config.src
@@ -0,0 +1,26 @@
+%%% -*- mode:erlang -*-
+%%% Parameter settings for apps on %APP_NAME%
+%%% Warning - this config file *must* end with <dot><whitespace>
+
+%% write log files to sasl_dir
+[
+ {sasl,
+ [
+ {sasl_error_logger, {file, "%LOG_OTP%/sasl_log"}}
+ ]},
+
+
+ {gas,
+ [
+ {mod_specs, [{elwrap, {fs_elwrap_h, start_link}}]},
+
+ % elwrap config.
+ {err_log, "%LOG_OTP%/err_log"},
+ {err_log_wrap_info, {{err,5000000,10},{sasl,5000000,10}}},
+ {err_log_tty, true} % Log to the screen
+ ]},
+
+ {%APP_NAME%,
+ [
+ ]}
+].
diff --git a/lib/erl/tools/.appgen/blank_app_rel/blank_app_rel.rel.src b/lib/erl/tools/.appgen/blank_app_rel/blank_app_rel.rel.src
new file mode 100755
index 0000000..f69578e
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app_rel/blank_app_rel.rel.src
@@ -0,0 +1,14 @@
+%%% -*- mode:erlang -*-
+{release,
+ {"%%APP_NAME%%_rel", "%REL_VSN%"},
+ erts,
+ [
+ kernel,
+ stdlib,
+ sasl,
+ fslib,
+ gas,
+ %%APP_NAME%%
+ ]
+}.
+
diff --git a/lib/erl/tools/.appgen/blank_app_rel/vsn.mk b/lib/erl/tools/.appgen/blank_app_rel/vsn.mk
new file mode 100755
index 0000000..0ac8e07
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app_rel/vsn.mk
@@ -0,0 +1 @@
+REL_VSN=1.0
diff --git a/lib/erl/tools/.appgen/blank_app_rel/yaws.conf.src b/lib/erl/tools/.appgen/blank_app_rel/yaws.conf.src
new file mode 100644
index 0000000..8857aac
--- /dev/null
+++ b/lib/erl/tools/.appgen/blank_app_rel/yaws.conf.src
@@ -0,0 +1,166 @@
+
+# conf for yaws
+
+
+# first we have a set of globals
+# That apply to all virtual servers
+
+
+# This is the directory where all logfiles for
+# all virtual servers will be written
+
+logdir = /var/log/yaws
+
+# This the path to a directory where additional
+# beam code can be placed. The daemon will add this
+# directory to its search path
+
+ebin_dir = /var/yaws/ebin
+
+
+# This is a directory where application specific .hrl
+# files can be placed. application specifig .yaws code can
+# then include these .hrl files
+
+include_dir = /var/yaws/include
+
+
+
+
+
+# This is a debug variable, possible values are http | traffic | false
+# It is also possible to set the trace (possibly to the tty) while
+# invoking yaws from the shell as in
+# yaws -i -T -x (see man yaws)
+
+trace = false
+
+
+
+
+
+# it is possible to have yaws start additional
+# application specific code at startup
+#
+# runmod = mymodule
+
+
+# By default yaws will copy the erlang error_log and
+# end write it to a wrap log called report.log (in the logdir)
+# this feature can be turned off. This would typically
+# be the case when yaws runs within another larger app
+
+copy_error_log = true
+
+
+# Logs are wrap logs
+
+log_wrap_size = 1000000
+
+
+# Possibly resolve all hostnames in logfiles so webalizer
+# can produce the nice geography piechart
+
+log_resolve_hostname = false
+
+
+
+# fail completely or not if yaws fails
+# to bind a listen socket
+fail_on_bind_err = true
+
+
+
+# If yaws is started as root, it can, once it has opened
+# all relevant sockets for listening, change the uid to a
+# user with lower accessrights than root
+
+# username = nobody
+
+
+# If HTTP auth is used, it is possible to have a specific
+# auth log.
+
+auth_log = true
+
+
+# When we're running multiple yaws systems on the same
+# host, we need to give each yaws system an individual
+# name. Yaws will write a number of runtime files under
+# /tmp/yaws/${id}
+# The default value is "default"
+
+
+# id = myname
+
+
+# earlier versions of Yaws picked the first virtual host
+# in a list of hosts with the same IP/PORT when the Host:
+# header doesn't match any name on any Host
+# This is often nice in testing environments but not
+# acceptable in real live hosting scenarios
+
+pick_first_virthost_on_nomatch = true
+
+
+# All unices are broken since it's not possible to bind to
+# a privileged port (< 1024) unless uid==0
+# There is a contrib in jungerl which makes it possible by means
+# of an external setuid root programm called fdsrv to listen to
+# to privileged port.
+# If we use this feature, it requires fdsrv to be properly installed.
+# Doesn't yet work with SSL.
+
+use_fdsrv = false
+
+
+
+
+# end then a set of virtual servers
+# First two virthosted servers on the same IP (0.0.0.0)
+# in this case, but an explicit IP can be given as well
+
+<server core.martinjlogan.com>
+ port = 80
+ listen = 0.0.0.0
+ docroot = /var/yaws/www
+ arg_rewrite_mod = pwr_arg_rewrite_mod
+ appmods = <pwr, pwr_main_controller_appmod>
+</server>
+
+<server localhost>
+ port = 80
+ listen = 0.0.0.0
+ docroot = /tmp
+ dir_listings = true
+ dav = true
+ <auth>
+ realm = foobar
+ dir = /
+ user = foo:bar
+ user = baz:bar
+ </auth>
+</server>
+
+
+
+# And then an ssl server
+
+<server core.martinjlogan.com>
+ port = 443
+ docroot = /tmp
+ listen = 0.0.0.0
+ dir_listings = true
+ <ssl>
+ keyfile = /usr/local/yaws/etc/yaws-key.pem
+ certfile = /usr/local/yaws/etc/yaws-cert.pem
+ </ssl>
+</server>
+
+
+
+
+
+
+
+
diff --git a/lib/erl/tools/.appgen/rename.sh b/lib/erl/tools/.appgen/rename.sh
new file mode 100755
index 0000000..6f077c2
--- /dev/null
+++ b/lib/erl/tools/.appgen/rename.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+if [ $# -eq 3 ]; then
+ OLD_PREFIX=$1
+ NEW_PREFIX=$2
+ FILENAME=$3
+ NEW_FILENAME=$(echo $FILENAME | sed -e "s/$OLD_PREFIX/$NEW_PREFIX/")
+ echo "moving $FILENAME to $NEW_FILENAME"
+ mv $FILENAME $NEW_FILENAME
+ exit 0;
+fi
+
+
+if [ $# -eq 2 ]; then
+ while read line;
+ do
+ OLD_PREFIX=$1
+ NEW_PREFIX=$2
+ NEW_FILENAME=$(echo ${line} | sed -e "s/$OLD_PREFIX/$NEW_PREFIX/")
+ echo "moving ${line} to $NEW_FILENAME"
+ mv ${line} $NEW_FILENAME
+ done
+ exit 0
+fi
+
diff --git a/lib/erl/tools/.appgen/substitute.sh b/lib/erl/tools/.appgen/substitute.sh
new file mode 100755
index 0000000..5305b75
--- /dev/null
+++ b/lib/erl/tools/.appgen/substitute.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+
+if [ $# -lt 2 ]; then
+ echo "usage: substitute.sh <variable to replace> <value to replace with> <filename | STDIN>"
+ exit 1
+fi
+
+if [ $# -eq 3 ]; then
+ VARIABLE=$1
+ VALUE=$2
+ FILENAME=$3
+
+ echo "replacing $VARIABLE with $VALUE in $FILENAME"
+ sed -e "s/$VARIABLE/$VALUE/" $FILENAME > "$FILENAME"_tmp
+ mv "$FILENAME"_tmp $FILENAME
+ exit 0
+fi
+
+if [ $# -eq 2 ]; then
+ while read line;
+ do
+ VARIABLE=$1
+ VALUE=$2
+ FILENAME=${line}
+
+ echo "replacing $VARIABLE with $VALUE in $FILENAME"
+ sed -e "s/$VARIABLE/$VALUE/" $FILENAME > "$FILENAME"_tmp
+ mv "$FILENAME"_tmp $FILENAME
+ done
+ exit 0
+fi
+
diff --git a/lib/erl/tools/.appgen/thrift_rel/Makefile b/lib/erl/tools/.appgen/thrift_rel/Makefile
new file mode 100755
index 0000000..5d35956
--- /dev/null
+++ b/lib/erl/tools/.appgen/thrift_rel/Makefile
@@ -0,0 +1,298 @@
+# ----------------------------------------------------
+# Make file for creating an otp release.
+# ----------------------------------------------------
+
+##
+# Basename of this release.
+##
+RELS=$(shell basename `pwd`)
+APP_NAME=$(shell echo $(RELS) | sed s/_rel$$//)
+
+include ../../build/otp.mk
+
+include ./vsn.mk
+
+#include $(ERL_TOP)/make/target.mk
+#include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+USR_LIBPATH=../../lib
+INSTALL_DIR=/usr/local/lib
+ABS_USER_LIBPATH=$(shell cd ../../lib;pwd)
+
+# ----------------------------------------------------
+# CREATE DIR STRUCTURE HERE
+# ----------------------------------------------------
+
+HTDOCS=$(wildcard $(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs/*.html) \
+ $(wildcard $(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs/*.htm) \
+ $(wildcard $(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs/*.yaws)
+BUILD_FILES=fs_boot_smithe.beam fs_lists.beam fs_lib.beam
+
+LOCAL_DIR=local
+#LOCAL_DIR=$(shell cat $(RELS).rel.src |grep -m 1 '$(APP_NAME)' |awk -F '"' '{printf "%s-%s", $$2,$$4}')
+
+DIR_STRUCTURE= \
+ $(LOCAL_DIR) \
+ $(LOCAL_DIR)/log/$(REL_VSN) \
+ $(LOCAL_DIR)/var/$(REL_VSN) \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/htdocs
+
+PRODUCTION_DIR_STRUCTURE= \
+ $(RELS) \
+ $(RELS)/release/$(REL_VSN) \
+ $(RELS)/stage \
+ $(RELS)/log/$(REL_VSN) \
+ $(RELS)/var/$(REL_VSN) \
+ $(RELS)/var/$(REL_VSN)/www \
+ $(RELS)/var/$(REL_VSN)/www/htdocs \
+ $(RELS)/var/$(REL_VSN)/www/conf
+
+# ----------------------------------------------------
+SCRIPT_AND_BOOT_FILES= \
+ $(RELS).script \
+ $(RELS).boot
+
+LOCAL_SCRIPT_AND_BOOT_FILES= \
+ $(LOCAL_DIR)/$(RELS).script \
+ $(LOCAL_DIR)/$(RELS).boot
+
+LOCAL_HTTP_CONF= \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/yaws.conf \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/mime.types
+
+PRODUCTION_HTTP_CONF= \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/yaws.conf \
+ $(LOCAL_DIR)/var/$(REL_VSN)/www/conf/mime.types
+
+LOCAL_TARGET_FILES=$(LOCAL_HTTP_CONF) $(LOCAL_DIR)/$(RELS).config $(LOCAL_SCRIPT_AND_BOOT_FILES)
+
+LOCAL_TARGETS=$(LOCAL_DIR)/$(RELS).sh vsnit $(LOCAL_TARGET_FILES)
+
+PRODUCTION_TARGETS=$(RELS)/build/$(REL_VSN) \
+ $(RELS)/lib \
+ $(RELS)/stage/$(RELS).rel.src \
+ $(RELS)/stage/$(RELS).config.src \
+ $(RELS)/stage/yaws.conf.src \
+ $(RELS)/stage/$(RELS).sh.src \
+ $(RELS)/var/$(REL_VSN)/www/htdocs \
+ $(RELS)/install.sh \
+ $(RELS)/release/$(REL_VSN)/clean_release
+
+# ----------------------------------------------------
+# TARGETS
+# ----------------------------------------------------
+
+all debug opt instr script: $(DIR_STRUCTURE) $(LOCAL_TARGETS) $(PRODUCTION_DIR_STRUCTURE) $(PRODUCTION_TARGETS)
+ @echo $(HTDOCS)
+
+install: stage
+
+tar: $(RELS)-$(LOCATION)-$(REL_VSN).tgz
+
+$(DIR_STRUCTURE):
+ mkdir -p $@
+
+$(PRODUCTION_DIR_STRUCTURE):
+ mkdir -p $@
+
+clean:
+ $(RM) $(REL_SCRIPTS) $(TARGET_FILES)
+ $(RM) -r $(LOCAL_DIR) $(PRODN_DIR)
+ $(RM) $(RELS).rel
+ $(RM) -r $(RELS)
+ $(RM) $(RELS)*.tgz
+ $(RM) $(RELS).rel.src.tmp
+ $(RM) $(SCRIPT_AND_BOOT_FILES)
+
+docs:
+
+# ----------------------------------------------------
+# TARGETS FOR LOCAL MODE
+# ----------------------------------------------------
+
+# startup script for local mode
+$(LOCAL_DIR)/$(RELS).sh:
+ @echo '#!/bin/sh' > $@
+ @echo "cd $(CURDIR)/$(LOCAL_DIR)" >> $@
+ @echo "erl -name $${USER}_$(RELS) -boot $(RELS) -config $(RELS).config \$$@" >> $@
+ chmod +x $@
+ @echo
+ @echo "==== Start local node with \"sh $@\" ===="
+ @echo
+
+# Create the config file for local mode.
+$(LOCAL_DIR)/$(RELS).config: $(RELS).config.src
+ sed -e 's;%LOG_OTP%;$(CURDIR)/$(LOCAL_DIR)/log/$(REL_VSN);' \
+ -e 's;%VAR_OTP%;$(CURDIR)/$(LOCAL_DIR)/var/$(REL_VSN);' \
+ -e 's;%RELS%;$(RELS);g' \
+ -e 's;%HOME%;$(HOME);g' \
+ -e 's;%BROADCAST_ADDRESS%;$(BROADCAST_ADDRESS);g' \
+ -e 's;%CONTACT_NODE%;$(CONTACT_NODE);g' \
+ -e "s;%HOSTNAME%;`hostname --long`;" \
+ -e 's;%APP_NAME%;$(APP_NAME);' \
+ -e 's;%APP_VERSION%;$(APP_VERSION);g' \
+ $< > $@
+
+# Create the httpd conf file for local mode.
+$(LOCAL_DIR)/var/$(REL_VSN)/www/conf/yaws.conf: yaws.conf.src
+ sed -e 's;%VAR_OTP%;$(CURDIR)/$(LOCAL_DIR)/var/$(REL_VSN);' \
+ -e 's;%LOG_OTP%;$(CURDIR)/$(LOCAL_DIR)/log/$(REL_VSN);' \
+ -e 's;%HTDOC_ROOT%;$(ABS_USER_LIBPATH)/$(APP_NAME)/htdocs;' \
+ -e 's;%APP_NAME%;$(APP_NAME);' \
+ -e 's;%RELS%;$(RELS);' \
+ -e 's;%USER%;$(USER);' \
+ -e 's;%HTDOC_ROOT%;$(ABS_USER_LIBPATH);' \
+ -e 's;%MHOST%;$(MHOST);' \
+ $< > $@
+
+# Create the config file for local mode.
+vsnit: $(RELS).rel.src
+ sed -e 's;%REL_VSN%;$(REL_VSN);' \
+ $< > $<.tmp
+
+# Create and position script and boot files for local mode.
+$(LOCAL_SCRIPT_AND_BOOT_FILES):
+ @ erl -pz $(USR_LIBPATH)/fslib/ebin \
+ -noshell \
+ -s fs_lib s_apply fs_boot_smithe make_script_and_boot "[\"$(ERL_RUN_TOP)/*\", \"$(USR_LIBPATH)\"]. " \
+ \"$$(basename `pwd`)".rel.src.tmp\". " \
+ "[local]. " \
+ -s init stop
+ cp $(SCRIPT_AND_BOOT_FILES) $(LOCAL_DIR)/
+
+$(LOCAL_DIR)/var/$(REL_VSN)/www/conf/mime.types: ../../build/mime.types
+ cp $< $@
+
+# ----------------------------------------------------
+# TARGETS FOR PRODUCTION MODE
+# ----------------------------------------------------
+$(RELS)/lib:
+ # For some reason this will not happen if added to PRODUCTION_DIR_STRUCTURE
+ mkdir $@
+ @ erl -pz $(RELS)/build/$(REL_VSN) \
+ -noshell \
+ -s fs_lib s_apply fs_boot_smithe stage_from_relsrc "[\"$(USR_LIBPATH)\"]. " \
+ \"$$(basename `pwd`)".rel.src\". " \
+ \"$@\"". " \
+ -s init stop
+
+# Move the htdocs from the local apps to the production htdoc root directory.
+$(RELS)/var/$(REL_VSN)/www/htdocs/: $(HTDOCS)
+ @mkdir -p $(RELS)/var/$(REL_VSN)/www/htdocs; \
+ for x in $(HTDOCS);do \
+ cp $$x $@; \
+ done
+
+# startup script for production mode
+$(RELS)/stage/$(RELS).sh.src:
+ @echo '#!/bin/sh' > $@
+ @echo "cd %INSTALL_DIR%/$(RELS)/release/$(REL_VSN)" >> $@
+ @echo "erl -name $(RELS) -boot $(RELS) -config $(RELS).config -detached \$$@" >> $@
+ chmod +x $@
+
+$(RELS)/build/$(REL_VSN): $(USR_LIBPATH)/fslib/ebin
+ mkdir -p $(RELS)/build/$(REL_VSN)
+ cp $</fs_boot_smithe.beam $@
+ cp $</fs_lib.beam $@
+ cp $</fs_lists.beam $@
+
+$(RELS)/stage/$(RELS).rel.src: $(RELS).rel.src.tmp
+ cp $< $@
+
+$(RELS)/stage/$(RELS).config.src: $(RELS).config.src
+ cp $< $@
+
+$(RELS)/stage/yaws.conf.src: yaws.conf.src
+ cp $< $@
+
+$(RELS)/install.sh:
+ @echo '#!/bin/sh' > $@
+ @echo "" >> $@
+ @echo "if [ \$$# -eq 1 ];then" >> $@
+ @echo " INSTALL_DIR=\$$1;" >> $@
+ @echo "else" >> $@
+ @echo " INSTALL_DIR=$(INSTALL_DIR);" >> $@
+ @echo "fi" >> $@
+ @echo "" >> $@
+ @echo "function munge() {" >> $@
+ @echo " sed -e \"s;%LOG_OTP%;\$$INSTALL_DIR/$(RELS)/log/$(REL_VSN);g\" \\" >> $@
+ @echo " -e \"s;%VAR_OTP%;\$$INSTALL_DIR/$(RELS)/var/$(REL_VSN);g\" \\" >> $@
+ @echo " -e \"s;%RELS%;$(RELS);g\" \\" >> $@
+ @echo " -e \"s;%REL_VSN%;$(REL_VSN);g\" \\" >> $@
+ @echo " -e \"s;%USER%;$$USER;g\" \\" >> $@
+ @echo " -e \"s;%HTDOC_ROOT%;\$$INSTALL_DIR/$(RELS)/var/$(REL_VSN)/www/htdocs;g\" \\" >> $@
+ @echo " -e \"s;%MHOST%;\`hostname\`;g\" \\" >> $@
+ @echo " -e \"s;%BROADCAST_ADDRESS%;$(BROADCAST_ADDRESS);g\" \\" >> $@
+ @echo " -e \"s;%INSTALL_DIR%;\$$INSTALL_DIR;g\" \\" >> $@
+ @echo " -e \"s;%CONTACT_NODE%;$(CONTACT_NODE);g\" \\" >> $@
+ @echo " -e \"s;%HOSTNAME%;\`hostname --long\`;g\" \\" >> $@
+ @echo " -e \"s;%APP_NAME%;$(APP_NAME);g\" \\" >> $@
+ @echo " -e \"s;%APP_VERSION%;$(APP_VERSION);g\" \\" >> $@
+ @echo ' $$1 > $$2' >> $@
+ @echo "}" >> $@
+ @echo "" >> $@
+ @echo "munge stage/yaws.conf.src var/$(REL_VSN)/www/conf/yaws.conf;" >> $@
+ @echo "munge stage/$(RELS).config.src release/$(REL_VSN)/$(RELS).config;" >> $@
+ @echo "munge stage/$(RELS).sh.src release/$(REL_VSN)/$(RELS).sh;" >> $@
+ @echo "munge stage/$(RELS).rel.src release/$(REL_VSN)/$(RELS).rel;" >> $@
+ @echo "chmod +x release/$(REL_VSN)/$(RELS).sh;" >> $@
+ @echo "" >> $@
+ @echo "cd ..;" >> $@
+ @echo "find $(RELS) | cpio -o > \$$INSTALL_DIR/$(RELS).cpio;" >> $@
+ @echo "cd -;" >> $@
+ @echo "cd \$$INSTALL_DIR; " >> $@
+ @echo "echo -n \"Unpacked: \"" >> $@
+ @echo "cpio -uid < $(RELS).cpio;" >> $@
+ @echo "rm $(RELS).cpio;" >> $@
+ @echo "" >> $@
+ @echo "echo \"pwd is \`pwd\`\";" >> $@
+ @echo "cd $(RELS);" >> $@
+ @echo " erl -pz build/$(REL_VSN) \\" >> $@
+ @echo " -noshell \\" >> $@
+ @echo -n " -s fs_lib s_apply fs_boot_smithe make_script_and_boot \"[\\\"$(ERL_RUN_TOP)/*\\\", \\\"lib/\\\"]. \" " >> $@
+ @echo -n "\"\\\"stage/$$(basename `pwd`).rel.src\\\". \" " >> $@
+ @echo -n "\"[local]. \" " >> $@
+ @echo "-s init stop | egrep '*terminate*|ERROR'" >> $@
+ @echo "if [ \$$? -eq 0 ]; then" >> $@
+ @echo "echo \"============================================\";" >> $@
+ @echo "echo \"STAGE FAILURE \$$? - Silence the discord.\";" >> $@
+ @echo "echo \"============================================\";" >> $@
+ @echo "exit 1;" >> $@
+ @echo "fi" >> $@
+ @echo "" >> $@
+ @echo "mv $(RELS).rel $(RELS).script $(RELS).boot release/$(REL_VSN);" >> $@
+ @echo "" >> $@
+ @echo "rm -r stage;" >> $@
+ @echo "rm -r build;" >> $@
+ @echo "cd -;" >> $@
+ @echo "" >> $@
+ @echo "chgrp -R erts $(RELS); " >> $@
+ @echo "chmod -R 775 $(RELS); " >> $@
+ @echo "cd -" >> $@
+ @echo "" >> $@
+ @echo "rm -f /usr/local/bin/$(APP_NAME);" >> $@
+ @echo "ln -s \$$INSTALL_DIR/$(RELS)/release/$(REL_VSN)/$(RELS).sh /usr/local/bin/$(APP_NAME);" >> $@
+ @echo "chgrp -R erts /usr/local/bin/$(APP_NAME); " >> $@
+ @echo "chmod -R 775 /usr/local/bin/$(APP_NAME); " >> $@
+ @echo "rm \$$INSTALL_DIR/$(RELS)/install.sh;" >> $@
+ @echo "echo -n $$'\e[0;32m'" >> $@
+ @echo "echo \"$(APP_NAME) installation to \$$INSTALL_DIR complete.\"" >> $@
+ @echo "echo -n $$'\e[0m'" >> $@
+ chmod +x $@
+
+
+stage: $(RELS)
+ cd $(RELS); \
+ ./install.sh; \
+ cd -
+
+$(RELS)/var/$(REL_VSN)/www/conf/mime.types: ../../build/mime.types
+ cp $< $@
+
+$(RELS)-$(LOCATION)-$(REL_VSN).tgz: $(RELS)
+ tar -zcvf $@ $<
+
+$(RELS)/release/$(REL_VSN)/clean_release: ../../tools/utilities/clean_release
+ cp $< $@
+
diff --git a/lib/erl/tools/.appgen/thrift_rel/thrift_rel.config.src b/lib/erl/tools/.appgen/thrift_rel/thrift_rel.config.src
new file mode 100755
index 0000000..c701c5a
--- /dev/null
+++ b/lib/erl/tools/.appgen/thrift_rel/thrift_rel.config.src
@@ -0,0 +1,26 @@
+%%% -*- mode:erlang -*-
+%%% Parameter settings for apps on %APP_NAME%
+%%% Warning - this config file *must* end with <dot><whitespace>
+
+%% write log files to sasl_dir
+[
+ {sasl,
+ [
+ {sasl_error_logger, {file, "%LOG_OTP%/sasl_log"}}
+ ]},
+
+
+ {gas,
+ [
+ {mod_specs, [{elwrap, {fs_elwrap_h, start_link}}]},
+
+ % elwrap config.
+ {err_log, "%LOG_OTP%/err_log"},
+ {err_log_wrap_info, {{err,5000000,10},{sasl,5000000,10}}},
+ {err_log_tty, true} % Log to the screen
+ ]},
+
+ {%APP_NAME%,
+ [
+ ]}
+].
diff --git a/lib/erl/tools/.appgen/thrift_rel/thrift_rel.rel.src b/lib/erl/tools/.appgen/thrift_rel/thrift_rel.rel.src
new file mode 100644
index 0000000..a11d240
--- /dev/null
+++ b/lib/erl/tools/.appgen/thrift_rel/thrift_rel.rel.src
@@ -0,0 +1,14 @@
+%%% -*- mode:erlang -*-
+{release,
+ {"thrift_rel", "%REL_VSN%"},
+ erts,
+ [
+ kernel,
+ stdlib,
+ sasl,
+ fslib,
+ gas,
+ thrift
+ ]
+}.
+
diff --git a/lib/erl/tools/.appgen/thrift_rel/vsn.mk b/lib/erl/tools/.appgen/thrift_rel/vsn.mk
new file mode 100755
index 0000000..0ac8e07
--- /dev/null
+++ b/lib/erl/tools/.appgen/thrift_rel/vsn.mk
@@ -0,0 +1 @@
+REL_VSN=1.0
diff --git a/lib/erl/tools/.appgen/thrift_rel/yaws.conf.src b/lib/erl/tools/.appgen/thrift_rel/yaws.conf.src
new file mode 100644
index 0000000..8857aac
--- /dev/null
+++ b/lib/erl/tools/.appgen/thrift_rel/yaws.conf.src
@@ -0,0 +1,166 @@
+
+# conf for yaws
+
+
+# first we have a set of globals
+# That apply to all virtual servers
+
+
+# This is the directory where all logfiles for
+# all virtual servers will be written
+
+logdir = /var/log/yaws
+
+# This the path to a directory where additional
+# beam code can be placed. The daemon will add this
+# directory to its search path
+
+ebin_dir = /var/yaws/ebin
+
+
+# This is a directory where application specific .hrl
+# files can be placed. application specifig .yaws code can
+# then include these .hrl files
+
+include_dir = /var/yaws/include
+
+
+
+
+
+# This is a debug variable, possible values are http | traffic | false
+# It is also possible to set the trace (possibly to the tty) while
+# invoking yaws from the shell as in
+# yaws -i -T -x (see man yaws)
+
+trace = false
+
+
+
+
+
+# it is possible to have yaws start additional
+# application specific code at startup
+#
+# runmod = mymodule
+
+
+# By default yaws will copy the erlang error_log and
+# end write it to a wrap log called report.log (in the logdir)
+# this feature can be turned off. This would typically
+# be the case when yaws runs within another larger app
+
+copy_error_log = true
+
+
+# Logs are wrap logs
+
+log_wrap_size = 1000000
+
+
+# Possibly resolve all hostnames in logfiles so webalizer
+# can produce the nice geography piechart
+
+log_resolve_hostname = false
+
+
+
+# fail completely or not if yaws fails
+# to bind a listen socket
+fail_on_bind_err = true
+
+
+
+# If yaws is started as root, it can, once it has opened
+# all relevant sockets for listening, change the uid to a
+# user with lower accessrights than root
+
+# username = nobody
+
+
+# If HTTP auth is used, it is possible to have a specific
+# auth log.
+
+auth_log = true
+
+
+# When we're running multiple yaws systems on the same
+# host, we need to give each yaws system an individual
+# name. Yaws will write a number of runtime files under
+# /tmp/yaws/${id}
+# The default value is "default"
+
+
+# id = myname
+
+
+# earlier versions of Yaws picked the first virtual host
+# in a list of hosts with the same IP/PORT when the Host:
+# header doesn't match any name on any Host
+# This is often nice in testing environments but not
+# acceptable in real live hosting scenarios
+
+pick_first_virthost_on_nomatch = true
+
+
+# All unices are broken since it's not possible to bind to
+# a privileged port (< 1024) unless uid==0
+# There is a contrib in jungerl which makes it possible by means
+# of an external setuid root programm called fdsrv to listen to
+# to privileged port.
+# If we use this feature, it requires fdsrv to be properly installed.
+# Doesn't yet work with SSL.
+
+use_fdsrv = false
+
+
+
+
+# end then a set of virtual servers
+# First two virthosted servers on the same IP (0.0.0.0)
+# in this case, but an explicit IP can be given as well
+
+<server core.martinjlogan.com>
+ port = 80
+ listen = 0.0.0.0
+ docroot = /var/yaws/www
+ arg_rewrite_mod = pwr_arg_rewrite_mod
+ appmods = <pwr, pwr_main_controller_appmod>
+</server>
+
+<server localhost>
+ port = 80
+ listen = 0.0.0.0
+ docroot = /tmp
+ dir_listings = true
+ dav = true
+ <auth>
+ realm = foobar
+ dir = /
+ user = foo:bar
+ user = baz:bar
+ </auth>
+</server>
+
+
+
+# And then an ssl server
+
+<server core.martinjlogan.com>
+ port = 443
+ docroot = /tmp
+ listen = 0.0.0.0
+ dir_listings = true
+ <ssl>
+ keyfile = /usr/local/yaws/etc/yaws-key.pem
+ certfile = /usr/local/yaws/etc/yaws-cert.pem
+ </ssl>
+</server>
+
+
+
+
+
+
+
+