root/gs2-extensions/tdb-edit/trunk/src/disable_tdb.sh @ 25251

Revision 25251, 4.3 KB (checked in by jmt12, 9 years ago)

Adding several more changes needed when enabling or disabling tdb

  • Property svn:executable set to *
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 '===== Removing TDB support code from 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
14
15echo ' - removing TDB support from common function library'
16# - Makefile.in
17sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
18sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
19sed -i 's:\(EXT_SOURCES\s*=.*\)\stdbclass.cpp\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
20sed -i 's:\(EXT_OBJECTS\s*=.*\)\stdbclass.o\(.*\):\1\2:' $GSDLHOME/common-src/src/lib/Makefile.in
21rm -f $GSDLHOME/common-src/src/lib/Makefile
22# - Remove symlink
23rm -f $GSDLHOME/common-src/src/lib/tdbclass.h
24rm -f $GSDLHOME/common-src/src/lib/tdbclass.cpp
25# - Remove compiled files
26rm -f $GSDLHOME/common-src/src/lib/tdbclass.o
27rm -f $GSDLHOME/common-src/src/lib/gsdllib.a
28
29
30echo ' - removing TDB support from collection server'
31# - Makefile.in
32sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/runtime-src/src/colservr/Makefile.in
33sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/colservr/Makefile.in
34rm -f $GSDLHOME/runtime-src/src/colservr/Makefile
35# - collectset.cpp
36# BUG: leaves behind the newlines...
37sed -i '/^#include "tdbclass.h" \/\/TDB/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
38sed -i '/^if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} \/\/TDB/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
39# - collectserver.cpp
40sed -i '/^if (infodbtype == "tdb") { } \/\/ TDB Do nothing/ d' $GSDLHOME/runtime-src/src/colservr/collectset.cpp
41# - Remove compiled files
42rm -f $GSDLHOME/runtime-src/src/colservr/gsdlcolservr.a
43
44
45
46
47echo ' - removing TDB support from Greenstone receptionist'
48# - Makefile.in
49sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
50sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
51sed -i 's:\(EXT_LDFLAGS\s*=.*\)\s-L$(GSDL_DIR)/ext/tdb-edit/linux/lib -L$(GSDL_DIR)/ext/tdb-edit/darwin/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
52sed -i 's:\(EXT_LIBS\s*=.*\)\s-ltdb\(.*\):\1\2:' $GSDLHOME/runtime-src/src/recpt/Makefile.in
53rm -f $GSDLHOME/runtime-src/src/recpt/Makefile
54# - Remove compiled files
55rm -f $GSDLHOME/runtime-src/src/recpt/gsdlrecpt.a
56rm -f $GSDLHOME/runtime-src/src/recpt/library.cgi
57rm -f $GSDLHOME/cgi-bin/library.cgi
58
59
60echo ' - removing TDB support from OAI Server receptionist'
61# - Makefile.in
62sed -i 's:\(EXT_DEFINES\s*=.*\)\s-DUSE_TDB\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
63sed -i 's:\(EXT_INCLUDES\s*=.*\)\s-I$(GSDL_DIR)/ext/tdb-edit/linux/include\s*-I$(GSDL_DIR)/ext/tdb-edit/darwin/include\s*-I$(GSDL_DIR)/ext/tdb-edit/src/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
64sed -i 's:\(EXT_LDFLAGS\s*=.*\)\s-L$(GSDL_DIR)/ext/tdb-edit/linux/lib -L$(GSDL_DIR)/ext/tdb-edit/darwin/lib\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
65sed -i 's:\(EXT_LIBS\s*=.*\)\s-ltdb\(.*\):\1\2:' $GSDLHOME/runtime-src/src/oaiservr/Makefile.in
66rm -f $GSDLHOME/runtime-src/src/oaiservr/Makefile
67# - Remove compiled files
68rm -f $GSDLHOME/runtime-src/src/oaiservr/oaiserver.cgi
69rm -f $GSDLHOME/cgi-bin/oaiserver.cgi
70
71echo
72echo '====================================================='
73echo
74echo 'TDB support has now been removed from Greenstone.'
75echo 'Please return to the main Greenstone directory and'
76echo 'rerun:'
77echo
78echo ' ./configure <any required arguments>'
79echo ' make'
80echo ' make install'
81echo
82echo 'to complete TDB removal.'
83echo
84echo '====================================================='
85echo
86
87exit 0
Note: See TracBrowser for help on using the browser.