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.h $GSDLHOME/common-src/src/lib/tdbclass.h
|
---|
17 | ln -f -s $GSDLHOME/ext/tdb-edit/src/lib/tdbclass.cpp $GSDLHOME/common-src/src/lib/tdbclass.cpp
|
---|
18 | # - Makefile.in
|
---|
19 | grep -q 'DUSE_TDB' $GSDLHOME/common-src/src/lib/Makefile.in
|
---|
20 | if [ $? -eq 1 ]
|
---|
21 | then
|
---|
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
|
---|
26 | fi
|
---|
27 |
|
---|
28 | echo ' - enabling TDB support in collection server'
|
---|
29 | # - Makefile.in
|
---|
30 | grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/colservr/Makefile.in
|
---|
31 | if [ $? -eq 1 ]
|
---|
32 | then
|
---|
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
|
---|
35 | fi
|
---|
36 | # - collectset.cpp
|
---|
37 | grep -q 'tdbclass.h' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
38 | if [ $? -eq 1 ]
|
---|
39 | then
|
---|
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
|
---|
42 | fi
|
---|
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
|
---|
48 | grep -q 'tdb' $GSDLHOME/runtime-src/src/colservr/collectserver.cpp
|
---|
49 | if [ $? -eq 1 ]
|
---|
50 | then
|
---|
51 | sed -i 's:// @EXTENSION HEADERS@:&\nif (infodbtype == "tdb") { } // TDB Do nothing:' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
|
---|
52 | fi
|
---|
53 |
|
---|
54 | echo ' - enabling TDB support in Greenstone receptionist'
|
---|
55 | # - Makefile.in
|
---|
56 | grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/recpt/Makefile.in
|
---|
57 | if [ $? -eq 1 ]
|
---|
58 | then
|
---|
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
|
---|
63 | fi
|
---|
64 |
|
---|
65 | echo ' - enabling TDB support in OAI Server receptionist'
|
---|
66 | # - Makefile.in
|
---|
67 | grep -q 'DUSE_TDB' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
|
---|
68 | if [ $? -eq 1 ]
|
---|
69 | then
|
---|
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
|
---|
74 | fi
|
---|
75 |
|
---|
76 | echo
|
---|
77 | echo '===================================================='
|
---|
78 | echo
|
---|
79 | echo 'TDB support has now been merged into Greenstone.'
|
---|
80 | echo 'Please return to the main Greenstone directory and '
|
---|
81 | echo 'rerun:'
|
---|
82 | echo
|
---|
83 | echo ' ./configure <any required arguments>'
|
---|
84 | echo ' make'
|
---|
85 | echo ' make install'
|
---|
86 | echo
|
---|
87 | echo 'to complete TDB installation.'
|
---|
88 | echo
|
---|
89 | echo '===================================================='
|
---|
90 | echo
|
---|
91 |
|
---|
92 | exit 0 |
---|