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 |
|
---|
7 | echo
|
---|
8 | echo '===== Merging TDB support code into Greenstone ====='
|
---|
9 | echo
|
---|
10 |
|
---|
11 | # Test that GSDLHOME is set otherwise we won't be able to find the required files
|
---|
12 | if [ "$GSDLHOME" == "" ] ; then echo 'Error! GSDLHOME not set. Please source setup.bash before running.' ; echo ; exit 0 ; fi
|
---|
13 |
|
---|
14 | echo ' - enabling TDB support in common function library'
|
---|
15 | # - Symlink the source file into place
|
---|
16 | ln -f -s $GSDLHOME/ext/tdb-edit/src/lib/tdbclass.cpp $GSDLHOME/common-src/src/lib/tdbclass.cpp
|
---|
17 | # - Makefile.in
|
---|
18 | grep -q 'DUSE_TDB' $GSDLHOME/common-src/src/lib/Makefile.in
|
---|
19 | if [ $? -eq 1 ]
|
---|
20 | then
|
---|
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
|
---|
25 | fi
|
---|
26 |
|
---|
27 | echo ' - enabling TDB support in collection server'
|
---|
28 | # - Makefile.in
|
---|
29 | grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/colservr/Makefile.in
|
---|
30 | if [ $? -eq 1 ]
|
---|
31 | then
|
---|
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
|
---|
34 | fi
|
---|
35 | # - collectset.cpp
|
---|
36 | grep -q 'tdbclass.h' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
37 | if [ $? -eq 1 ]
|
---|
38 | then
|
---|
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
|
---|
41 | fi
|
---|
42 |
|
---|
43 | echo ' - enabling TDB support in Greenstone receptionist'
|
---|
44 | # - Makefile.in
|
---|
45 | grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/recpt/Makefile.in
|
---|
46 | if [ $? -eq 1 ]
|
---|
47 | then
|
---|
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
|
---|
52 | fi
|
---|
53 |
|
---|
54 | echo ' - enabling TDB support in OAI Server receptionist'
|
---|
55 | # - Makefile.in
|
---|
56 | grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
|
---|
57 | if [ $? -eq 1 ]
|
---|
58 | then
|
---|
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
|
---|
61 | fi
|
---|
62 |
|
---|
63 | echo
|
---|
64 | echo '===================================================='
|
---|
65 | echo
|
---|
66 | echo 'TDB support has now been merged into Greenstone.'
|
---|
67 | echo 'Please return to the main Greenstone directory and '
|
---|
68 | echo 'rerun:'
|
---|
69 | echo
|
---|
70 | echo ' ./configure <any required arguments>'
|
---|
71 | echo ' make'
|
---|
72 | echo ' make install'
|
---|
73 | echo
|
---|
74 | echo 'to complete TDB installation.'
|
---|
75 | echo
|
---|
76 | echo '===================================================='
|
---|
77 | echo
|
---|
78 |
|
---|
79 | exit 0 |
---|