Browse code

- support for files installed in '*/share/ser' - replace the path to sql files in ser_mysql.sh during install - install SQL files for mysql (to be continued)

Jan Janak authored on 26/06/2008 00:54:13
Showing 2 changed files
... ...
@@ -221,7 +221,13 @@ modules_full_path=$(join  $(modules), $(addprefix /, $(modules_names)))
221 221
 # (full path including file name)
222 222
 utils_compile=	utils/gen_ha1 utils/sercmd
223 223
 utils_bin_install=	utils/gen_ha1/gen_ha1 utils/sercmd/sercmd
224
-utils_script_install=	scripts/mysql/ser_mysql.sh
224
+utils_script_install=
225
+
226
+# This is the list of files to be installed into the arch-independent
227
+# shared directory (by default /usr/local/share/ser)
228
+share_install= scripts/mysql/my_create.sql \
229
+			   scripts/mysql/my_data.sql   \
230
+			   scripts/mysql/my_drop.sql
225 231
 
226 232
 
227 233
 ALLDEP=Makefile Makefile.sources Makefile.defs Makefile.rules
... ...
@@ -443,7 +449,7 @@ man:
443 443
 
444 444
 .PHONY: install
445 445
 install: install-bin install-modules install-cfg \
446
-	install-doc install-man install-utils
446
+	install-doc install-man install-utils install-share
447 447
 
448 448
 .PHONY: dbinstall
449 449
 dbinstall:
... ...
@@ -453,7 +459,8 @@ dbinstall:
453 453
 
454 454
 mk-install_dirs: $(cfg_prefix)/$(cfg_dir) $(bin_prefix)/$(bin_dir) \
455 455
 			$(modules_prefix)/$(modules_dir) $(doc_prefix)/$(doc_dir) \
456
-			$(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5
456
+			$(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5 \
457
+            $(share_prefix)/$(share_dir)
457 458
 
458 459
 
459 460
 $(cfg_prefix)/$(cfg_dir): 
... ...
@@ -462,6 +469,9 @@ $(cfg_prefix)/$(cfg_dir):
462 462
 $(bin_prefix)/$(bin_dir):
463 463
 		mkdir -p $(bin_prefix)/$(bin_dir)
464 464
 
465
+$(share_prefix)/$(share_dir):
466
+		mkdir -p $(share_prefix)/$(share_dir)
467
+
465 468
 $(modules_prefix)/$(modules_dir):
466 469
 		mkdir -p $(modules_prefix)/$(modules_dir)
467 470
 
... ...
@@ -506,9 +516,24 @@ install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
506 506
 		$(INSTALL_TOUCH) $(bin_prefix)/$(bin_dir)/$(NAME)
507 507
 		$(INSTALL_BIN) $(NAME) $(bin_prefix)/$(bin_dir)
508 508
 
509
-
510 509
 export INSTALL_TOUCH RELEASE
511 510
 
511
+install-share: $(share_prefix)/$(share_dir)
512
+	@for r in $(share_install) "" ; do \
513
+		if [ -n "$$r" ]; then \
514
+			if [ -f "$$r" ]; then \
515
+				$(INSTALL_TOUCH) \
516
+					$(share_prefix)/$(share_dir)/`basename "$$r"` ; \
517
+				$(INSTALL_SHARE)  "$$r"  $(share_prefix)/$(share_dir) ; \
518
+			else \
519
+				echo "ERROR: $$r not found" ; \
520
+				if [ ${err_fail} = 1 ] ; then \
521
+					exit 1; \
522
+				fi ; \
523
+			fi ;\
524
+		fi ; \
525
+	done; true
526
+
512 527
 install-modules: $(modules_prefix)/$(modules_dir)
513 528
 	@for r in $(modules) "" ; do \
514 529
 		if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
... ...
@@ -551,7 +576,12 @@ install-utils: utils $(bin_prefix)/$(bin_dir)
551 551
 			fi ;\
552 552
 		fi ; \
553 553
 	done; true
554
-
554
+	# FIXME: This is a hack, this should be (and will be) done properly in
555
+    # per-module Makefiles
556
+	sed -e "s#^DEFAULT_SCRIPT_DIR.*#DEFAULT_SCRIPT_DIR=\"$(share_prefix)/$(share_dir)\"#g" \
557
+		< scripts/mysql/ser_mysql.sh > $(bin_prefix)/$(bin_dir)/ser_mysql.sh
558
+	chmod 755 $(bin_prefix)/$(bin_dir)/ser_mysql.sh
559
+	true
555 560
 
556 561
 
557 562
 install-modules-all: install-modules install-modules-doc
... ...
@@ -138,6 +138,7 @@ CC_EXTRA_OPTS ?=
138 138
 # dirs 
139 139
 cfg_dir = etc/ser/
140 140
 bin_dir = sbin/
141
+share_dir = share/ser/
141 142
 modules_dir = lib/ser/modules/
142 143
 lib_dir = lib/ser/
143 144
 ifeq ($(OS), linux)
... ...
@@ -197,6 +198,7 @@ lib_prefix = $(basedir)$(prefix)
197 197
 doc_prefix = $(basedir)$(prefix)
198 198
 man_prefix = $(basedir)$(prefix)
199 199
 ut_prefix = $(basedir)$(prefix)
200
+share_prefix = $(basedir)$(prefix)
200 201
 
201 202
 
202 203
 # target dirs for various stuff
... ...
@@ -225,6 +227,7 @@ INSTALL_MODULES = $(INSTALL) -m 755
225 225
 INSTALL_LIB = $(INSTALL) -m 755
226 226
 INSTALL_DOC = $(INSTALL) -m 644
227 227
 INSTALL_MAN = $(INSTALL) -m 644
228
+INSTALL_SHARE = $(INSTALL) -m 644
228 229
 
229 230
 #set some vars from the environment (and not make builtins)
230 231
 CC   := $(shell echo "$${CC}")