Changeset 30255


Ignore:
Timestamp:
09/21/15 11:02:48 (6 years ago)
Author:
jmt12
Message:

Skip changes to the runtime if in GS3 (mainly because C++ runtime code doesn't exist so changing it is difficult to say the least)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tdb/trunk/enable_tdb.sh

    r30254 r30255  
    7575fi
    7676
    77 printf ' * Enabling TDB support in collection server... '
    78 # - Makefile.in
    79 MAKEFILE="${GSDLHOME}/runtime-src/src/colservr/Makefile.in"
    80 grep -q 'DUSE_TDB' "${MAKEFILE}"
    81 if [ $? -eq 1 ]
    82 then
    83     # - Test for extension support in the makefile
    84     grep -q 'EXT_DEFINES' "${MAKEFILE}"
    85     if [ $? -eq 1 ]
    86     then
    87     sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\n\n&:' "${MAKEFILE}"
    88     sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
    89     sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
    90     else
    91     sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
    92     sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
    93     fi
    94     echo 'Done!'
     77# No runtime support needed for Greenstone3 - that's done via JNI
     78if [ "${GSDL3HOME}x" == "x" ]
     79then
     80    printf ' * Enabling TDB support in collection server... '
     81    # - Makefile.in
     82    MAKEFILE="${GSDLHOME}/runtime-src/src/colservr/Makefile.in"
     83    grep -q 'DUSE_TDB' "${MAKEFILE}"
     84    if [ $? -eq 1 ]
     85    then
     86    # - Test for extension support in the makefile
     87    grep -q 'EXT_DEFINES' "${MAKEFILE}"
     88    if [ $? -eq 1 ]
     89    then
     90        sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\n\n&:' "${MAKEFILE}"
     91        sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
     92        sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
     93    else
     94        sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
     95        sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
     96    fi
     97    echo 'Done!'
     98    else
     99    echo 'already enabled'
     100    fi
     101    grep -q 'DUSE_TDB' "${MAKEFILE}"
     102    if [ $? -eq 1 ]
     103    then
     104    echo "Error! Update of ${MAKEFILE} failed."
     105    exit
     106    fi
     107
     108    # - collectset.cpp
     109    SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectset.cpp"
     110    grep -q 'tdbclass.h' "${SRCFILE}"
     111    if [ $? -eq 1 ]
     112    then
     113    grep -q '@EXTENSION HEADERS@' "${SRCFILE}"
     114    if [ $? -eq 1 ]
     115    then
     116        sed -i 's:collectset\:\:collectset (text_t& gsdlhome, text_t& collecthome):// @EXTENSION HEADERS@\n#include "tdbclass.h //TDB\n\n&:' "${SRCFILE}"
     117        sed -i 's:    // Use GDBM if the infodb type is empty or not one of the values above:    // @EXTENSION DATASOURCES@\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer\n\n&:' "${SRCFILE}"
     118    else
     119        sed -i 's:// @EXTENSION HEADERS@:&\n#include "tdbclass.h" //TDB:' "${SRCFILE}"
     120        sed -i 's:// @EXTENSION DATASOURCES@:&\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer:' "${SRCFILE}"
     121    fi
     122    fi
     123    grep -q 'tdbclass.h' "${SRCFILE}"
     124    if [ $? -eq 1 ]
     125    then
     126    echo "Error! Update of ${SRCFILE} failed."
     127    exit
     128    fi
     129
     130    # - collectserver.cpp
     131    # There are now sanity tests in collectserver to ensure appropriate indexer
     132    # and infodbtype are compiled into colservr.  While not fatal to leave this
     133    # as is, it does cause vast amounts of error messages in (Apache) logs
     134    SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectserver.cpp"
     135    grep -q 'TDB' "${SRCFILE}"
     136    if [ $? -eq 1 ]
     137    then
     138    grep -q '@EXTENSION DATASOURCES@' "${SRCFILE}"
     139    if [ $? -eq 1 ]
     140    then
     141        sed -i 's:  if (infodbtype=="gdbm") {:  // @EXTENSION DATASOURCES@\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing\n\n&:' "${SRCFILE}"
     142    else
     143        sed -i 's:  // @EXTENSION DATASOURCES@:&\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing:' "${SRCFILE}"
     144    fi
     145    fi
     146    grep -q 'TDB' "${SRCFILE}"
     147    if [ $? -eq 1 ]
     148    then
     149    echo "Error! Update of ${SRCFILE} failed."
     150    exit
     151    fi
     152
     153    printf ' * Enabling TDB support in Greenstone receptionist... '
     154    # - Makefile.in
     155    MAKEFILE="${GSDLHOME}/runtime-src/src/recpt/Makefile.in"
     156    grep -q 'DUSE_TDB' "${MAKEFILE}"
     157    if [ $? -eq 1 ]
     158    then
     159    grep -q 'EXT_DEFINES' "${MAKEFILE}"
     160    if [ $? -eq 1 ]
     161    then
     162        sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
     163        sed -i 's:DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DHAVE_CONFIG_H:& $(EXT_DEFINES):' "${MAKEFILE}"
     164        sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
     165        sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
     166        sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
     167    else
     168        sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
     169        sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
     170        sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
     171        sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
     172    fi
     173    echo 'Done!'
     174    else
     175    echo 'already enabled'
     176    fi
     177    grep -q 'DUSE_TDB' "${MAKEFILE}"
     178    if [ $? -eq 1 ]
     179    then
     180    echo "Error! Update of ${MAKEFILE} failed."
     181    fi
     182
     183    printf ' * Enabling TDB support in OAI Server receptionist... '
     184    # - Makefile.in
     185    MAKEFILE="${GSDLHOME}/runtime-src/src/oaiservr/Makefile.in"
     186    grep -q 'DUSE_TDB' "${MAKEFILE}"
     187    if [ $? -eq 1 ]
     188    then
     189    grep -q 'EXT_DEFINES' "${MAKEFILE}"
     190    if [ $? -eq 1 ]
     191    then
     192        sed -i 's:CC = @CC@:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
     193        sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
     194        sed -i 's:INCLUDES = -I$(COMMON_DIR)/src/lib:& $(EXT_INCLUDES):' "${MAKEFILE}"
     195        sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
     196        sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
     197    else
     198        sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
     199        sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
     200        sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
     201        sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
     202    fi
     203    echo 'Done!'
     204    else
     205    echo 'already enabled'
     206    fi
     207    grep -q 'DUSE_TDB' "${MAKEFILE}"
     208    if [ $? -eq 1 ]
     209    then
     210    echo "Error! Update of ${MAKEFILE} failed."
     211    fi
    95212else
    96     echo 'already enabled'
    97 fi
    98 grep -q 'DUSE_TDB' "${MAKEFILE}"
    99 if [ $? -eq 1 ]
    100 then
    101     echo "Error! Update of ${MAKEFILE} failed."
    102     exit
    103 fi
    104 
    105 # - collectset.cpp
    106 SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectset.cpp"
    107 grep -q 'tdbclass.h' "${SRCFILE}"
    108 if [ $? -eq 1 ]
    109 then
    110     grep -q '@EXTENSION HEADERS@' "${SRCFILE}"
    111     if [ $? -eq 1 ]
    112     then
    113     sed -i 's:collectset\:\:collectset (text_t& gsdlhome, text_t& collecthome):// @EXTENSION HEADERS@\n#include "tdbclass.h //TDB\n\n&:' "${SRCFILE}"
    114     sed -i 's:    // Use GDBM if the infodb type is empty or not one of the values above:    // @EXTENSION DATASOURCES@\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer\n\n&:' "${SRCFILE}"
    115     else
    116     sed -i 's:// @EXTENSION HEADERS@:&\n#include "tdbclass.h" //TDB:' "${SRCFILE}"
    117     sed -i 's:// @EXTENSION DATASOURCES@:&\n    if (infodbtype == "tdb") {db_ptr = new tdbclass(gsdlhome);} //TDB\n    if (infodbtype == "tdbserver") {db_ptr = new tdbclass(gsdlhome);} //TDBServer:' "${SRCFILE}"
    118     fi
    119 fi
    120 grep -q 'tdbclass.h' "${SRCFILE}"
    121 if [ $? -eq 1 ]
    122 then
    123     echo "Error! Update of ${SRCFILE} failed."
    124     exit
    125 fi
    126 
    127 # - collectserver.cpp
    128 # There are now sanity tests in collectserver to ensure appropriate indexer and
    129 # infodbtype are compiled into colservr. While not fatal to leave this as is,
    130 # it does cause vast amounts of error messages in (Apache) logs
    131 SRCFILE="${GSDLHOME}/runtime-src/src/colservr/collectserver.cpp"
    132 grep -q 'TDB' "${SRCFILE}"
    133 if [ $? -eq 1 ]
    134 then
    135     grep -q '@EXTENSION DATASOURCES@' "${SRCFILE}"
    136     if [ $? -eq 1 ]
    137     then
    138     sed -i 's:  if (infodbtype=="gdbm") {:  // @EXTENSION DATASOURCES@\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing\n\n&:' "${SRCFILE}"
    139     else
    140     sed -i 's:  // @EXTENSION DATASOURCES@:&\n  if (infodbtype == "tdb") { return; } // TDB Do nothing\n  if (infodbtype == "tdbserver") { return; } // TDBServer Do nothing:' "${SRCFILE}"
    141     fi
    142 fi
    143 grep -q 'TDB' "${SRCFILE}"
    144 if [ $? -eq 1 ]
    145 then
    146     echo "Error! Update of ${SRCFILE} failed."
    147     exit
    148 fi
    149 
    150 printf ' * Enabling TDB support in Greenstone receptionist... '
    151 # - Makefile.in
    152 MAKEFILE="${GSDLHOME}/runtime-src/src/recpt/Makefile.in"
    153 grep -q 'DUSE_TDB' "${MAKEFILE}"
    154 if [ $? -eq 1 ]
    155 then
    156     grep -q 'EXT_DEFINES' "${MAKEFILE}"
    157     if [ $? -eq 1 ]
    158     then
    159     sed -i 's:AR = ar:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
    160     sed -i 's:DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DHAVE_CONFIG_H:& $(EXT_DEFINES):' "${MAKEFILE}"
    161     sed -i 's:INCLUDES = -I. -I$(GSDL_DIR):& $(EXT_INCLUDES):' "${MAKEFILE}"
    162     sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
    163     sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
    164     else
    165     sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
    166     sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
    167     sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
    168     sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
    169     fi
    170     echo 'Done!'
    171 else
    172     echo 'already enabled'
    173 fi
    174 grep -q 'DUSE_TDB' "${MAKEFILE}"
    175 if [ $? -eq 1 ]
    176 then
    177     echo "Error! Update of ${MAKEFILE} failed."
    178 fi
    179 
    180 
    181 printf ' * Enabling TDB support in OAI Server receptionist... '
    182 # - Makefile.in
    183 MAKEFILE="${GSDLHOME}/runtime-src/src/oaiservr/Makefile.in"
    184 grep -q 'DUSE_TDB' "${MAKEFILE}"
    185 if [ $? -eq 1 ]
    186 then
    187     grep -q 'EXT_DEFINES' "${MAKEFILE}"
    188     if [ $? -eq 1 ]
    189     then
    190     sed -i 's:CC = @CC@:# Support for adding in extension classes\nEXT_DEFINES = -DUSE_TDB\nEXT_INCLUDES = -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib\nEXT_LDFLAGS = -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib\nEXT_LIBS = -ltdb\n\n&:' "${MAKEFILE}"
    191     sed -i 's:DEFS = @DEFS@:& $(EXT_DEFINES):' "${MAKEFILE}"
    192     sed -i 's:INCLUDES = -I$(COMMON_DIR)/src/lib:& $(EXT_INCLUDES):' "${MAKEFILE}"
    193     sed -i 's:LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@:& $(EXT_LDFLAGS):' "${MAKEFILE}"
    194     sed -i 's:LIBS = @LIBS@ $(GDBM_LIBS):& $(EXT_LIBS):' "${MAKEFILE}"
    195     else
    196     sed -i 's:EXT_DEFINES =.*:& -DUSE_TDB:' "${MAKEFILE}"
    197     sed -i 's:EXT_INCLUDES =.*:& -I$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/include -I$(GSDL_DIR)/ext/'${EXTNAME}'/src/lib:' "${MAKEFILE}"
    198     sed -i 's:EXT_LDFLAGS =.*:& -L$(GSDL_DIR)/ext/'${EXTNAME}'/'${GSDLOS}'/lib:' "${MAKEFILE}"
    199     sed -i 's:EXT_LIBS =.*:& -ltdb:' "${MAKEFILE}"
    200     fi
    201     echo 'Done!'
    202 else
    203     echo 'already enabled'
    204 fi
    205 grep -q 'DUSE_TDB' "${MAKEFILE}"
    206 if [ $? -eq 1 ]
    207 then
    208     echo "Error! Update of ${MAKEFILE} failed."
     213    echo " * Runtime TDB support delegated to Java/JNI/TDB bridge."
    209214fi
    210215
Note: See TracChangeset for help on using the changeset viewer.