diff --git a/src/common/autoconfig-mac.h b/src/common/autoconfig-mac.h new file mode 100644 index 00000000..2bc2d0ef --- /dev/null +++ b/src/common/autoconfig-mac.h @@ -0,0 +1,196 @@ +/* common/autoconfig.h. Generated from autoconfig.h.in by configure. */ +/* common/autoconfig.h.in. Generated from configure.ac by autoheader. */ +// +// This is only used on the mac when building with the .pro +// qcreator/qmake files (not for Macports or homebrew where we go the +// unix way (create autoconfig.h with configure). Copy to autoconfig.h +// before the build. +// + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Path to the aspell api include file */ +#define ASPELL_INCLUDE "../aspell/aspell-local.h" + +/* Path to the aspell program */ +#define ASPELL_PROG "/opt/local/bin/aspell" + +/* No X11 session monitoring support */ +#define DISABLE_X11MON 1 + +/* Path to the fam api include file */ +/* #undef FAM_INCLUDE */ + +/* Path to the file program */ +#define FILE_PROG "/usr/bin/file" + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* dlopen function is available */ +#define HAVE_DLOPEN 1 + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `kqueue' function. */ +#define HAVE_KQUEUE 1 + +/* Define to 1 if you have the `chm' library (-lchm). */ +/* #undef HAVE_LIBCHM */ + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#define HAVE_LIBPTHREAD 1 + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MALLOC_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_MALLOC_H 1 + +/* Define to 1 if you have the `malloc_trim' function. */ +/* #undef HAVE_MALLOC_TRIM */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdtemp' function. */ +#define HAVE_MKDTEMP 1 + +/* Define to 1 if you have the `posix_spawn' function. */ +#define HAVE_POSIX_SPAWN 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SPAWN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MOUNT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PARAM_H_ */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATFS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VFS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* Use multiple threads for indexing */ +/* #undef IDX_THREADS */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "Recoll" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "Recoll 1.28.6pre4" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "recoll" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.28.6pre4" + +/* putenv parameter is const */ +/* #undef PUTENV_ARG_CONST */ + +/* Real time monitoring option */ +/* #undef RCL_MONITOR */ + +/* Split camelCase words */ +/* #undef RCL_SPLIT_CAMELCASE */ + +/* Compile the aspell interface */ +#define RCL_USE_ASPELL 1 + +/* Compile the fam interface */ +/* #undef RCL_USE_FAM */ + +/* Compile the inotify interface */ +/* #undef RCL_USE_INOTIFY */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Use posix_spawn() */ +/* #undef USE_POSIX_SPAWN */ + +/* Enable using the system's 'file' command to id mime if we fail internally + */ +#define USE_SYSTEM_FILE_COMMAND 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +#include "conf_post.h" diff --git a/src/common/rclinit.cpp b/src/common/rclinit.cpp index 80e716f1..7512836f 100644 --- a/src/common/rclinit.cpp +++ b/src/common/rclinit.cpp @@ -273,7 +273,7 @@ RclConfig *recollinit(int flags, if (cleanup) atexit(cleanup); -#if defined(MACPORTS) || defined(HOMEBREW) +#ifdef __APPLE__ // The MACPORTS and HOMEBREW flags are set by the resp. portfile // and recipee @@ -288,9 +288,15 @@ RclConfig *recollinit(int flags, PATH = string("/opt/local/bin/") + ":" + PATH; #elif defined(HOMEBREW) PATH = string("/usr/local/bin/") + ":" + PATH; +#else + // Native qt build. Add our own directory to the path so that + // recoll finds recollindex + // pkgdatadir: /Applications/recoll.app/Contents/Resources + std::string exedir = path_cat(path_getfather(path_pkgdatadir()), "MacOS"); + PATH = exedir + ":" + PATH; #endif setenv("PATH", PATH.c_str(), 1); -#endif +#endif /* __APPLE__ */ // Make sure the locale is set. This is only for converting file names // to utf8 for indexing. diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index 82a758dc..0dd1cd28 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -553,7 +553,9 @@ static void flushIdxReasons() // enable wmain. Another workaround is to use main, then call // GetCommandLineW and CommandLineToArgvW, to then call wmain(). If // ever we need to build with mingw again. -#define USE_WMAIN (defined(_WIN32) && defined(_MSC_VER)) +#if defined(_WIN32) && defined(_MSC_VER) +#define USE_WMAIN 1 +#endif #if USE_WMAIN #define WARGTOSTRING(w) wchartoutf8(w) diff --git a/src/qtgui/recoll-win.pro b/src/qtgui/recoll-win.pro index 97f53a73..f38391e0 100644 --- a/src/qtgui/recoll-win.pro +++ b/src/qtgui/recoll-win.pro @@ -13,15 +13,12 @@ DEFINES += USING_WEBENGINE QT += xml printsupport DEFINES += BUILDING_RECOLL -DEFINES += PSAPI_VERSION=1 -DEFINES += __WIN32__ HEADERS += \ advsearch_w.h \ advshist.h \ confgui/confgui.h \ confgui/confguiindex.h \ - winschedtool.h \ widgets/editdialog.h \ firstidx.h \ fragbuts.h \ @@ -36,6 +33,7 @@ HEADERS += \ rclmain_w.h \ reslist.h \ restable.h \ + scbase.h \ searchclause_w.h \ snippets_w.h \ specialindex.h \ @@ -51,7 +49,6 @@ SOURCES += \ advshist.cpp \ confgui/confgui.cpp \ confgui/confguiindex.cpp \ - winschedtool.cpp \ fragbuts.cpp \ guiutils.cpp \ main.cpp \ @@ -72,6 +69,7 @@ SOURCES += \ respopup.cpp \ reslist.cpp \ restable.cpp \ + scbase.cpp \ searchclause_w.cpp \ snippets_w.cpp \ spell_w.cpp \ @@ -85,7 +83,6 @@ SOURCES += \ FORMS = \ advsearch.ui \ - winschedtool.ui \ widgets/editdialog.ui \ firstidx.ui \ idxsched.ui \ @@ -108,8 +105,18 @@ INCLUDEPATH += ../common ../index ../internfile ../query ../unac \ ../utils ../aspell ../rcldb ../qtgui ../xaposix \ confgui widgets windows { + DEFINES += PSAPI_VERSION=1 + DEFINES += __WIN32__ DEFINES += UNICODE RC_FILE = recoll.rc + + HEADERS += \ + winschedtool.h + SOURCES += \ + winschedtool.cpp + FORMS += \ + winschedtool.ui + contains(QMAKE_CC, gcc){ # MingW QMAKE_CXXFLAGS += -std=c++11 -Wno-unused-parameter @@ -135,6 +142,178 @@ windows { } } +mac { + QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter + + HEADERS += \ + crontool.h \ + rtitool.h + + SOURCES += \ + ../utils/closefrom.cpp \ + ../utils/execmd.cpp \ + ../utils/netcon.cpp \ + ../utils/rclionice.cpp \ + crontool.cpp \ + rtitool.cpp + + FORMS += \ + crontool.ui \ + rtitool.ui + + LIBS += \ +../windows/build-librecoll-Desktop_Qt_5_14_2_clang_64bit-Release/liblibrecoll.a \ + ../../../xapian-core-1.4.18/.libs/libxapian.a \ + -lxslt -lxml2 -liconv -lz + + ICON = images/recoll.icns + + APP_EXAMPLES.files = \ + ../sampleconf/fragbuts.xml \ + ../sampleconf/fields \ + ../sampleconf/recoll.conf \ + ../sampleconf/mimeconf \ + ../sampleconf/recoll.qss \ + ../sampleconf/recoll-dark.qss \ + ../sampleconf/recoll-dark.css \ + ../sampleconf/mimemap \ + ../sampleconf/mimeview + APP_EXAMPLES.path = Contents/Resources/examples + + APP_FILTERS.files = \ + ../filters/abiword.xsl \ + ../filters/cmdtalk.py \ + ../filters/fb2.xsl \ + ../filters/gnumeric.xsl \ + ../filters/kosplitter.py \ + ../filters/msodump.zip \ + ../filters/okular-note.xsl \ + ../filters/opendoc-body.xsl \ + ../filters/opendoc-flat.xsl \ + ../filters/opendoc-meta.xsl \ + ../filters/openxml-xls-body.xsl \ + ../filters/openxml-word-body.xsl \ + ../filters/openxml-meta.xsl \ + ../filters/ppt-dump.py \ + ../filters/rcl7z \ + ../filters/rclaptosidman \ + ../filters/rclaudio \ + ../filters/rclbasehandler.py \ + ../filters/rclbibtex.sh \ + ../filters/rclcheckneedretry.sh \ + ../filters/rclchm \ + ../filters/rcldia \ + ../filters/rcldjvu.py \ + ../filters/rcldoc.py \ + ../filters/rcldvi \ + ../filters/rclepub \ + ../filters/rclepub1 \ + ../filters/rclexec1.py \ + ../filters/rclexecm.py \ + ../filters/rclfb2.py \ + ../filters/rclgaim \ + ../filters/rclgenxslt.py \ + ../filters/rclhwp.py \ + ../filters/rclics \ + ../filters/rclimg \ + ../filters/rclimg.py \ + ../filters/rclinfo \ + ../filters/rclkar \ + ../filters/rclkwd \ + ../filters/rcllatinclass.py \ + ../filters/rcllatinstops.zip \ + ../filters/rcllyx \ + ../filters/rclman \ + ../filters/rclmidi.py \ + ../filters/rclocrcache.py \ + ../filters/rclocr.py \ + ../filters/rclocrabbyy.py \ + ../filters/rclocrtesseract.py \ + ../filters/rclopxml.py \ + ../filters/rclpdf.py \ + ../filters/rclppt.py \ + ../filters/rclps \ + ../filters/rclpst.py \ + ../filters/rclpurple \ + ../filters/rclpython.py \ + ../filters/rclrar \ + ../filters/rclrtf.py \ + ../filters/rclscribus \ + ../filters/rclshowinfo \ + ../filters/rcltar \ + ../filters/rcltex \ + ../filters/rcltext.py \ + ../filters/rcluncomp \ + ../filters/rcluncomp.py \ + ../filters/rclwar \ + ../filters/rclxls.py \ + ../filters/rclxml.py \ + ../filters/rclxmp.py \ + ../filters/rclxslt.py \ + ../filters/rclzip \ + ../filters/recoll-we-move-files.py \ + ../filters/recollepub.zip \ + ../filters/svg.xsl \ + ../filters/xls-dump.py \ + ../filters/xlsxmltocsv.py \ + ../filters/xml.xsl \ + ../python/recoll/recoll/conftree.py \ + ../python/recoll/recoll/rclconfig.py + APP_FILTERS.path = Contents/Resources/filters + + APP_IMAGES.files = \ + images/asearch.png \ + images/cancel.png \ + images/close.png \ + images/clock.png \ + images/menu.png \ + images/code-block.png \ + images/down.png \ + images/firstpage.png \ + images/history.png \ + images/interro.png \ + images/nextpage.png \ + images/prevpage.png \ + images/recoll.icns \ + images/recoll.png \ + images/sortparms.png \ + images/spell.png \ + images/table.png \ + images/up.png \ + mtpics/License_sidux.txt \ + mtpics/README \ + mtpics/aptosid-book.png \ + mtpics/aptosid-manual-copyright.txt \ + mtpics/aptosid-manual.png \ + mtpics/archive.png \ + mtpics/book.png \ + mtpics/bookchap.png \ + mtpics/document.png \ + mtpics/drawing.png \ + mtpics/emblem-symbolic-link.png \ + mtpics/folder.png \ + mtpics/html.png \ + mtpics/image.png \ + mtpics/message.png \ + mtpics/mozilla_doc.png \ + mtpics/pdf.png \ + mtpics/pidgin.png \ + mtpics/postscript.png \ + mtpics/presentation.png \ + mtpics/sidux-book.png \ + mtpics/soffice.png \ + mtpics/source.png \ + mtpics/sownd.png \ + mtpics/spreadsheet.png \ + mtpics/text-x-python.png \ + mtpics/txt.png \ + mtpics/video.png \ + mtpics/wordprocessing.png + APP_IMAGES.path = Contents/Resources/images + + QMAKE_BUNDLE_DATA = APP_EXAMPLES APP_FILTERS APP_IMAGES +} + TRANSLATIONS = \ i18n/recoll_cs.ts \ i18n/recoll_da.ts \ diff --git a/src/utils/rclutil.cpp b/src/utils/rclutil.cpp index 5840a078..5d0b18cc 100644 --- a/src/utils/rclutil.cpp +++ b/src/utils/rclutil.cpp @@ -31,6 +31,9 @@ #include #include #endif +#ifdef __APPLE__ +#include +#endif #include #include #include @@ -256,7 +259,7 @@ const string& path_pkgdatadir() return datadir; } -#ifdef _WIN32 +#if defined(_WIN32) // Try a path relative with the exec. This works if we are // recoll/recollindex etc. // But maybe we are the python module, and execpath is the python @@ -276,6 +279,12 @@ const string& path_pkgdatadir() "a subfolder of the installation directory. \n" "Please set the RECOLL_DATADIR environment variable to point to it\n" "(e.g. setx RECOLL_DATADIR \"C:/Program Files (X86)/Recoll/Share)\"\n"; +#elif defined(__APPLE__) && !defined(MACPORTS) && !defined(HOMEBREW) + uint32_t size = 0; + _NSGetExecutablePath(nullptr, &size); + char *path= (char*)malloc(size+1); + _NSGetExecutablePath(path, &size); + datadir = path_cat(path_getfather(path_getfather(path)), "Resources"); #else // If not in environment, use the compiled-in constant. datadir = RECOLL_DATADIR; diff --git a/src/windows/qmkrecoll/librecoll.pro b/src/windows/qmkrecoll/librecoll.pro index 9374a32f..7fe4d443 100644 --- a/src/windows/qmkrecoll/librecoll.pro +++ b/src/windows/qmkrecoll/librecoll.pro @@ -10,14 +10,9 @@ TARGET = librecoll TEMPLATE = lib DEFINES += LIBRECOLL_LIBRARY BUILDING_RECOLL -DEFINES += PSAPI_VERSION=1 DEFINES += READFILE_ENABLE_MINIZ DEFINES += READFILE_ENABLE_MD5 DEFINES += READFILE_ENABLE_ZLIB -# VC only defines __WIN32, not __WIN32__ . For some reason xapian uses -# __WIN32__ which it actually defines in conf_post.h if __WIN32 is -# set. Reason: mystery. -DEFINES += __WIN32__ SOURCES += \ ../../aspell/rclaspell.cpp \ @@ -104,9 +99,6 @@ SOURCES += \ ../../utils/utf8iter.cpp \ ../../utils/zlibut.cpp \ ../../utils/zlibut.h \ -../../windows/execmd_w.cpp \ -../../windows/fnmatch.c \ -../../windows/wincodepages.cpp \ ../../utils/fileudi.cpp \ ../../utils/fstreewalk.cpp \ ../../utils/hldata.cpp \ @@ -123,15 +115,26 @@ SOURCES += \ ../../utils/smallut.cpp \ ../../utils/strmatcher.cpp \ ../../utils/transcode.cpp \ -../../utils/wipedir.cpp \ -../../windows/strptime.cpp +../../utils/wipedir.cpp INCLUDEPATH += ../../common ../../index ../../internfile ../../query \ ../../unac ../../utils ../../aspell ../../rcldb ../../qtgui \ ../../xaposix ../../confgui ../../bincimapmime windows { + # VC only defines __WIN32, not __WIN32__ . For some reason xapian uses + # __WIN32__ which it actually defines in conf_post.h if __WIN32 is + # set. Reason: mystery. + DEFINES += __WIN32__ + DEFINES += PSAPI_VERSION=1 defines += UNICODE + + SOURCES += \ + ../../windows/execmd_w.cpp \ + ../../windows/fnmatch.c \ + ../../windows/wincodepages.cpp \ + ../../windows/strptime.cpp + contains(QMAKE_CC, gcc){ # MingW # This is necessary to avoid an undefined impl__xmlFree. @@ -166,7 +169,18 @@ windows { } -unix { +unix:!mac { target.path = /usr/lib INSTALLS += target } + +mac { + CONFIG += staticlib + # This is necessary to avoid an undefined impl__xmlFree. + # See comment in libxml/xmlexports.h + DEFINES += LIBXML_STATIC + RECOLLDEPS = /Users/dockes/Recoll + QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter + INCLUDEPATH += \ + $$RECOLLDEPS/xapian-core-1.4.18/include +} diff --git a/src/windows/qmkrecoll/recollindex.pro b/src/windows/qmkrecoll/recollindex.pro index 81c77bc4..b7b9c056 100644 --- a/src/windows/qmkrecoll/recollindex.pro +++ b/src/windows/qmkrecoll/recollindex.pro @@ -7,10 +7,6 @@ CONFIG -= app_bundle TEMPLATE = app DEFINES += BUILDING_RECOLL -DEFINES += UNICODE -DEFINES += PSAPI_VERSION=1 -DEFINES += RCL_MONITOR -DEFINES += __WIN32__ SOURCES += \ ../../index/recollindex.cpp \ @@ -23,10 +19,14 @@ INCLUDEPATH += ../../common ../../index ../../internfile ../../query \ ../../xaposix ../../confgui ../../bincimapmime windows { - contains(QMAKE_CC, gcc){ - # MingW - QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter - LIBS += \ + DEFINES += UNICODE + DEFINES += PSAPI_VERSION=1 + DEFINES += RCL_MONITOR + DEFINES += __WIN32__ + contains(QMAKE_CC, gcc){ + # MingW + QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter + LIBS += \ ../build-librecoll-Desktop_Qt_5_8_0_MinGW_32bit-Release/release/librecoll.dll \ -lshlwapi -lpsapi -lkernel32 } @@ -51,3 +51,17 @@ windows { INCLUDEPATH += ../../windows } + +mac { + QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter + SOURCES += \ + ../../utils/closefrom.cpp \ + ../../utils/execmd.cpp \ + ../../utils/netcon.cpp \ + ../../utils/rclionice.cpp + + LIBS += \ + ../build-librecoll-Desktop_Qt_5_14_2_clang_64bit-Release/liblibrecoll.a \ + ../../../../xapian-core-1.4.18/.libs/libxapian.a \ + -lxslt -lxml2 -liconv -lz +} diff --git a/src/windows/qmkrecoll/recollq.pro b/src/windows/qmkrecoll/recollq.pro index a49183f4..cc91d078 100644 --- a/src/windows/qmkrecoll/recollq.pro +++ b/src/windows/qmkrecoll/recollq.pro @@ -7,9 +7,6 @@ CONFIG -= app_bundle TEMPLATE = app DEFINES += BUILDING_RECOLL -DEFINES += UNICODE -DEFINES += PSAPI_VERSION=1 -DEFINES += __WIN32__ SOURCES += \ ../../query/recollqmain.cpp @@ -19,6 +16,9 @@ INCLUDEPATH += ../../common ../../index ../../internfile ../../query \ ../../xaposix ../../confgui ../../bincimapmime windows { + DEFINES += UNICODE + DEFINES += PSAPI_VERSION=1 + DEFINES += __WIN32__ contains(QMAKE_CC, gcc){ MingW QMAKE_CXXFLAGS += -std=c++11 -Wno-unused-parameter @@ -45,3 +45,16 @@ windows { INCLUDEPATH += ../../windows } + +mac { + QMAKE_CXXFLAGS += -std=c++11 -pthread -Wno-unused-parameter + SOURCES += \ + ../../utils/closefrom.cpp \ + ../../utils/execmd.cpp \ + ../../utils/netcon.cpp \ + ../../utils/rclionice.cpp + LIBS += \ + ../build-librecoll-Desktop_Qt_5_14_2_clang_64bit-Release/liblibrecoll.a \ + ../../../../xapian-core-1.4.18/.libs/libxapian.a \ + -lxslt -lxml2 -liconv -lz +}