Changeset 32786


Ignore:
Timestamp:
02/20/19 19:05:50 (2 years ago)
Author:
ak19
Message:

Preliminary changes before this script can work on Linux too. The Linux testing machine VM doesn't have DBI or DBD (DBI::DBD and DBD::mysql). This prevents the GreenstonePlugs from parsing during pluginfo. Should make the plugins inactive, but since the mac script to compile up DBD and install the mysql server can also work for linux have started adjusting it for that. Committing the linux changes separately. These are improvements for compiling on the Mac and now including getting and compiling DBI, not just DBD (which should in theory be be working with that DBI).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cpan/compile-dbd-mysql.sh

    r32662 r32786  
    4040MYSQL_BIN=mysql-5.7.23
    4141MYSQL_MIRROR=http://mysql.inspire.net.nz/Downloads/MySQL-5.7
     42#MYSQL_TARBALL="${MYSQL_BIN}-linux-glibc2.12-x86_64"
    4243MYSQL_TARBALL="${MYSQL_BIN}-macos10.13-x86_64"
     44
     45# We want DBI::mysql version 1.634
     46# see http://wiki.greenstone.org/doku.php?id=en:user_advanced:greenstonesqlplugs
     47# and https://metacpan.org/pod/release/TIMB/DBI-1.634/lib/DBI/DBD.pm
     48DBI_MYSQL=DBI-1.634
     49DBI_MYSQL_DOWNLOAD=https://cpan.metacpan.org/authors/id/T/TI/TIMB/$DBI_MYSQL.tar.gz
    4350
    4451# We want DBD::mysql version 4.033
     
    5158
    5259# PERL_FOLDER is something like "perl-5.18" (even if the full version number is 5.18.2)
    53 PERL_FOLDER=`perl -e 'print "perl-5.".substr($],3,2);'`
     60PERL_VERSION=`perl -e 'print "5.".substr($],3,2);'`
     61# full perl version number like 5.18.2 or 5.22.1 (actually "5 version 22 subversion 1)
     62PERL_FULL_VERSION=`perl -e 'print "5.".substr($],3,2).".".substr($],7,1);'`
     63PERL_FOLDER="perl-${PERL_VERSION}" #`perl -e 'print "perl-5.".substr($],3,2);'`
    5464
    5565# make the dirs cpan/$PERL_FOLDER and its subdir auto if they don't already exist
     
    6070# after everything is installed there, we copy just the relevant installed files to their final locations
    6171# then the tmp file gets deleted
    62 TEMP_DBD_MYSQL_DIR=$CPAN_DIR/tmp-mysql
     72TEMP_DBI_DBD_DIR=$CPAN_DIR/tmp-mysql
    6373TEMP_STATIC_LIBS_DIR=$GSDLHOME/$MYSQL_BIN/mysql-static
    6474MYSQL_DIR=$GSDLHOME/$MYSQL_BIN
     
    6777##########################
    6878
    69 # if clean was passed in
     79# if --clean was passed in
    7080if [ "x$1" = "x--clean" ] ; then
    7181    pushd $CPAN_DIR
     
    7787    fi
    7888    echo "** Done cleaning DBD::mysql related packages"
     89
     90    if [ -e "$PERL_FOLDER/DBI" ]; then
     91    rm -rf $PERL_FOLDER/DBI
     92    fi
     93    if [ -e "$PERL_FOLDER/auto/DBI" ]; then
     94    rm -rf $PERL_FOLDER/auto/DBI
     95    fi
     96    echo "** Done cleaning DBI::DBD related packages"
    7997    popd
    8098    exit 0
     
    103121# copy just the static .a libraries into their own folder
    104122if [ ! -d $TEMP_STATIC_LIBS_DIR ]; then
    105     echo "** Creating $TEMP_STATIC_LIBS_DIR and copying $MYSQL_BIN/lib/* into it"
    106     mkdir $TEMP_STATIC_LIBS_DIR
     123    echo "** Creating $TEMP_STATIC_LIBS_DIR and copying $MYSQL_BIN/lib/*.a into it"
     124    mkdir -p $TEMP_STATIC_LIBS_DIR
    107125    cp $GSDLHOME/$MYSQL_BIN/lib/*.a $TEMP_STATIC_LIBS_DIR/.
    108126fi
     127
     128# download and untar DBI::DBD v 1.634
     129if [ ! -d $GSDLHOME/$DBI_MYSQL ]; then
     130    cd $GSDLHOME
     131    if [ ! -e $GSDLHOME/$DBI_MYSQL.tar.gz ]; then
     132    echo "** Getting the DBI::DBD tarball"
     133    wget $WGET_FLAGS $DBI_MYSQL_DOWNLOAD
     134    fi
     135    echo "** Extracting the DBI::DBD tarball into $GSDLHOME"
     136    tar -xvzf $DBI_MYSQL.tar.gz
     137fi
     138# start compiling DBI::DBD into $TEMP_DBI_DBD_DIR
     139echo "** Creating $TEMP_DBI_DBD_DIR (anew) and compiling this perl package"
     140
     141if [ -d $TEMP_DBI_DBD_DIR ]; then
     142    rm -rf $TEMP_DBI_DBD_DIR
     143fi
     144mkdir $TEMP_DBI_DBD_DIR
     145
     146cd $GSDLHOME/$DBI_MYSQL
     147perl Makefile.PL \
     148    PREFIX=$TEMP_DBI_DBD_DIR
     149    --cflags=-I$GSDLHOME/$MYSQL_BIN/include \
     150    --libs="-L$TEMP_STATIC_LIBS_DIR -lmysqlclient"
     151make
     152make install
     153
     154# move built DBI::DBD products into correct CPAN location
     155echo "** Moving relevant DBI::DBD products into $CPAN_DIR/$PERL_FOLDER"
     156cd $CPAN_DIR
     157mv $TEMP_DBI_DBD_DIR/lib/perl5/site_perl/$PERL_FULL_VERSION/darwin-thread-multi-2level/DBI $PERL_FOLDER/.
     158mv $TEMP_DBI_DBD_DIR/lib/perl5/site_perl/$PERL_FULL_VERSION/darwin-thread-multi-2level/auto/DBI $PERL_FOLDER/auto/.
     159
     160#echo "EXITING"
     161#exit
    109162
    110163# download and untar DBD::mysql v 4.033
     
    118171    tar -xvzf $DBD_MYSQL.tar.gz
    119172fi
    120 
    121 # start compiling DBD::mysql into $TEMP_DBD_MYSQL_DIR
    122 echo "** Creating $TEMP_DBD_MYSQL_DIR (anew) and compiling this perl package"
    123 
    124 if [ -d $TEMP_DBD_MYSQL_DIR ]; then
    125     rm -rf $TEMP_DBD_MYSQL_DIR
    126 fi
    127 mkdir $TEMP_DBD_MYSQL_DIR
     173# start compiling DBD::mysql into $TEMP_DBI_DBD_DIR
     174echo "** Compiling this perl package"
    128175
    129176cd $GSDLHOME/$DBD_MYSQL
    130177perl Makefile.PL \
    131     PREFIX=$TEMP_DBD_MYSQL_DIR \
     178    PREFIX=$TEMP_DBI_DBD_DIR \
    132179    --cflags=-I$GSDLHOME/$MYSQL_BIN/include \
    133180    --libs="-L$TEMP_STATIC_LIBS_DIR -lmysqlclient"
     
    139186echo "** Moving relevant DBD::mysql products into $CPAN_DIR/$PERL_FOLDER"
    140187cd $CPAN_DIR
    141 mv $TEMP_DBD_MYSQL_DIR/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/DBD $PERL_FOLDER/.
    142 mv $TEMP_DBD_MYSQL_DIR/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/auto/DBD $PERL_FOLDER/auto/.
     188mv $TEMP_DBI_DBD_DIR/lib/perl5/site_perl/$PERL_FULL_VERSION/darwin-thread-multi-2level/DBD $PERL_FOLDER/.
     189mv $TEMP_DBI_DBD_DIR/lib/perl5/site_perl/$PERL_FULL_SUBVERSION/darwin-thread-multi-2level/auto/DBD $PERL_FOLDER/auto/.
    143190
    144191# clean up
     
    147194if [ "x$1" != "x--keep" ] ; then
    148195    echo "** Will now delete temporary DBD::mysql products, and the untarred DBD::mysql"
    149     rm -rf $TEMP_DBD_MYSQL_DIR
     196    rm -rf $TEMP_DBI_DBD_DIR
     197    rm -rf $GSDLHOME/$DBI_MYSQL
    150198    rm -rf $GSDLHOME/$DBD_MYSQL
    151199else
    152     echo "**   Not deleting the $TEMP_DBD_MYSQL_DIR"
     200    echo "**   Not deleting the $TEMP_DBI_DBD_DIR"
    153201fi
    154202rm -rf $TEMP_STATIC_LIBS_DIR
Note: See TracChangeset for help on using the changeset viewer.