Permalink
Browse files

major source reorganisation to ease debian packaging

SVN Revision: 210
  • Loading branch information...
nniclausse committed Feb 11, 2004
1 parent 17674d3 commit 748e9e0313a0a1dd4c0977695f691c1ae7954cfe
Showing with 2,183 additions and 691 deletions.
  1. +221 −81 Makefile
  2. +7 −2 README
  3. +12 −0 doc/Makefile
  4. +92 −0 doc/idx-tsunami.1.sgml
  5. +0 −84 idx-tsunami.sh
  6. +114 −0 idx-tsunami.sh.in
  7. +4 −4 idx-tsunami.xml
  8. +1 −1 include/ts_http.hrl
  9. +1,646 −0 priv/builder.erl
  10. +0 −347 src/idx-tsunami.pl.src
  11. +0 −41 src/make_boot.erl
  12. +0 −5 src/tsunami.rel.src
  13. 0 src/{ → tsunami}/ts_client.erl
  14. +9 −1 src/{ → tsunami}/ts_client_rcv.erl
  15. 0 src/{ → tsunami}/ts_client_sup.erl
  16. +0 −3 src/{ → tsunami}/ts_http.erl
  17. +10 −14 src/{ → tsunami}/ts_http_common.erl
  18. 0 src/{ → tsunami}/ts_jabber.erl
  19. 0 src/{ → tsunami}/ts_jabber_common.erl
  20. +9 −1 src/{ → tsunami}/ts_launcher.erl
  21. 0 src/{ → tsunami}/ts_session_cache.erl
  22. 0 src/{ → tsunami}/ts_stats.erl
  23. 0 src/{ → tsunami}/ts_sup.erl
  24. +1 −6 src/{ → tsunami}/ts_utils.erl
  25. +1 −1 src/{ → tsunami}/tsunami.app.src
  26. +3 −1 src/{ → tsunami}/tsunami.erl
  27. +5 −0 src/tsunami/tsunami.rel.src
  28. +0 −53 src/tsunami_client.erl
  29. +0 −6 src/tsunami_controller.rel.src
  30. +5 −1 src/{ → tsunami_controller}/ts_config.erl
  31. +6 −4 src/{ → tsunami_controller}/ts_config_server.erl
  32. 0 src/{ → tsunami_controller}/ts_controller_sup.erl
  33. +10 −1 src/{ → tsunami_controller}/ts_mon.erl
  34. 0 src/{ → tsunami_controller}/ts_msg_server.erl
  35. 0 src/{ → tsunami_controller}/ts_os_mon.erl
  36. +10 −3 src/{ → tsunami_controller}/ts_timer.erl
  37. +0 −15 src/{ → tsunami_controller}/ts_user_server.erl
  38. +2 −2 src/{ → tsunami_controller}/tsunami_controller.app.src
  39. 0 src/{ → tsunami_controller}/tsunami_controller.erl
  40. +5 −0 src/tsunami_controller/tsunami_controller.rel.src
  41. +0 −7 src/tsunami_recorder.rel.src
  42. 0 src/{ → tsunami_recorder}/ts_client_proxy.erl
  43. 0 src/{ → tsunami_recorder}/ts_client_proxy_sup.erl
  44. 0 src/{ → tsunami_recorder}/ts_proxy_listener.erl
  45. +3 −3 src/{ → tsunami_recorder}/ts_proxy_recorder.erl
  46. 0 src/{ → tsunami_recorder}/ts_recorder_sup.erl
  47. +2 −3 src/{ → tsunami_recorder}/tsunami_recorder.app.src
  48. 0 src/{ → tsunami_recorder}/tsunami_recorder.erl
  49. +4 −0 src/tsunami_recorder/tsunami_recorder.rel.src
  50. +1 −1 vsn.mk
View
302 Makefile
@@ -1,96 +1,236 @@
-# $Id$
-
+# Build the .beam erlang VM files
include vsn.mk
-VSN = $(IDX-TSUNAMI_VSN)
-TSUNAMIPATH = .
-TARDIR = idx-tsunami-$(VSN)
-PA = -pa ./ebin -pa ./src -pa . -pa ./system -pa ../ebin -pa .. -pa ../system -pa ../src
-
-prefix = /usr/local/idx-tsunami
# export ERLC_EMULATOR to fix a bug in R9B with native compilation
ERLC_EMULATOR=/usr/bin/erl
export ERLC_EMULATOR
ERL_COMPILER_OPTIONS="[warn_unused_vars]"
export ERL_COMPILER_OPTIONS
-## for debugging
-#OPTIONS:=+debug_info -DDEBUG
-## To enable HIPE
-#OPTIONS:=+native +\{hipe,\[o3\]\}
-## To export all functions
-#OPTIONS:=+export_all
-OPTIONS:=
+
+#OPT =+debug_info -DDEBUG
+OPT =
INC = ./include
-ERLC = erlc $(OPTIONS) -I $(INC)
-OUTDIR = ebin
-ALLERLS:= $(wildcard src/*.erl)
-ALLBEAMS:=$(patsubst src/%.erl,$(OUTDIR)/%.beam, $(ALLERLS))
-
-all: tsunami.boot tsunami_controller.boot tsunami_recorder.boot
-
-show:
- @echo "sources: $(ALLERLS)"
- @echo "beam: $(ALLBEAMS)"
-
-tarball:
- mkdir -p $(TARDIR)
- tar zcf tmp.tgz src/*.erl src/*.src include/*.hrl doc/*.txt doc/*.fig doc/*.png LISEZMOI README CONTRIBUTORS COPYING idx-tsunami.sh idx-tsunami.xml TODO Makefile vsn.mk src/analyse_msg.pl.src FAQ CHANGES
- tar -C $(TARDIR) -zxf tmp.tgz
- mkdir $(TARDIR)/ebin
- tar zvcf idx-tsunami-$(VSN).tar.gz $(TARDIR)
- rm -fr $(TARDIR)
+CC = erlc
+ERL = erl
+SED = $(shell which sed)
+
+ESRC = ./src
+EBIN = ./ebin
+
+VERSION = $(IDX-TSUNAMI_VSN)
+
+# installation path
+RAW_INSTALL_DIR = /usr/lib/erlang
+# $DESTDIR is used to build the debian package
+ERLANG_INSTALL_DIR = $(DESTDIR)/$(RAW_INSTALL_DIR)/lib
+BINDIR = $(DESTDIR)/usr/bin
+LIBDIR = $(DESTDIR)/usr/lib/idx-tsunami/bin/
+CONFDIR = $(DESTDIR)/usr/share/doc/idx-tsunami/examples
+
+
+PACKAGE = idx-tsunami
+APPLICATION = tsunami
+CONTROLLER_APPLICATION = tsunami_controller
+RECORDER_APPLICATION = tsunami_recorder
+
+RECORDER_TARGETDIR = $(ERLANG_INSTALL_DIR)/$(RECORDER_APPLICATION)-$(VERSION)
+CONTROLLER_TARGETDIR = $(ERLANG_INSTALL_DIR)/$(CONTROLLER_APPLICATION)-$(VERSION)
+TARGETDIR = $(ERLANG_INSTALL_DIR)/$(APPLICATION)-$(VERSION)
+
+TMP = $(wildcard *~) $(wildcard src/*~) $(wildcard inc/*~)
+INC_FILES = $(wildcard $(INC)/*.hrl)
+SRC = $(wildcard $(ESRC)/$(APPLICATION)/*.erl)
+CONTROLLER_SRC = $(wildcard $(ESRC)/$(CONTROLLER_APPLICATION)/*.erl)
+RECORDER_SRC = $(wildcard $(ESRC)/$(RECORDER_APPLICATION)/*.erl)
+CONFFILES = idx-tsunami.xml
+
+TARGET = $(addsuffix .beam, $(basename \
+ $(addprefix $(EBIN)/, $(notdir $(SRC)))))
+CONTROLLER_TARGET = $(addsuffix .beam, $(basename \
+ $(addprefix $(EBIN)/, $(notdir $(CONTROLLER_SRC)))))
+RECORDER_TARGET = $(addsuffix .beam, $(basename \
+ $(addprefix $(EBIN)/, $(notdir $(RECORDER_SRC)))))
+EMAKE = $(addsuffix \'., $(addprefix \'../, $(SRC)))
+
+SRC_APPFILES = $(ESRC)/$(APPLICATION)/$(APPLICATION).app.src $(ESRC)/$(APPLICATION)/$(APPLICATION).rel.src
+CONTROLLER_SRC_APPFILES = $(ESRC)/$(CONTROLLER_APPLICATION)/$(CONTROLLER_APPLICATION).app.src $(ESRC)/$(CONTROLLER_APPLICATION)/$(CONTROLLER_APPLICATION).rel.src
+RECORDER_SRC_APPFILES = $(ESRC)/$(RECORDER_APPLICATION)/$(RECORDER_APPLICATION).app.src $(ESRC)/$(RECORDER_APPLICATION)/$(RECORDER_APPLICATION).rel.src
+TGT_APPFILES_E = $(EBIN)/$(APPLICATION).app
+CONTROLLER_TGT_APPFILES_E = $(EBIN)/$(CONTROLLER_APPLICATION).app
+RECORDER_TGT_APPFILES_E = $(EBIN)/$(RECORDER_APPLICATION).app
+TGT_APPFILES_P = priv/$(APPLICATION)*
+RECORDER_TGT_APPFILES_P = priv/$(RECORDER_APPLICATION)*
+CONTROLLER_TGT_APPFILES_P = priv/$(CONTROLLER_APPLICATION)*
+
+SCRIPT = $(BINDIR)/idx-tsunami
+BUILD_OPTIONS = '[{systools, [{variables,[{"ROOT","$(RAW_INSTALL_DIR)"}]}]}, \
+ {sh_script, none}, {report, verbose}, \
+ {make_app, true }, {make_rel, true}].'
+BUILD_OPTIONS_FILE = ./BUILD_OPTIONS
+
+.PHONY: doc
+
+idx-tsunami: $(TARGET) $(RECORDER_TARGET) $(CONTROLLER_TARGET)
+
+all: clean idx-tsunami
+
+# used to generate the erlang Emakefile
+emake:
+ @echo $(EMAKE) | tr -s ' ' '\n' > ebin/Emakefile
+
+clean:
+ -cd priv && rm -f $(shell ls priv | grep -v builder\.erl) && cd ..
+ -rm -f $(TARGET) $(TMP) $(BUILD_OPTIONS_FILE) builder.beam
+ -rm -f $(TGT_APPFILES)
+ -rm -f ebin/*.beam
+# -make -C doc clean
+
+install: doc build idx-tsunami.sh analyse_msg.pl install_recorder install_controller
+ -rm -f $(TMP)
+
+ install -d $(TARGETDIR)/priv
+ install -d $(TARGETDIR)/ebin
+ install -d $(TARGETDIR)/src
+ install -d $(TARGETDIR)/include
+ install -d $(LIBDIR)/
+
+ cp $(INC_FILES) $(TARGETDIR)/include
+ cp $(TARGET) $(TARGETDIR)/ebin
+
+ cp $(TGT_APPFILES_E) $(TARGETDIR)/ebin
+ cp $(TGT_APPFILES_P) $(TARGETDIR)/priv
+
+ cp $(SRC) $(SRC_APPFILES) $(TARGETDIR)/src
+
+# install the man page
+ install -d $(DESTDIR)/usr/share/man/man1
+ install doc/idx-tsunami.1 $(DESTDIR)/usr/share/man/man1
+
+# create startup script
+ cp idx-tsunami.sh $(SCRIPT)
+ install analyse_msg.pl $(LIBDIR)/analyse_msg.pl
+ chmod +x $(SCRIPT)
+
+#
+ mkdir -p $(CONFDIR)
+ cp $(CONFFILES) $(CONFDIR)
+
+install_recorder:
+ install -d $(RECORDER_TARGETDIR)/priv
+ install -d $(RECORDER_TARGETDIR)/ebin
+ install -d $(RECORDER_TARGETDIR)/src
+ install -d $(RECORDER_TARGETDIR)/include
+
+ cp $(INC_FILES) $(RECORDER_TARGETDIR)/include
+ cp $(RECORDER_TARGET) $(RECORDER_TARGETDIR)/ebin
+
+ cp $(RECORDER_TGT_APPFILES_E) $(RECORDER_TARGETDIR)/ebin
+ cp $(RECORDER_TGT_APPFILES_P) $(RECORDER_TARGETDIR)/priv
+
+ cp $(RECORDER_SRC) $(RECORDER_SRC_APPFILES) $(RECORDER_TARGETDIR)/src
+
+install_controller:
+ install -d $(CONTROLLER_TARGETDIR)/priv
+ install -d $(CONTROLLER_TARGETDIR)/ebin
+ install -d $(CONTROLLER_TARGETDIR)/src
+ install -d $(CONTROLLER_TARGETDIR)/include
+ cp $(INC_FILES) $(CONTROLLER_TARGETDIR)/include
+ cp $(CONTROLLER_TARGET) $(CONTROLLER_TARGETDIR)/ebin
+
+ cp $(CONTROLLER_TGT_APPFILES_E) $(CONTROLLER_TARGETDIR)/ebin
+ cp $(CONTROLLER_TGT_APPFILES_P) $(CONTROLLER_TARGETDIR)/priv
+
+ cp $(CONTROLLER_SRC) $(CONTROLLER_SRC_APPFILES) $(CONTROLLER_TARGETDIR)/src
+
+uninstall:
+ rm -rf $(TARGETDIR) $(SCRIPT)
+
+build: idx-tsunami builder.beam build_controller build_recorder $(SRC_APPFILES)
+# use builder to make boot file
+ @rm -rf temp
+ @mkdir -p temp/$(APPLICATION)-$(VERSION)
+ @ln -sf `pwd`/ebin temp/$(APPLICATION)-$(VERSION)/ebin
+ @ln -sf `pwd`/src/$(APPLICATION) temp/$(APPLICATION)-$(VERSION)/src
+ @ln -sf `pwd`/include temp/$(APPLICATION)-$(VERSION)/include
+ @ln -sf `pwd`/priv temp/$(APPLICATION)-$(VERSION)/priv
+ @ln -sf `pwd`/builder.beam temp/$(APPLICATION)-$(VERSION)/
+ @ln -sf `pwd` temp/$(APPLICATION)-$(VERSION)
+ @(cd temp/$(APPLICATION)-$(VERSION) \
+ && echo $(BUILD_OPTIONS) > $(BUILD_OPTIONS_FILE) \
+ && erl -s builder go -s init stop \
+ )
+ @rm -rf temp
+
+build_controller: builder.beam $(CONTROLLER_SRC_APPFILES)
+# use builder to make boot file
+ @rm -rf temp
+ @mkdir -p temp/$(CONTROLLER_APPLICATION)-$(VERSION)
+ @ln -sf `pwd`/ebin temp/$(CONTROLLER_APPLICATION)-$(VERSION)/ebin
+ @ln -sf `pwd`/src/$(CONTROLLER_APPLICATION) temp/$(CONTROLLER_APPLICATION)-$(VERSION)/src
+ @ln -sf `pwd`/include temp/$(CONTROLLER_APPLICATION)-$(VERSION)/include
+ @ln -sf `pwd`/priv temp/$(CONTROLLER_APPLICATION)-$(VERSION)/priv
+ @ln -sf `pwd`/builder.beam temp/$(CONTROLLER_APPLICATION)-$(VERSION)/
+ @(cd temp/$(CONTROLLER_APPLICATION)-$(VERSION) \
+ && echo $(BUILD_OPTIONS) > $(BUILD_OPTIONS_FILE) \
+ && erl -s builder go -s init stop \
+ )
+ @rm -rf temp
+
+build_recorder: builder.beam $(RECORDER_SRC_APPFILES)
+# use builder to make boot file
+ @rm -rf temp
+ @mkdir -p temp/$(RECORDER_APPLICATION)-$(VERSION)
+ @ln -sf `pwd`/ebin temp/$(RECORDER_APPLICATION)-$(VERSION)/ebin
+ @ln -sf `pwd`/src/$(RECORDER_APPLICATION) temp/$(RECORDER_APPLICATION)-$(VERSION)/src
+ @ln -sf `pwd`/include temp/$(RECORDER_APPLICATION)-$(VERSION)/include
+ @ln -sf `pwd`/priv temp/$(RECORDER_APPLICATION)-$(VERSION)/priv
+ @ln -sf `pwd`/builder.beam temp/$(RECORDER_APPLICATION)-$(VERSION)/
+ @(cd temp/$(RECORDER_APPLICATION)-$(VERSION) \
+ && echo $(BUILD_OPTIONS) > $(BUILD_OPTIONS_FILE) \
+ && erl -s builder go -s init stop \
+ )
+ @rm -rf temp
+
+doc:
+ make -C doc
+
+release:
+ rm -fr $(PACKAGE)-$(VERSION)
+ mkdir -p $(PACKAGE)-$(VERSION)
+ tar zcf tmp.tgz $(SRC) $(SRC_APPFILES) $(INC_FILES) \
+ $(CONTROLLER_SRC) $(CONTROLLER_SRC_APPFILES) \
+ $(RECORDER_SRC) $(RECORDER_SRC_APPFILES) \
+ doc/*.txt doc/*.fig doc/*.png CONTRIBUTORS FAQ CHANGES \
+ COPYING README LISEZMOI TODO $(CONFFILES) Makefile \
+ priv/builder.erl idx-tsunami.sh.in vsn.mk idx-tsunami.xml
+ tar -C $(PACKAGE)-$(VERSION) -zxf tmp.tgz
+ mkdir $(PACKAGE)-$(VERSION)/ebin
+ tar zvcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
+ rm -fr $(PACKAGE)-$(VERSION)
rm -fr tmp.tgz
-clean:
- rm -f $(ALLBEAMS) tsunami.boot tsunami.script ebin/tsunami*.app ebin/tsunami*.rel ebin/analyse_msg.pl
-
-tsunami.boot: ebin $(ALLBEAMS) $(UTILS) src/tsunami.rel.src src/tsunami.app.src src/analyse_msg.pl.src Makefile
- sed -e 's@%VSN%@$(VSN)@;s@%prefix%@$(prefix)@' ./src/tsunami.app.src > ./ebin/tsunami.app
- sed -e 's;%VSN%;$(VSN);' ./src/tsunami.rel.src > ./ebin/tsunami.rel
- sed -e 's;%VSN%;$(VSN);' ./src/analyse_msg.pl.src > ./ebin/analyse_msg.pl
- erl -noshell $(PA) ./src -s make_boot make_boot tsunami
-
-tsunami_controller.boot: ebin $(ALLBEAMS) $(UTILS) src/tsunami_controller.rel.src src/tsunami_controller.app.src Makefile idx-tsunami.sh
- sed -e 's@%VSN%@$(VSN)@;s@%prefix%@$(prefix)@' ./src/tsunami_controller.app.src > ./ebin/tsunami_controller.app
- sed -e 's;%VSN%;$(VSN);' ./src/tsunami_controller.rel.src > ./ebin/tsunami_controller.rel
- erl -noshell $(PA) ./src -s make_boot make_boot tsunami_controller
- sed -e 's@%VSN%@$(VSN)@;s@%prefix%@$(prefix)@g' ./idx-tsunami.sh > ./ebin/idx-tsunami
-
-tsunami_recorder.boot: ebin $(ALLBEAMS) $(UTILS) src/tsunami_recorder.rel.src src/tsunami_recorder.app.src Makefile idx-tsunami.sh
- sed -e 's@%VSN%@$(VSN)@;s@%prefix%@$(prefix)@' ./src/tsunami_recorder.app.src > ./ebin/tsunami_recorder.app
- sed -e 's;%VSN%;$(VSN);' ./src/tsunami_recorder.rel.src > ./ebin/tsunami_recorder.rel
- erl -noshell $(PA) ./src -s make_boot make_boot tsunami_recorder
-
-ebin:
- mkdir ebin
-
-$(OUTDIR)/%.beam: ebin/%.erl
- $(ERLC) -o $(OUTDIR) $<
-
-$(OUTDIR)/%.beam: src/%.erl include/*.hrl
- $(ERLC) -o $(OUTDIR) $<
-
-install: tsunami.boot tsunami_controller.boot tsunami_recorder.boot
- mkdir -p $(prefix)
- mkdir -p $(prefix)/bin
- mkdir -p $(prefix)/log
- mkdir -p $(prefix)/etc
- mkdir -p $(prefix)/erlang/tsunami-$(VSN)/src
- install -m 0644 tsunami.boot $(prefix)/bin
- install -m 0644 tsunami_controller.boot $(prefix)/bin
- install -m 0644 tsunami_recorder.boot $(prefix)/bin
- install -m 0644 idx-tsunami.xml $(prefix)/etc/idx-tsunami_default.xml
- install ebin/analyse_msg.pl ${prefix}/bin
- install ebin/idx-tsunami ${prefix}/bin
- mkdir -p $(prefix)
- mkdir -p $(prefix)/erlang
- mkdir -p $(prefix)/erlang/tsunami-$(VSN)
- mkdir -p $(prefix)/erlang/tsunami-$(VSN)/ebin
- install $(ALLBEAMS) $(prefix)/erlang/tsunami-$(VSN)/ebin
- install ebin/*.app $(prefix)/erlang/tsunami-$(VSN)/ebin
- install src/*.erl $(prefix)/erlang/tsunami-$(VSN)/src
+builder.beam: priv/builder.erl
+ $(CC) $(OPT) -I $(INC) $<
+
+ebin/%.beam: src/$(APPLICATION)/%.erl
+ $(CC) $(OPT) -I $(INC) -o ebin $<
+
+ebin/%.beam: src/$(RECORDER_APPLICATION)/%.erl
+ $(CC) $(OPT) -I $(INC) -o ebin $<
+
+ebin/%.beam: src/$(CONTROLLER_APPLICATION)/%.erl
+ $(CC) $(OPT) -I $(INC) -o ebin $<
+
+analyse_msg.pl: src/analyse_msg.pl.src Makefile
+ $(SED) -e 's;%VERSION;$(VERSION);g' < $< > $@
+
+idx-tsunami.sh: idx-tsunami.sh.in Makefile
+ @$(SED) \
+ -e 's;%INSTALL_DIR%;${RAW_INSTALL_DIR};g' \
+ -e 's;CONFIG_DIR%;${CONFIG_DIR};g' \
+ -e 's;%VERSION%;${VERSION};g' < $< > $@
%:%.sh
# Override makefile default implicit rule
View
9 README
@@ -73,7 +73,11 @@
- Erlang/OTP R9C-0 (http://www.erlang.org/download.html)
- - xmerl-0.19 (http://sowap.sourceforge.net/download.html)
+ - xmerl-0.19 (http://sowap.sourceforge.net/download.html). A debian
+ binary package is provided in http://tsunami.idealx.org/dist/
+
+ xmerl-0.15 should work, but the notation <tag/> is not supported
+ by this version (use instead the full <tag></tag> notation)
- gnuplot and perl5 (optional; for graphical output with analyse_msg.pl script)
@@ -83,7 +87,8 @@
2.2. Compilation and Installation
Edit Makefile if you want to change the install path (prefix)
- (/usr/local/idx-tsunami by default)
+ (/usr/lib/erlang/... by default for beam files). Default
+ configuration and log files are saved in ~/.idx-tsunami/ )
Edit src/tsunami.rel.src and src/tsunami_controller.rel.src if your
Erlang version is not R9C-0 and set erts, kernel, ssl and stdlib
View
@@ -0,0 +1,12 @@
+# $Id$
+
+MANPAGE = idx-tsunami.1.sgml
+
+all: man
+
+man: $(MANPAGE)
+ docbook2man $< >/dev/null 2>&1
+
+clean:
+ -rm -f *~
+ -rm -f idx-tsunami.1 manpage.*
Oops, something went wrong.

0 comments on commit 748e9e0

Please sign in to comment.