Windows: small changes for porting back from msvc to mingw

This commit is contained in:
Jean-Francois Dockes 2020-04-07 09:40:00 +02:00
parent d85bf0ba41
commit 32ebd65ba8
6 changed files with 44 additions and 33 deletions

View File

@ -24,6 +24,7 @@
# #
import sys import sys
import os
from io import BytesIO from io import BytesIO
import subprocess import subprocess
@ -48,14 +49,18 @@ def metafields(summaryinfo):
# Extractor class. We use hwp summaryinfo to extract metadata and code # Extractor class. We use hwp summaryinfo to extract metadata and code
# extracted from hwp.hwp5txt.py to extract the text. # extracted from hwp.hwp5txt.py to extract the text.
class HWP5Dump(RclBaseHandler): class HWP5Dump(RclBaseHandler):
def __init__(self, em): def __init__(self, em, td):
self.execdir = td
super(HWP5Dump, self).__init__(em) super(HWP5Dump, self).__init__(em)
def html_text(self, fn): def html_text(self, fn):
# hwp wants str filenames. This is unfortunate # hwp wants str filenames. This is unfortunate
fn = fn.decode('utf-8') fn = fn.decode('utf-8')
try:
hwpfile = fs_Hwp5File(fn) hwpfile = fs_Hwp5File(fn)
except Exception as ex:
self.em.rclog("hwpfile open failed: %s" % ex)
raise ex
try: try:
tt = hwpfile.summaryinfo.title.strip() tt = hwpfile.summaryinfo.title.strip()
if tt: if tt:
@ -78,10 +83,13 @@ class HWP5Dump(RclBaseHandler):
# the hwp5 module (no subproc). But this apparently mishandled # the hwp5 module (no subproc). But this apparently mishandled
# tables. Switched to executing hwp5html instead. See 1st git # tables. Switched to executing hwp5html instead. See 1st git
# version for the old approach. # version for the old approach.
html = subprocess.check_output(["hwp5html", "--html", fn]) cmd = [sys.executable, os.path.join(self.execdir, "hwp5html"),
"--html", fn]
html = subprocess.check_output(cmd)
return html return html
if __name__ == '__main__': if __name__ == '__main__':
execdir = os.path.dirname(sys.argv[0])
proto = rclexecm.RclExecM() proto = rclexecm.RclExecM()
extract = HWP5Dump(proto) extract = HWP5Dump(proto, execdir)
rclexecm.main(proto, extract) rclexecm.main(proto, extract)

View File

@ -5,10 +5,10 @@ TEMPLATE = app
LANGUAGE = C++ LANGUAGE = C++
TARGET = recoll TARGET = recoll
#QT += webkit DEFINES += USING_WEBKIT
#DEFINES += USING_WEBKIT QT += webkit webkitwidgets
QT += widgets webenginewidgets #QT += widgets webenginewidgets
DEFINES += USING_WEBENGINE #DEFINES += USING_WEBENGINE
QT += xml printsupport QT += xml printsupport
@ -119,7 +119,7 @@ windows {
contains(QMAKE_CC, cl){ contains(QMAKE_CC, cl){
# MSVC # MSVC
RECOLLDEPS = ../../../recolldeps-vc RECOLLDEPS = ../../../recolldeps/msvc
DEFINES += USING_STATIC_LIBICONV DEFINES += USING_STATIC_LIBICONV
LIBS += \ LIBS += \
-L../windows/build-librecoll-Desktop_Qt_5_14_1_MSVC2017_32bit-Release/release \ -L../windows/build-librecoll-Desktop_Qt_5_14_1_MSVC2017_32bit-Release/release \

View File

@ -22,8 +22,8 @@ test -d $DESTDIR || mkdir $DESTDIR || fatal cant create $DESTDIR
################################ ################################
# Local values (to be adjusted) # Local values (to be adjusted)
BUILD=MSVC #BUILD=MSVC
#BUILD=MINGW BUILD=MINGW
if test $BUILD = MSVC ; then if test $BUILD = MSVC ; then
# Recoll src tree # Recoll src tree
@ -36,17 +36,19 @@ if test $BUILD = MSVC ; then
LIBICONV=${RCLDEPS}/msvc/build-libiconv-${QTA}/libiconv.dll LIBICONV=${RCLDEPS}/msvc/build-libiconv-${QTA}/libiconv.dll
ZLIB=${RCLDEPS}/msvc/zlib-1.2.11 ZLIB=${RCLDEPS}/msvc/zlib-1.2.11
QTBIN=C:/Qt/5.14.1/msvc2017/bin QTBIN=C:/Qt/5.14.1/msvc2017/bin
MINGWBIN=c:/Qt/5.14.1/mingw73_32/bin/
else else
# Recoll src tree # Recoll src tree
RCL=c:/recoll/src/ RCL=c:/recoll/src/
# Recoll dependancies # Recoll dependancies
RCLDEPS=c:/recolldeps/ RCLDEPS=c:/recolldeps/
QTA=Desktop_Qt_5_8_0_MinGW_32bit/release QTA=Desktop_Qt_5_8_0_MinGW_32bit-Release/release
LIBXAPIAN=${RCLDEPS}/mingw/xapian-core-1.4.11/.libs/libxapian-30.dll LIBXAPIAN=${RCLDEPS}/mingw/xapian-core-1.4.11/.libs/libxapian-30.dll
ZLIB=${RCLDEPS}/mingw/zlib-1.2.8 ZLIB=${RCLDEPS}/mingw/zlib-1.2.8
ASPELL=${RCLDEPS}/mingw/aspell-0.60.7/aspell-installed ASPELL=${RCLDEPS}/mingw/aspell-0.60.7/aspell-installed
QTGCCBIN=C:/qt/Qt5.8.0/Tools/mingw530_32/bin/ QTGCCBIN=C:/qt/Qt5.8.0/Tools/mingw530_32/bin/
QTBIN=C:/Qt/Qt5.8.0/5.8/mingw53_32/bin QTBIN=C:/Qt/Qt5.8.0/5.8/mingw53_32/bin
MINGWBIN=$QTBIN
PATH=$MINGWBIN:$QTGCCBIN:$PATH PATH=$MINGWBIN:$QTGCCBIN:$PATH
export PATH export PATH
fi fi
@ -54,8 +56,7 @@ fi
# Where to find libgcc_s_dw2-1.dll et all for progs compiled with # Where to find libgcc_s_dw2-1.dll et all for progs compiled with
# c:/MinGW (as opposed to the mingw bundled with qt). This is the same # c:/MinGW (as opposed to the mingw bundled with qt). This is the same
# for either a msvc or mingw build of recoll itself. # for either a msvc or mingw build of recoll itself.
MINGWBIN=C:/MinGW/bin #MINGWBIN=C:/MinGW/bin
MINGWBIN=c:/Qt/5.14.1/mingw73_32/bin/
RCLW=$RCL/windows/ RCLW=$RCL/windows/
# Only used for mingw, the msvc one is static # Only used for mingw, the msvc one is static
@ -129,6 +130,7 @@ copypython()
mkdir -p $DESTDIR/Share/filters/python mkdir -p $DESTDIR/Share/filters/python
cp -rp $PYTHON/* $DESTDIR/Share/filters/python cp -rp $PYTHON/* $DESTDIR/Share/filters/python
chkcp $PYTHON/python.exe $DESTDIR/Share/filters/python/python.exe chkcp $PYTHON/python.exe $DESTDIR/Share/filters/python/python.exe
chkcp $MISC/hwp5html $FILTERS
} }
copyrecoll() copyrecoll()

View File

@ -138,28 +138,28 @@ windows {
RECOLLDEPS = C:/recolldeps RECOLLDEPS = C:/recolldeps
QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter
LIBS += \ LIBS += \
$$RECOLLDEPS/libxslt/libxslt-1.1.29/win32/bin.mingw/libxslt.a \ $$RECOLLDEPS/mingw/libxslt/libxslt-1.1.29/win32/bin.mingw/libxslt.a \
$$RECOLLDEPS/libxml2/libxml2-2.9.4+dfsg1/win32/bin.mingw/libxml2.a \ $$RECOLLDEPS/mingw/libxml2/libxml2-2.9.4+dfsg1/win32/bin.mingw/libxml2.a \
$$RECOLLDEPS/xapian-core-1.4.11/.libs/libxapian-30.dll \ $$RECOLLDEPS/mingw/xapian-core-1.4.11/.libs/libxapian-30.dll \
$$RECOLLDEPS/zlib-1.2.8/zlib1.dll \ $$RECOLLDEPS/mingw/zlib-1.2.8/zlib1.dll \
-liconv -lshlwapi -lpsapi -lkernel32 -liconv -lshlwapi -lpsapi -lkernel32
INCLUDEPATH += ../../windows \ INCLUDEPATH += ../../windows \
$$RECOLLDEPS/xapian-core-1.4.15/include \ $$RECOLLDEPS/mingw/xapian-core-1.4.11/include \
$$RECOLLDEPS/libxslt/libxslt-1.1.29/ \ $$RECOLLDEPS/mingw/libxslt/libxslt-1.1.29/ \
$$RECOLLDEPS/libxml2/libxml2-2.9.4+dfsg1/include $$RECOLLDEPS/mingw/libxml2/libxml2-2.9.4+dfsg1/include
} }
contains(QMAKE_CC, cl){ contains(QMAKE_CC, cl){
# Visual Studio # MSVC
RECOLLDEPS = ../../../../recolldeps-vc RECOLLDEPS = ../../../../recolldeps
CONFIG += staticlib CONFIG += staticlib
DEFINES += USING_STATIC_LIBICONV DEFINES += USING_STATIC_LIBICONV
INCLUDEPATH += ../../windows \ INCLUDEPATH += ../../windows \
$$RECOLLDEPS/xapian-core-1.4.15/include \ $$RECOLLDEPS/msvc/xapian-core-1.4.15/include \
$$RECOLLDEPS/zlib-1.2.11/ \ $$RECOLLDEPS/msvc/zlib-1.2.11/ \
$$RECOLLDEPS/libxslt/libxslt-1.1.29/ \ $$RECOLLDEPS/msvc/libxslt/libxslt-1.1.29/ \
$$RECOLLDEPS/libxml2/libxml2-2.9.4+dfsg1/include \ $$RECOLLDEPS/msvc/libxml2/libxml2-2.9.4+dfsg1/include \
$$RECOLLDEPS/wlibiconv/include $$RECOLLDEPS/msvc/wlibiconv/include
QMAKE_CXXFLAGS_WARN_ON -= -w34100 QMAKE_CXXFLAGS_WARN_ON -= -w34100
QMAKE_CXXFLAGS += -wd4100 QMAKE_CXXFLAGS += -wd4100
} }

View File

@ -27,12 +27,13 @@ windows {
# MingW # MingW
QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter
LIBS += \ LIBS += \
C:/recoll/src/windows/build-librecoll-Desktop_Qt_5_8_0_MinGW_32bit-Release/release/librecoll.dll \ ../build-librecoll-Desktop_Qt_5_8_0_MinGW_32bit-Release/release/librecoll.dll \
-lshlwapi -lpsapi -lkernel32 -lshlwapi -lpsapi -lkernel32
} }
contains(QMAKE_CC, cl){ contains(QMAKE_CC, cl){
# MSVC # MSVC
RECOLLDEPS = ../../../../recolldeps-vc RECOLLDEPS = ../../../../recolldeps/msvc
DEFINES += USING_STATIC_LIBICONV DEFINES += USING_STATIC_LIBICONV
LIBS += \ LIBS += \
-L../build-librecoll-Desktop_Qt_5_14_1_MSVC2017_32bit-Release/release \ -L../build-librecoll-Desktop_Qt_5_14_1_MSVC2017_32bit-Release/release \

View File

@ -23,7 +23,7 @@ windows {
MingW MingW
QMAKE_CXXFLAGS += -std=c++11 -Wno-unused-parameter QMAKE_CXXFLAGS += -std=c++11 -Wno-unused-parameter
LIBS += \ LIBS += \
C:/recoll/src/windows/build-librecoll-Desktop_Qt_5_8_0_MinGW_32bit-Release/release/librecoll.dll \ ../build-librecoll-Desktop_Qt_5_8_0_MinGW_32bit-Release/release/librecoll.dll \
-lshlwapi -lpsapi -lkernel32 -lshlwapi -lpsapi -lkernel32
} }
contains(QMAKE_CC, cl){ contains(QMAKE_CC, cl){