Browse code

- update the path to sql scripts when installing ser_mysql.sh - install mysql sql scripts into /usr/local/share/ser - added targets and config variables for stuff installed into /usr/local/share

Jan Janak authored on 24/06/2008 15:29:33
Showing 2 changed files
... ...
@@ -199,7 +199,10 @@ modules_full_path=$(join  $(modules), $(addprefix /, $(modules_names)))
199 199
 # (full path including file name)
200 200
 utils_compile=	utils/gen_ha1 utils/sercmd
201 201
 utils_install=	utils/gen_ha1/gen_ha1 \
202
-				scripts/mysql/ser_mysql.sh utils/sercmd/sercmd
202
+				utils/sercmd/sercmd
203
+share_install= scripts/mysql/my_create.sql \
204
+			   scripts/mysql/my_data.sql \
205
+			   scripts/mysql/my_drop.sql
203 206
 
204 207
 
205 208
 ALLDEP=Makefile Makefile.sources Makefile.defs Makefile.rules
... ...
@@ -229,6 +232,7 @@ export PREFIX LOCALBASE
229 232
 #export NAME RELEASE OS ARCH 
230 233
 #export cfg-prefix cfg-dir bin-prefix bin-dir modules-prefix modules-dir
231 234
 #export doc-prefix doc-dir man-prefix man-dir ut-prefix ut-dir
235
+#export share-prefix share-dir
232 236
 #export cfg-target modules-target
233 237
 #export INSTALL INSTALL-CFG INSTALL-BIN INSTALL-MODULES INSTALL-DOC INSTALL-MAN 
234 238
 #export INSTALL-TOUCH
... ...
@@ -392,7 +396,7 @@ modules-doc:
392 396
 
393 397
 .PHONY: install
394 398
 install: all mk-install-dirs install-cfg install-bin install-modules \
395
-	install-doc install-man install-utils
399
+	install-doc install-man install-utils install-share
396 400
 
397 401
 
398 402
 .PHONY: dbinstall
... ...
@@ -403,7 +407,8 @@ dbinstall:
403 407
 
404 408
 mk-install-dirs: $(cfg-prefix)/$(cfg-dir) $(bin-prefix)/$(bin-dir) \
405 409
 			$(modules-prefix)/$(modules-dir) $(doc-prefix)/$(doc-dir) \
406
-			$(man-prefix)/$(man-dir)/man8 $(man-prefix)/$(man-dir)/man5
410
+			$(man-prefix)/$(man-dir)/man8 $(man-prefix)/$(man-dir)/man5 \
411
+			$(share-prefix)/$(share-dir)
407 412
 
408 413
 
409 414
 $(cfg-prefix)/$(cfg-dir): 
... ...
@@ -412,6 +417,9 @@ $(cfg-prefix)/$(cfg-dir):
412 417
 $(bin-prefix)/$(bin-dir):
413 418
 		mkdir -p $(bin-prefix)/$(bin-dir)
414 419
 
420
+$(share-prefix)/$(share-dir):
421
+		mkdir -p $(share-prefix)/$(share-dir)
422
+
415 423
 $(modules-prefix)/$(modules-dir):
416 424
 		mkdir -p $(modules-prefix)/$(modules-dir)
417 425
 
... ...
@@ -456,6 +464,19 @@ install-bin: $(bin-prefix)/$(bin-dir)
456 464
 		$(INSTALL-TOUCH) $(bin-prefix)/$(bin-dir)/ser 
457 465
 		$(INSTALL-BIN) ser $(bin-prefix)/$(bin-dir)
458 466
 
467
+install-share: $(share-prefix)/$(share-dir)
468
+	-@for r in $(share_install) "" ; do \
469
+		if [ -n "$$r" ]; then \
470
+			if [ -f "$$r" ]; then \
471
+				$(INSTALL-TOUCH) \
472
+					$(share-prefix)/$(share-dir)/`basename "$$r"` ; \
473
+				$(INSTALL-SHARE)  "$$r"  $(share-prefix)/$(share-dir) ; \
474
+			else \
475
+				echo "ERROR: $$r not found" ; \
476
+			fi ;\
477
+		fi ; \
478
+	done
479
+
459 480
 install-modules: modules $(modules-prefix)/$(modules-dir)
460 481
 	-@for r in $(modules_full_path) "" ; do \
461 482
 		if [ -n "$$r" ]; then \
... ...
@@ -480,9 +501,10 @@ install-utils: utils $(bin-prefix)/$(bin-dir)
480 501
 				echo "ERROR: $$r not compiled" ; \
481 502
 			fi ;\
482 503
 		fi ; \
483
-	done 
484
-
485
-
504
+	done
505
+	sed -e "s#^DEFAULT_SCRIPT_DIR.*#DEFAULT_SCRIPT_DIR=\"$(share-prefix)/$(share-dir)\"#g" \
506
+		< scripts/mysql/ser_mysql.sh > $(bin-prefix)/$(bin-dir)/ser_mysql.sh
507
+	chmod 755 $(bin-prefix)/$(bin-dir)/ser_mysql.sh
486 508
 
487 509
 install-modules-all: install-modules install-modules-doc
488 510
 
... ...
@@ -542,8 +564,10 @@ lib_dependent_modules = dialog pa rls presence_b2b xcap
542 564
 
543 565
 # exports for libs
544 566
 export cfg-prefix cfg-dir bin-prefix bin-dir modules-prefix modules-dir
545
-export doc-prefix doc-dir man-prefix man-dir ut-prefix ut-dir
546
-export INSTALL INSTALL-CFG INSTALL-BIN INSTALL-MODULES INSTALL-DOC INSTALL-MAN 
567
+export doc-prefix doc-dir man-prefix man-dir ut-prefix ut-dir \
568
+				  share-prefix share-dir
569
+export INSTALL INSTALL-CFG INSTALL-BIN INSTALL-MODULES INSTALL-DOC INSTALL-MAN \
570
+			   INSTALL-SHARE
547 571
 export INSTALL-TOUCH
548 572
 
549 573
 dep_mods = $(filter $(addprefix modules/, $(lib_dependent_modules)), $(modules))
... ...
@@ -122,6 +122,7 @@ CC_EXTRA_OPTS ?=
122 122
 # dirs 
123 123
 cfg-dir = etc/ser/
124 124
 bin-dir = sbin/
125
+share-dir = share/ser/
125 126
 modules-dir = lib/ser/modules/
126 127
 ifeq ($(OS), linux)
127 128
 	doc-dir = share/doc/ser/
... ...
@@ -176,6 +177,7 @@ modules-prefix = $(basedir)$(prefix)
176 177
 doc-prefix = $(basedir)$(prefix)
177 178
 man-prefix = $(basedir)$(prefix)
178 179
 ut-prefix = $(basedir)$(prefix)
180
+share-prefix = $(basedir)$(prefix)
179 181
 
180 182
 
181 183
 # target dirs for various stuff
... ...
@@ -201,6 +203,7 @@ INSTALL-BIN = $(INSTALL) -m 755
201 203
 INSTALL-MODULES = $(INSTALL) -m 755
202 204
 INSTALL-DOC = $(INSTALL) -m 644
203 205
 INSTALL-MAN = $(INSTALL) -m 644
206
+INSTALL-SHARE = $(INSTALL) -m 644
204 207
 
205 208
 #set some vars from the environment (and not make builtins)
206 209
 CC   := $(shell echo "$${CC}")