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

Last change on this file since 24428 was 24428, checked in by jmt12, 13 years ago

Scripts to add and remove TDB specific makefile and source instructions into the Greenstone code. This means the TDB extension is now properly separate

  • Property svn:executable set to *
File size: 3.5 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.cpp $GSDLHOME/common-src/src/lib/tdbclass.cpp
17# - Makefile.in
18grep -q 'DUSE_TDB' $GSDLHOME/common-src/src/lib/Makefile.in
19if [ $? -eq 1 ]
20then
21 sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' $GSDLHOME/common-src/src/lib/Makefile.in
22 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
23 sed -i 's:EXT_SOURCES =.*:& tdbclass.cpp:' $GSDLHOME/common-src/src/lib/Makefile.in
24 sed -i 's:EXT_OBJECTS =.*:& tdbclass.o:' $GSDLHOME/common-src/src/lib/Makefile.in
25fi
26
27echo ' - enabling TDB support in collection server'
28# - Makefile.in
29grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/colservr/Makefile.in
30if [ $? -eq 1 ]
31then
32 sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' $GSDLHOME/runtime-src/src/colservr/Makefile.in
33 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
34fi
35# - collectset.cpp
36grep -q 'tdbclass.h' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
37if [ $? -eq 1 ]
38then
39 sed -i 's:// @EXTENSION HEADERS@:&\n#include "tdbclass.h" //TDB:' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
40 sed -i 's:// @EXTENSION DATASOURCES@:&\nif (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB:' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
41fi
42
43echo ' - enabling TDB support in Greenstone receptionist'
44# - Makefile.in
45grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/recpt/Makefile.in
46if [ $? -eq 1 ]
47then
48 sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
49 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
50 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
51 sed -i 's:EXT_LIBS =.*:& -ltdb:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
52fi
53
54echo ' - enabling TDB support in OAI Server receptionist'
55# - Makefile.in
56grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
57if [ $? -eq 1 ]
58then
59 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
60 sed -i 's:EXT_LIBS =.*:& -ltdb:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
61fi
62
63echo
64echo '===================================================='
65echo
66echo 'TDB support has now been merged into Greenstone.'
67echo 'Please return to the main Greenstone directory and '
68echo 'rerun:'
69echo
70echo ' ./configure <any required arguments>'
71echo ' make'
72echo ' make install'
73echo
74echo 'to complete TDB installation.'
75echo
76echo '===================================================='
77echo
78
79exit 0
Note: See TracBrowser for help on using the repository browser.