diff --git a/src/Makefile b/src/Makefile index f8f00d4b..cfb748f9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,26 +1,34 @@ +PREFIX=/usr/local +INSTALL = install -c all: mk/sysconf - cd lib; $(MAKE) - cd bincimapmime; $(MAKE) - cd index; $(MAKE) - cd qtgui; qmake recoll.pro; rm -f recoll; $(MAKE) + cd lib; ${MAKE} + cd bincimapmime; ${MAKE} + cd index; ${MAKE} + cd qtgui; qmake recoll.pro; rm -f recoll; ${MAKE} mk/sysconf: ./configure static: rm -f index/recollindex qtgui/recoll - cd lib; $(MAKE) - cd bincimapmime; $(MAKE) - cd index; $(MAKE) BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic - cd qtgui; qmake recoll.pro; $(MAKE) BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic + cd lib; ${MAKE} + cd bincimapmime; ${MAKE} + cd index; ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic + cd qtgui; qmake recoll.pro; ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic clean: - cd common; $(MAKE) clean - cd index; $(MAKE) clean - cd lib; $(MAKE) clean - cd bincimapmime; $(MAKE) clean - cd qtgui; rm -f recoll; $(MAKE) clean - cd query; $(MAKE) clean - cd utils; $(MAKE) clean - rm -rf qtgui/Makefile qtgui/preview/Makefile + cd common; ${MAKE} clean + cd index; ${MAKE} clean + cd lib; ${MAKE} clean + cd bincimapmime; ${MAKE} clean + cd qtgui; rm -f recoll; ${MAKE} clean + cd query; ${MAKE} clean + cd utils; ${MAKE} clean + rm -f qtgui/Makefile qtgui/preview/Makefile + +install: all + ./recollinstall ${PREFIX} + +installme: + ./recollinstall diff --git a/src/mk/commondefs b/src/mk/commondefs index 994fcb29..89b5c9c8 100644 --- a/src/mk/commondefs +++ b/src/mk/commondefs @@ -10,3 +10,4 @@ BIGLIB = ../lib/librcl.a MIMELIB = ../bincimapmime/libmime.a RANLIB = test -f +INSTALL = install -c diff --git a/src/recollinstall b/src/recollinstall index b3d8e95f..47f43175 100755 --- a/src/recollinstall +++ b/src/recollinstall @@ -1,5 +1,8 @@ #!/bin/sh +# Install recoll files. This has 2 modes, for installing the binaries or +# the personal configuration files + fatal() { echo $* @@ -7,66 +10,65 @@ fatal() } usage() { - fatal 'installrecoll , ie: installrecoll /usr/local' -} -install() -{ - src=$1 - dst=$2 - if test -d $dst; then dst=$2/`basename $1`;fi - if test -f $dst; then - bak=$dst.prev - #echo "Preserving $dst as $bak" - (install $dst $bak) - fi - echo $src '->' $dst - cp $src $dst + echo 'Usage (binaries): installrecoll , ie: installrecoll /usr/local' + fatal 'Usage (personal config): installrecoll' } -if test $# != 1 ; then - usage -fi -targetdir=$1 +INSTALL=${INSTALL:=install} -echo "Installing binaries to $targetdir" +if test $# = 1 ; then + # Install commands and example config to target directory + PREFIX=$1 -test -x qtgui/recoll || fatal "qtgui/recoll does not exist." \ - " You need to build first." + echo "Installing to $PREFIX" + + test -x qtgui/recoll || fatal "qtgui/recoll does not exist." \ + " You need to build first." + + test -d ${PREFIX}/bin || mkdir ${PREFIX}/bin || exit 1 + ${INSTALL} qtgui/recoll index/recollindex recollinstall $PREFIX/bin \ + || exit 1 + test -d ${PREFIX}/share || mkdir ${PREFIX}/share + test -d ${PREFIX}/share/examples || mkdir ${PREFIX}/share/examples + test -d ${PREFIX}/share/examples/recoll || \ + mkdir ${PREFIX}/share/examples/recoll + ${INSTALL} filters/rcl* ${PREFIX}/share/examples/recoll || exit 1 + ${INSTALL} sampleconf/recoll.conf sampleconf/mimeconf sampleconf/mimemap \ + ${PREFIX}/share/examples/recoll || exit 1 + + exit 0 -if test -d $targetdir/bin -a -w $targetdir/bin ; then - install qtgui/recoll $targetdir/bin/recoll - install index/recollindex $targetdir/bin/recollindex else - echo "Not installing binary executables to $targetdir/bin which is not writable" - echo "Going on with personal install" -fi -me=`whoami` -if test "$me" != root ; then + # Install configuration files to home directory + PREFIX=${PREFIX:=/usr/local} + + me=`whoami` + if test "$me" = root ; then + fatal "Cowardly refusing to install personal config in root's" \ + "home directory" + fi + if test ! -d ${PREFIX}/share/examples/recoll ; then + fatal "Global install should be performed first" + fi + if test -d $HOME/.recoll ; then - cat <