annotate tools/xapian_installer.sh @ 1203:8cd15df9b563

Controlling the xapian install script in tools.
author Brian Neal <bgneal@gmail.com>
date Sat, 04 Jan 2025 14:19:19 -0600
parents
children
rev   line source
bgneal@1203 1 #!/usr/bin/env bash
bgneal@1203 2 # BGN: This script was originally obtained from:
bgneal@1203 3 # https://gist.github.com/jorgecarleitao/ab6246c86c936b9c55fd
bgneal@1203 4 #
bgneal@1203 5 # first argument of the script is Xapian version (e.g. 1.2.19)
bgneal@1203 6 VERSION=$1
bgneal@1203 7
bgneal@1203 8 # prepare
bgneal@1203 9 mkdir $VIRTUAL_ENV/packages && cd $VIRTUAL_ENV/packages
bgneal@1203 10
bgneal@1203 11 CORE=xapian-core-$VERSION
bgneal@1203 12 BINDINGS=xapian-bindings-$VERSION
bgneal@1203 13
bgneal@1203 14 # download
bgneal@1203 15 echo "Downloading source..."
bgneal@1203 16 curl -O https://oligarchy.co.uk/xapian/$VERSION/${CORE}.tar.xz
bgneal@1203 17 curl -O https://oligarchy.co.uk/xapian/$VERSION/${BINDINGS}.tar.xz
bgneal@1203 18
bgneal@1203 19 # extract
bgneal@1203 20 echo "Extracting source..."
bgneal@1203 21 tar xf ${CORE}.tar.xz
bgneal@1203 22 tar xf ${BINDINGS}.tar.xz
bgneal@1203 23
bgneal@1203 24 # install
bgneal@1203 25 echo "Installing Xapian-core..."
bgneal@1203 26 cd $VIRTUAL_ENV/packages/${CORE}
bgneal@1203 27 ./configure --prefix=$VIRTUAL_ENV && make && make install
bgneal@1203 28
bgneal@1203 29 PYV=`python -c "import sys;t='{v[0]}'.format(v=list(sys.version_info[:1]));sys.stdout.write(t)";`
bgneal@1203 30
bgneal@1203 31 if [ $PYV = "2" ]; then
bgneal@1203 32 PYTHON_FLAG=--with-python
bgneal@1203 33 else
bgneal@1203 34 PYTHON_FLAG=--with-python3
bgneal@1203 35 fi
bgneal@1203 36
bgneal@1203 37 echo "Installing Xapian-bindings..."
bgneal@1203 38 cd $VIRTUAL_ENV/packages/${BINDINGS}
bgneal@1203 39 ### ./configure --prefix=$VIRTUAL_ENV $PYTHON_FLAG XAPIAN_CONFIG=$VIRTUAL_ENV/bin/xapian-config-1.3 && make && make install
bgneal@1203 40 ./configure --prefix=$VIRTUAL_ENV $PYTHON_FLAG XAPIAN_CONFIG=$VIRTUAL_ENV/bin/xapian-config && make && make install
bgneal@1203 41
bgneal@1203 42 # clean
bgneal@1203 43 rm -rf $VIRTUAL_ENV/packages
bgneal@1203 44
bgneal@1203 45 # test
bgneal@1203 46 python -c "import xapian"