source: gs2-extensions/tdb-edit/trunk/src/enable_tdb.sh@ 25251

Last change on this file since 25251 was 25251, checked in by jmt12, 12 years ago

Adding several more changes needed when enabling or disabling tdb

  • Property svn:executable set to *
File size: 4.4 KB
Line 
1#!/bin/bash
2# Used to merge in the code needed to add TDB support to Greenstone. The script
3# is responsible for updating both Makefile.in and source code files. You can
4# later run 'disable_tdb.sh' to undo these changes.
5# @author John Thompson, University of Waikato, NZ
6
7echo
8echo '===== Merging TDB support code into Greenstone ====='
9echo
10
11# Test that GSDLHOME is set otherwise we won't be able to find the required files
12if [ "$GSDLHOME" == "" ] ; then echo 'Error! GSDLHOME not set. Please source setup.bash before running.' ; echo ; exit 0 ; fi
13
14echo ' - enabling TDB support in common function library'
15# - Symlink the source file into place
16ln -f -s $GSDLHOME/ext/tdb-edit/src/lib/tdbclass.h $GSDLHOME/common-src/src/lib/tdbclass.h
17ln -f -s $GSDLHOME/ext/tdb-edit/src/lib/tdbclass.cpp $GSDLHOME/common-src/src/lib/tdbclass.cpp
18# - Makefile.in
19grep -q 'DUSE_TDB' $GSDLHOME/common-src/src/lib/Makefile.in
20if [ $? -eq 1 ]
21then
22 sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' $GSDLHOME/common-src/src/lib/Makefile.in
23 sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/tdb-edit/linux/include -I$(GSDL_DIR)/ext/tdb-edit/darwin/include -I$(GSDL_DIR)/ext/tdb-edit/src/lib:' $GSDLHOME/common-src/src/lib/Makefile.in
24 sed -i 's:EXT_SOURCES =.*:& tdbclass.cpp:' $GSDLHOME/common-src/src/lib/Makefile.in
25 sed -i 's:EXT_OBJECTS =.*:& tdbclass.o:' $GSDLHOME/common-src/src/lib/Makefile.in
26fi
27
28echo ' - enabling TDB support in collection server'
29# - Makefile.in
30grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/colservr/Makefile.in
31if [ $? -eq 1 ]
32then
33 sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' $GSDLHOME/runtime-src/src/colservr/Makefile.in
34 sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/tdb-edit/linux/include -I$(GSDL_DIR)/ext/tdb-edit/darwin/include -I$(GSDL_DIR)/ext/tdb-edit/src/lib:' $GSDLHOME/runtime-src/src/colservr/Makefile.in
35fi
36# - collectset.cpp
37grep -q 'tdbclass.h' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
38if [ $? -eq 1 ]
39then
40 sed -i 's:// @EXTENSION HEADERS@:&\n#include "tdbclass.h" //TDB:' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
41 sed -i 's:// @EXTENSION DATASOURCES@:&\nif (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB:' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
42fi
43
44# - collectserver.cpp
45# There are now sanity tests in collectserver to ensure appropriate indexer and
46# infodbtype are compiled into colservr. While not fatal to leave this as is,
47# it does cause vast amounts of error messages in (Apache) logs
48grep -q 'tdb' $GSDLHOME/runtime-src/src/colservr/collectserver.cpp
49if [ $? -eq 1 ]
50then
51 sed -i 's:// @EXTENSION HEADERS@:&\nif (infodbtype == "tdb") { } // TDB Do nothing:' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
52fi
53
54echo ' - enabling TDB support in Greenstone receptionist'
55# - Makefile.in
56grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/recpt/Makefile.in
57if [ $? -eq 1 ]
58then
59 sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
60 sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/tdb-edit/linux/include -I$(GSDL_DIR)/ext/tdb-edit/darwin/include -I$(GSDL_DIR)/ext/tdb-edit/src/lib:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
61 sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/tdb-edit/linux/lib -L$(GSDL_DIR)/ext/tdb-edit/darwin/lib:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
62 sed -i 's:EXT_LIBS =.*:& -ltdb:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
63fi
64
65echo ' - enabling TDB support in OAI Server receptionist'
66# - Makefile.in
67grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
68if [ $? -eq 1 ]
69then
70 sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
71 sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/tdb-edit/linux/include -I$(GSDL_DIR)/ext/tdb-edit/darwin/include -I$(GSDL_DIR)/ext/tdb-edit/src/lib:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
72 sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/tdb-edit/linux/lib -L$(GSDL_DIR)/ext/tdb-edit/darwin/lib:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
73 sed -i 's:EXT_LIBS =.*:& -ltdb:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
74fi
75
76echo
77echo '===================================================='
78echo
79echo 'TDB support has now been merged into Greenstone.'
80echo 'Please return to the main Greenstone directory and '
81echo 'rerun:'
82echo
83echo ' ./configure <any required arguments>'
84echo ' make'
85echo ' make install'
86echo
87echo 'to complete TDB installation.'
88echo
89echo '===================================================='
90echo
91
92exit 0
Note: See TracBrowser for help on using the repository browser.