From a02a611694b1b3fefd2a0e06ff0d56af7fbcc9f1 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 13 Oct 2015 10:00:48 +0200 Subject: [PATCH] let filter 'which' find a command in a specified subdir of PATH elements --- src/filters/rclexecm.py | 26 +++++++++++++++++++++----- website/pages/recoll-mingw.txt | 29 +++++++++++++++++++---------- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/filters/rclexecm.py b/src/filters/rclexecm.py index 700e540e..adcb54e5 100644 --- a/src/filters/rclexecm.py +++ b/src/filters/rclexecm.py @@ -226,6 +226,14 @@ class RclExecM: # Helper routine to test for program accessibility +# Note that this works a bit differently from Linux 'which', which +# won't search the PATH if there is a path part in the program name, +# even if not absolute (e.g. will just try subdir/cmd in current +# dir). We will find such a command if it exists in a matching subpath +# of any PATH element. +# This is very useful esp. on Windows so that we can have several bin +# filter directories under filters (to avoid dll clashes). The +# corresponding c++ routine in recoll execcmd works the same. def which(program): def is_exe(fpath): return os.path.exists(fpath) and os.access(fpath, os.X_OK) @@ -242,9 +250,8 @@ def which(program): yield path for path in os.environ["PATH"].split(os.pathsep): yield path - - fpath, fname = os.path.split(program) - if fpath: + + if os.path.isabs(program): if is_exe(program): return program else: @@ -296,7 +303,9 @@ def main(proto, extract): # Not running the main loop: either acting as single filter (when called # from other filter for example), or debugging def usage(): - print("Usage: rclexecm.py [-d] [-s] [-i ipath] [filename]", + print("Usage: rclexecm.py [-d] [-s] [-i ipath] ", + file=sys.stderr) + print(" rclexecm.py -w ", file=sys.stderr) sys.exit(1) @@ -305,7 +314,7 @@ def main(proto, extract): ipath = "" args = sys.argv[1:] - opts, args = getopt.getopt(args, "hdsi:") + opts, args = getopt.getopt(args, "hdsi:w:") for opt, arg in opts: if opt in ['-h']: usage() @@ -313,6 +322,13 @@ def main(proto, extract): actAsSingle = True elif opt in ['-i']: ipath = arg + elif opt in ['-w']: + ret = which(arg) + if ret: + print("%s" % ret) + sys.exit(0) + else: + sys.exit(1) elif opt in ['-d']: debugDumpData = True else: diff --git a/website/pages/recoll-mingw.txt b/website/pages/recoll-mingw.txt index 061dceba..7de905d2 100644 --- a/website/pages/recoll-mingw.txt +++ b/website/pages/recoll-mingw.txt @@ -15,6 +15,12 @@ In the following, a number of commands will use a command window with an MinGW environment. This can be easily created by executing C:\MinGW\msys\1.0\msys.bat from File Explorer. +Note: you should take care to use the gcc compiler which comes with Qt for +all the following builds. For this, you will want to execute the following +command in the command window: + + export PATH=c:/qt/tools/mingw492_32/bin:$PATH + == Tortoise HG This is needed because there is no source package for recoll or its @@ -30,15 +36,26 @@ dependancies] to C:/recolldeps You can change the target names, but there will be more script editing later on then (nothing much). +== Qt + +Download and install Qt 5.5.x (mingw version) from: http://www.qt.io/download/ + +Note: it is not possible to build a static webkit, so the installation is +necessarily dynamic, which means that the Qt DLLS will need to be copied +into the installation directory. This is done by the installation-building +script (using `windeployqt`) + + == zlib Download from http://zlib.net/zlib-1.2.8.tar.gz Then, from an MSYS command window (see above): cd c:/temp + export PATH=c:/qt/tools/mingw492_32/bin:$PATH tar xzf path-to-tar-file cd zlib-1.2.8 - make -f Win32/Makefile.gcc + make -f win32/Makefile.gcc == Xapian @@ -56,18 +73,10 @@ http://oligarchy.co.uk/xapian/1.2.21/xapian-core-1.2.21.tar.xz Then: + export PATH=c:/qt/tools/mingw492_32/bin:$PATH CPPFLAGS=-IC:/temp/zlib-1.2.8 LDFLAGS=-Lc:/temp/zlib-1.2.8 ./configure make -== Qt - -Download and install Qt 5.5.x (mingw version) from: http://www.qt.io/download/ - -Note: it is not possible to build a static webkit, so the installation is -necessarily dynamic, which means that the Qt DLLS will need to be copied -into the installation directory. This is done by the installation-building -script (using `windeployqt`) - == Recoll You need to use the source from the repository, there is no release