= Building Recoll on Microsoft Windows with MinGW Jean-Francois Dockes This document describes building a Recoll distribution, starting from a pristine Windows machine, using the http://www.mingw.org/[MinGW] port of gcc and associated tools. The resulting package only needs Python (and optionally 7-zip) to be installed on the target system. == Installing MinGW and MSYS Download the installer from http://www.mingw.org/, and run it. 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 dependancies for now, you are going to clone Bitbucket repositories. Get it from http://tortoisehg.bitbucket.org/download/index.html Then clone the repositories for https://medoc@bitbucket.org/medoc/recoll[recoll] to C:/recoll and https://medoc@bitbucket.org/medoc/recoll-windows-deps[some of the 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 Don't forget the PATH update if not done yet: export PATH=/c/qt/tools/mingw492_32/bin:$PATH Then, from an MSYS command window (see above): cd c:/temp tar xzf path-to-tar-file cd zlib-1.2.8 make -f win32/Makefile.gcc == Xapian Download from: http://oligarchy.co.uk/xapian/1.2.21/xapian-core-1.2.21.tar.xz Don't forget the PATH update if not done yet: export PATH=/c/qt/tools/mingw492_32/bin:$PATH Then: cd c:/recolldeps tar xf path-to-tar-file cd xapian-core-1.2.21 - Edit common/safeunistd.h to neutralize the sleep() function definition as this conflicts with the definition which is part of recent mingw editions. Replace the "#ifdef __WIN32__" with "#if 0". This is already fixed in later Xapian versions Then: CPPFLAGS=-I/c/temp/zlib-1.2.8 LDFLAGS=-L/c/temp/zlib-1.2.8 ./configure make == Recoll You need to use the source from the repository, there is no release supporting Windows at the moment. - If not already done, clone the recoll repository from: https://medoc@bitbucket.org/medoc/recoll to `C:/recoll` - Start `QtCreator` and open `c:/recoll/src/windows/qmkrecoll/librecoll.pro`. At the bottom of the file, you may need to fix the locations for the xapian and zlib dlls. - Build librecoll.pro - Do the same (adjust locations and build) for: c:/recoll/src/windows/qmkrecoll/rclstartw.pro c:/recoll/src/windows/qmkrecoll/recollindex.pro c:/recoll/src/windows/qmkrecoll/recollq.pro c:/recoll/src/qtgui/recoll-win.pro == Helper applications There are a number of useful files stored in a BitBucket repository, you will need to clone it on the windows machine (the final script, mkinstdir.sh, expects C:/recolldeps as a cloned location). https://medoc@bitbucket.org/medoc/recoll-windows-deps == 7-zip 7-zip is used for all decompression tasks. Install it from http://www.7-zip.org/ == Python All Recoll helper scripts (data extractors) are written in Python, and not yet compatible with Python3. You need to download and install Python 2.7 from https://www.python.org/downloads/release/python-2710/ == Python modules Some data formats need library modules not delivered as part of the base Python installation === libxml2/libxslt The precompiled binary is from : http://users.skynet.be/sbi/libxml-python/ http://users.skynet.be/sbi/libxml-python/binaries/libxml2-python-2.7.7.win32-py2.7.exe The useful parts are stored in recoll-windows-deps repo Slightly newer dlls, which should be compatible, here: https://www.zlatkovic.com/libxml.en.html This will be copied into the installation by the mkinstdir.sh script. === mutagen Download and extract mutagen from https://pypi.python.org/pypi/mutagen Then in the mutagen directory (e.g. C:/temp/mutagen-1.31 where it is expected by `mkinstdir.sh`): python setup.py build The module will be copied by mkinstdir.sh === epub Download from: http://pypi.python.org/pypi/epub/ Extract, then execute the following in the extracted directory (e.g.: `C:/temp/epub-0.5.2` which is expected by `mkinstdir.sh`): python setup.py The module will be copied by mkinstdir.sh === pyexiv2 I did not attempt a build (needs boost-python, scons). Used an installer from http://tilloy.net/dev/pyexiv2/download.html The resulting site-packages data is stored in the recolldeps repository and copied into the filters directory by the mkinstdir.sh script. == Non-Python helpers == unrtf The current unrtf sources can be built with MinGW. hg clone http://hg.savannah.gnu.org/hgweb/unrtf/ cd c:/unrtf/Windows make -f Makefile.mingw == antiword Use the source from recoll-windows-deps (C:/recolldeps/antiword) make -f Makefile.mingw. == Poppler Did not try to compile. Used the binaries from http://blog.alivate.com.au/poppler-windows/ There is a copy in the recoll-windows-deps repository, it will be copied by the mkinstdir.sh script. == libwpd We use the wpd2html tool from libwpd 0.10.0, unmodified. This depends on librevenge 0.0.1 which has been slightly modified to not depend on boost (a 500 MB install if you can believe it). Both files can be found under the libwpd directory of the recoll-windows-deps repository. mkdir c:/temp/libwpd cd c:/temp/libwpd tar xf librevenge-0.0.1.jfd.tar.gz cd librevenge-0.0.1.jfd CPPFLAGS=-I/c/temp/zlib-1.2.8 LDFLAGS=-L/c/temp/zlib-1.2.8 configure --disable-tests --without-docs make cd .. tar xf /data/source/00DISTS/libwpd-0.10.0.tar.gz cd libwpd-0.10.0 REVENGE_CFLAGS=-Ic:/temp/libwpd/librevenge-0.0.1.jfd/inc \ REVENGE_LIBS="-Lc:/temp/libwpd/librevenge-0.0.1.jfd/src/lib/.libs -lrevenge-0.0" \ REVENGE_GENERATORS_CFLAGS=-Ic:/temp/libwpd/librevenge-0.0.1.jfd/inc \ REVENGE_GENERATORS_LIBS="-Lc:/temp/libwpd/librevenge-0.0.1.jfd/src/lib/.libs -lrevenge-generators-0.0" \ REVENGE_STREAM_CFLAGS=-Ic:/temp/libwpd/librevenge-0.0.1.jfd/inc \ REVENGE_STREAM_LIBS="-Lc:/temp/libwpd/librevenge-0.0.1.jfd/src/lib/.libs -lrevenge-stream-0.0" \ configure --without-docs make == chm This build uses a slightly modified pychm python modules: for simplification, the relevant C files from chmlib were included in the python module itself (in addition to its own C extension file). The source package is inside the recoll-windows-deps repository as pychm-0.8.4.1-git.tar.gz. The build result is also stored, and will be used directly by the install building script, so the following instructions are for reference. To build the pychm module: cd c:/temp tar xf pychm-0.8.4.1-git.tar.gz cd pychm-0.8.4.1-git python setup.py build Will probably complain about a missing vc++ compiler, and indicate where to download VC++ for Python 2.7 (an official Microsoft location). Do it, then repeat the command: python setup.py build python setup.py bdist This creates a zip file inside the dist subdirectory. The contents of this zip are extracted and the chm/ directory is stored in the recoll-windows-deps repo for convenience (under pychm/chm) and copied to the recoll install dir by the install script. == Building the install directory Once the builds above are performed, edit the mkinstdir.sh script to adjust the locations, and use it to build the installation directory. The innosetup script expects it to be c:/install/recoll == Building the setup executable Install Inno Setup and use src/windows/recoll-setup.iss to generate the installation executable.