Browse code

cleaned up and corrected the install system

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@153 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Stefan Sayer authored on 29/11/2006 18:12:14
Showing 34 changed files
... ...
@@ -32,7 +32,10 @@ modules:
32 32
 	done 
33 33
 
34 34
 .PHONY: install
35
-install:
35
+install: install-bin install-cfg
36
+
37
+.PHONY: install-bin
38
+install-bin:
36 39
 	-@for r in $(modules) "" ; do \
37 40
 		if [ -n "$$r" ]; then \
38 41
 			echo "" ; \
... ...
@@ -40,3 +43,13 @@ install:
40 40
 			COREPATH=../$(COREPATH) $(MAKE) -C $$r install; \
41 41
 		fi ; \
42 42
 	done
43
+
44
+.PHONY: install-cfg
45
+install-cfg: $(cfg-prefix)/$(cfg-dir)
46
+	-@for r in $(modules) "" ; do \
47
+		if [ -n "$$r" ]; then \
48
+			echo "" ; \
49
+			echo "" ; \
50
+			COREPATH=../$(COREPATH) $(MAKE) -C $$r install-cfg; \
51
+		fi ; \
52
+	done
... ...
@@ -3,5 +3,8 @@ plug_in_name = ann_b2b
3 3
 module_ldflags =
4 4
 module_cflags  = 
5 5
 
6
+extra_install = $(plug_in_name)_audio
7
+
6 8
 COREPATH ?=../../core
7 9
 include $(COREPATH)/plug-in/Makefile.app_module
10
+
... ...
@@ -1,2 +1,8 @@
1
-announce_path=wav/
1
+announce_path=/usr/local/lib/sems/audio/
2 2
 default_announce=default_en.wav
3
+
4
+# if you add custom announcement for 
5
+# ann_b2b module change path to 
6
+# announce_path=/usr/local/lib/sems/audio/ann_b2b
7
+#
8
+
... ...
@@ -3,5 +3,8 @@ plug_in_name = announce_auth
3 3
 module_ldflags =
4 4
 module_cflags  = 
5 5
 
6
+extra_install = $(plug_in_name)_audio
7
+
6 8
 COREPATH ?=../../core
7 9
 include $(COREPATH)/plug-in/Makefile.app_module
10
+
... ...
@@ -1,5 +1,5 @@
1 1
 #CFGOPTION_SEMS_ANNOUNCEPATH
2
-announce_path=wav/
2
+announce_path=/usr/local/lib/sems/audio/
3 3
 #ENDCFGOPTION
4 4
 
5 5
 #CFGOPTION_SEMS_ANNOUNCEMENT
... ...
@@ -3,5 +3,7 @@ plug_in_name = announce_transfer
3 3
 module_ldflags =
4 4
 module_cflags  = 
5 5
 
6
+extra_install = $(plug_in_name)_audio
7
+
6 8
 COREPATH ?=../../core
7 9
 include $(COREPATH)/plug-in/Makefile.app_module
... ...
@@ -1,5 +1,5 @@
1 1
 #CFGOPTION_SEMS_ANNOUNCEPATH
2
-announce_path=wav/
2
+announce_path=/usr/local/lib/sems/audio/
3 3
 #ENDCFGOPTION
4 4
 
5 5
 #CFGOPTION_SEMS_ANNOUNCEMENT
... ...
@@ -3,5 +3,7 @@ plug_in_name = announcement
3 3
 module_ldflags =
4 4
 module_cflags  = 
5 5
 
6
+extra_install = $(plug_in_name)_audio
7
+
6 8
 COREPATH ?=../../core
7 9
 include $(COREPATH)/plug-in/Makefile.app_module
... ...
@@ -1,5 +1,5 @@
1 1
 #CFGOPTION_SEMS_ANNOUNCEPATH
2
-announce_path=wav/
2
+announce_path=/usr/local/lib/sems/audio/
3 3
 #ENDCFGOPTION
4 4
 
5 5
 #CFGOPTION_SEMS_ANNOUNCEMENT
... ...
@@ -117,7 +117,7 @@ class IvrDialog(IvrDialogBase):
117 117
 		elif self.state == collect:
118 118
 			self.setTimer(HINT_TIMER,  HINT_TIMEOUT)
119 119
 
120
-	def onTimer(self, id):
120
+ 	def onTimer(self, id):
121 121
 		if id == HINT_TIMER and self.state == collect:
122 122
 			self.enqueue(self.hint_msg, None)
123 123
 		elif id == CONF_TIMER and self.state == connected:
... ...
@@ -3,5 +3,7 @@ plug_in_name = conference
3 3
 module_ldflags =
4 4
 module_cflags  = 
5 5
 
6
+extra_install = $(plug_in_name)_audio
7
+
6 8
 COREPATH ?=../../core
7 9
 include $(COREPATH)/plug-in/Makefile.app_module
... ...
@@ -1,4 +1,4 @@
1
-default_announce=wav/first_participant.wav
2
-join_sound=wav/beep.wav
3
-drop_sound=wav/beep.wav
1
+default_announce=/usr/local/lib/sems/audio/conference/first_participant.wav
2
+join_sound=/usr/local/lib/sems/audio/conference/beep.wav
3
+drop_sound=/usr/local/lib/sems/audio/conference/beep.wav
4 4
 dialout_suffix=@iptel.org
... ...
@@ -62,7 +62,7 @@ int EarlyAnnounceFactory::onLoad()
62 62
 
63 63
     string announce_file = AnnouncePath + AnnounceFile;
64 64
     if(!file_exists(announce_file)){
65
-	ERROR("default file for ann_b2b module does not exist ('%s').\n",
65
+	ERROR("default file for " MOD_NAME " module does not exist ('%s').\n",
66 66
 	      announce_file.c_str());
67 67
 	return -1;
68 68
     }
... ...
@@ -1,5 +1,5 @@
1 1
 #CFGOPTION_SEMS_ANNOUNCEPATH
2
-announce_path=wav/
2
+announce_path=/usr/local/lib/sems/audio/
3 3
 #ENDCFGOPTION
4 4
 
5 5
 #CFGOPTION_SEMS_ANNOUNCEMENT
... ...
@@ -44,6 +44,7 @@ module_cflags  = \
44 44
 
45 45
 extra_target  = python_files
46 46
 extra_install = install_python_files
47
+extra_clean = clean_python_files
47 48
 
48 49
 py_src = $(notdir $(wildcard py/*.py))
49 50
 py_obj = $(py_src:.py=.pyc)
... ...
@@ -57,6 +58,14 @@ python_files:
57 57
 
58 58
 endif
59 59
 
60
+ifeq (install,$(MAKECMDGOALS))
61
+.PHONY: python_files
62
+python_files: 
63
+	python$(PY_VER) py_comp -l -q py &&\
64
+	cp py/*.pyc $(COREPATH)/lib
65
+
66
+endif
67
+
60 68
 ifeq (module_package,$(MAKECMDGOALS))
61 69
 python_files:
62 70
 	python$(PY_VER) py_comp -l -q py
... ...
@@ -75,3 +84,7 @@ install_python_files: $(modules-prefix)/$(modules-dir)
75 75
 		fi ; \
76 76
 	done
77 77
 
78
+.PHONY: clean_python_files
79
+clean_python_files:
80
+	rm -f py/*.pyc
81
+	rm -f $(COREPATH)/lib/*.pyc
... ...
@@ -1,5 +1,6 @@
1 1
 # generic Makefile for ivr applications
2 2
 
3
+include ../../core/Makefile.defs
3 4
 include ../ivr/Makefile.defs
4 5
 
5 6
 # 
... ...
@@ -18,22 +19,37 @@ LIB_PERMISSIONS="644"
18 18
 PYCHECKERARGS = --stdlib
19 19
 PYCHECKERDOCARGS = --classdoc --funcdoc
20 20
 
21
+module_conf_files =  $(wildcard etc/*)
22
+
21 23
 .PHONY: all
22 24
 all: clean compile
23 25
 
26
+.PHONY: clean
24 27
 clean:
25 28
 	find . -iname "*\.pyc" -o -iname "*\.py~" | xargs rm -f
26 29
 	rm -f ${TARBALL_PREFIX}*.tar.gz
27 30
 
31
+.PHONY: compile
28 32
 compile: 
29 33
 	python${PYTHON_VERSION} ../ivr/py_comp -q .
30 34
 
35
+.PHONY: install
31 36
 install: all
32 37
 	install -d ${BASEDIR}/${LIB_INSTALLDIR}
33 38
 	install -m ${LIB_PERMISSIONS} -o ${OWNER} -g ${GROUP} *.pyc ${BASEDIR}/${LIB_INSTALLDIR}
34 39
 	install -d ${BASEDIR}/${LIB_INSTALLDIR}/${LIBDIR}
35 40
 	install -m ${LIB_PERMISSIONS} -o ${OWNER} -g ${GROUP} ${LIBDIR}/*.pyc ${BASEDIR}/${LIB_INSTALLDIR}/${LIBDIR}
36 41
 
42
+.PHONY: install-cfg
43
+install-cfg: 
44
+	mkdir -p $(cfg-prefix)/$(cfg-dir)etc
45
+	-@for r in $(module_conf_files); do \
46
+			echo installing $$r ;  \
47
+			$(INSTALL-TOUCH) $(cfg-prefix)/$(cfg-dir)$$r ; \
48
+			$(INSTALL-CFG) $$r $(cfg-prefix)/$(cfg-dir)$$r; \
49
+	done
50
+
51
+
37 52
 uninstall: 
38 53
 	@echo "please remove the files from ${LIB_INSTALLDIR} manually."
39 54
 
... ...
@@ -1 +1 @@
1
-script_path=/usr/lib/sems/ivr/
1
+script_path=/usr/local/lib/sems/ivr/
... ...
@@ -3,7 +3,7 @@ plug_in_name = mp3
3 3
 COREPATH ?=../../core
4 4
 LAME_DIR = ./lame-3.96.1
5 5
 
6
-module_extra_objs =  -lmp3lame 
6
+module_ldflags =  -lmp3lame 
7 7
 module_cflags  = -I/usr/include/lame
8 8
 
9 9
 # if you want to build lame from source use these 
... ...
@@ -3,7 +3,7 @@ plug_in_name = voicemail
3 3
 module_ldflags =
4 4
 module_cflags  = 
5 5
 
6
-extra_install = install_email_template
6
+extra_install = install_email_template $(plug_in_name)_audio
7 7
 
8 8
 vm_module:	all
9 9
 
... ...
@@ -11,7 +11,7 @@ vm_module:	all
11 11
 install_email_template: $(cfg-prefix)/$(cfg-dir)
12 12
 	mkdir -p $(cfg-prefix)/$(cfg-dir)
13 13
 	$(INSTALL-TOUCH) $(cfg-prefix)/$(cfg-dir)default.template.sample
14
-	$(INSTALL-BIN) default.template.sample $(cfg-prefix)/$(cfg-dir)
14
+	$(INSTALL-CFG) default.template.sample $(cfg-prefix)/$(cfg-dir)
15 15
 	if [ ! -f $(cfg-prefix)/$(cfg-dir)default.template ]; then \
16 16
 		cp -f $(cfg-prefix)/$(cfg-dir)default.template.sample \
17 17
 			$(cfg-prefix)/$(cfg-dir)default.template; \
... ...
@@ -1,5 +1,5 @@
1 1
 #CFGOPTION_SEMS_ANNOUNCEPATH
2
-announce_path=/usr/lib/sems/audio/voicemail/
2
+announce_path=/usr/local/lib/sems/audio/voicemail/
3 3
 #ENDCFGOPTION
4 4
 
5 5
 #CFGOPTION_SEMS_ANNOUNCEMENT
... ...
@@ -11,5 +11,5 @@ max_record_time=30
11 11
 #ENDCFGOPTION
12 12
 
13 13
 #CFGOPTION_SEMS_TEMPLATEDIR
14
-email_template_path=/usr/lib/sems/resources/
14
+email_template_path=/usr/local/etc/sems/
15 15
 #ENDCFGOPTION
... ...
@@ -68,8 +68,9 @@ install: all mk-install-dirs \
68 68
 	install-cfg \
69 69
 	install-bin \
70 70
 	install-modules \
71
-	install-doc
72
-	#install-audio \
71
+	install-doc \
72
+	install-modules-cfg \
73
+	install-audio \
73 74
 
74 75
 # note: on solaris 8 sed: ? or \(...\)* (a.s.o) do not work
75 76
 install-cfg: $(cfg-prefix)/$(cfg-dir)
... ...
@@ -87,10 +88,12 @@ install-bin: $(bin-prefix)/$(bin-dir)
87 87
 		$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)$(NAME)
88 88
 		$(INSTALL-BIN) $(NAME) $(bin-prefix)/$(bin-dir)
89 89
 
90
-install-modules: $(PLUGIN_DIR) $(modules-prefix)/$(modules-dir)audio \
91
-		 $(modules-prefix)/$(modules-dir)apps
90
+install-modules: $(PLUGIN_DIR) $(modules-prefix)/$(modules-dir)
92 91
 	$(MAKE) -C $(PLUGIN_DIR) install
93 92
 
93
+install-modules-cfg: $(PLUGIN_DIR) $(modules-prefix)/$(modules-dir)
94
+	$(MAKE) -C $(PLUGIN_DIR) install-cfg
95
+
94 96
 install-audio: $(audio-prefix)/$(audio-dir)
95 97
 	-@for f in $(AUDIO_FILES) ; do \
96 98
 		if [ -n "wav/$$f" ]; then \
... ...
@@ -56,6 +56,7 @@ audio-prefix = $(basedir)$(prefix)
56 56
 
57 57
 # dirs
58 58
 cfg-dir = etc/sems/
59
+
59 60
 bin-dir = sbin/
60 61
 modules-dir = lib/sems/plug-in/
61 62
 audio-dir = lib/sems/audio/
... ...
@@ -42,3 +42,13 @@ install:
42 42
 			$(MAKE) -C $$r install; \
43 43
 		fi ; \
44 44
 	done
45
+
46
+.PHONY: install-cfg
47
+install-cfg: $(cfg-prefix)/$(cfg-dir)
48
+	-@for r in $(modules) "" ; do \
49
+		if [ -n "$$r" ]; then \
50
+			echo "" ; \
51
+			echo "" ; \
52
+			COREPATH=../$(COREPATH) $(MAKE) -C $$r install-cfg; \
53
+		fi ; \
54
+	done
... ...
@@ -9,6 +9,9 @@ app_module_dir = $(COREPATH)/lib
9 9
 lib_name = $(plug_in_name).so
10 10
 lib_full_name = $(app_module_dir)/$(lib_name)
11 11
 
12
+module_conf_files =  $(wildcard etc/*.conf)
13
+AUDIO_FILES=$(notdir $(wildcard wav/*.wav))
14
+
12 15
 srcs     = $(wildcard *.cpp)
13 16
 hrds     = $(wildcard *.h)
14 17
 objs     = $(srcs:.cpp=.o) 
... ...
@@ -27,18 +30,38 @@ module_package: $(extra_target)
27 27
 
28 28
 
29 29
 .PHONY: clean
30
-clean:
30
+clean: $(extra_clean)
31 31
 	-@rm -f $(objs) $(depends) $(lib_name)
32 32
 
33 33
 .PHONY: deps
34 34
 deps: $(depends)
35 35
 
36 36
 .PHONY: install
37
-install: $(lib_name) $(extra_install)
37
+install: all $(extra_install)
38 38
 	mkdir -p $(modules-prefix)/$(modules-dir)
39 39
 	$(INSTALL-TOUCH) $(modules-prefix)/$(modules-dir)/$(lib_name) ; \
40 40
 	$(INSTALL-MODULES) $(lib_name) $(modules-prefix)/$(modules-dir)
41 41
 
42
+.PHONY: install-cfg
43
+install-cfg: 
44
+	mkdir -p $(cfg-prefix)/$(cfg-dir)etc
45
+	-@for r in $(module_conf_files); do \
46
+			echo installing $$r ;  \
47
+			$(INSTALL-TOUCH) $(cfg-prefix)/$(cfg-dir)$$r ; \
48
+			$(INSTALL-CFG) $$r $(cfg-prefix)/$(cfg-dir)$$r; \
49
+	done
50
+
51
+.PHONY: $(plug_in_name)_audio
52
+$(plug_in_name)_audio: $(audio-prefix)/$(audio-dir)
53
+	mkdir -p $(audio-prefix)/$(audio-dir)$(plug_in_name)
54
+	-@for f in $(AUDIO_FILES) ; do \
55
+		if [ -n "wav/$$f" ]; then \
56
+			$(INSTALL-TOUCH) $(audio-prefix)/$(audio-dir)$(plug_in_name)/$$f; \
57
+			$(INSTALL-AUDIO) wav/$$f $(audio-prefix)/$(audio-dir)$(plug_in_name)/$$f; \
58
+		fi ; \
59
+	done
60
+
61
+
42 62
 %.d: %.cpp Makefile $(COREPATH)/plug-in/Makefile.app_module
43 63
 	g++ -MM $< $(cflags) > $@
44 64
 
... ...
@@ -33,6 +33,9 @@ install: $(lib_name) $(extra_install)
33 33
 	$(INSTALL-TOUCH) $(modules-prefix)/$(modules-dir)/$(lib_name) ; \
34 34
 	$(INSTALL-MODULES) $(lib_name) $(modules-prefix)/$(modules-dir)
35 35
 
36
+.PHONY: install-cfg
37
+install-cfg : $(extra_install_cfg)
38
+
36 39
 %.d: %.c Makefile $(COREPATH)/plug-in/Makefile.audio_module
37 40
 	gcc -MM $< $(cflags) > $@
38 41
 
... ...
@@ -1,3 +1,4 @@
1
+COREPATH =../..
1 2
 plug_in_name = echo
2 3
 
3 4
 module_ldflags =
... ...
@@ -1,3 +1,5 @@
1
+COREPATH =../..
2
+
1 3
 plug_in_name = gsm
2 4
 
3 5
 module_ldflags = 
... ...
@@ -1,3 +1,5 @@
1
+COREPATH =../..
2
+
1 3
 plug_in_name = ilbc
2 4
 ILBC_DIR = ./iLBC_rfc3951
3 5
 
... ...
@@ -1,3 +1,5 @@
1
+COREPATH =../..
2
+
1 3
 plug_in_name = session_timer
2 4
 
3 5
 module_ldflags = 
... ...
@@ -1,3 +1,5 @@
1
+COREPATH =../..
2
+
1 3
 plug_in_name = stats
2 4
 
3 5
 module_ldflags = 
4 6
new file mode 100644
... ...
@@ -0,0 +1,2 @@
0
+monit_udp_ip=127.0.0.1
1
+monit_udp_port=5040
... ...
@@ -1,3 +1,4 @@
1
+COREPATH =../..
1 2
 plug_in_name = uac_auth
2 3
 
3 4
 module_extra_objs = md5.o
... ...
@@ -1,3 +1,4 @@
1
+COREPATH =../..
1 2
 plug_in_name = wav
2 3
 
3 4
 module_ldflags =
... ...
@@ -13,7 +13,7 @@
13 13
 # example: option=value # i like this option
14 14
 #
15 15
 
16
-plugin_config_path=etc/
16
+plugin_config_path=/usr/local/etc/sems/etc/
17 17
 
18 18
 # optional parameter: fork={yes|no}
19 19
 #