From 412dd857b81471277e1014b6329f46a389a42cb3 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 3 Apr 2020 15:39:37 +0200 Subject: [PATCH] Compile QRegularExpression into qmake This is required to be able to port qmake over to use QRegularExpression instead of QRegExp. Change-Id: I0ad2c19bf3c0a28e52c1e12b4d3daa0300a75ed2 Reviewed-by: Joerg Bornemann --- configure | 13 ++- qmake/.prev_CMakeLists.txt | 39 +++++++ qmake/CMakeLists.txt | 37 +++++++ qmake/Makefile.unix | 126 +++++++++++++++++++++- qmake/Makefile.unix.mingw | 3 + qmake/Makefile.unix.win32 | 2 +- qmake/Makefile.win32 | 41 ++++++- qmake/qmake.pro | 6 ++ src/corelib/global/qconfig-bootstrapped.h | 4 - src/corelib/text/qregularexpression.cpp | 8 ++ 10 files changed, 266 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 4225ee481c..3426673d42 100755 --- a/configure +++ b/configure @@ -353,6 +353,7 @@ macSDKify() ;; esac + hasCFlags= echo "$1" | while read line; do case "$line" in QMAKE_CC=*|QMAKE_CXX=*|QMAKE_FIX_RPATH=*|QMAKE_AR=*|QMAKE_RANLIB=*|QMAKE_LINK=*|QMAKE_LINK_SHLIB=*) @@ -363,7 +364,11 @@ macSDKify() val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-)) echo "$var=$val" ;; - QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*|QMAKE_LFLAGS=*) + QMAKE_CFLAGS=*) + echo "$line -isysroot $sysroot $version_min_flag" + hasCFlags="true"; + ;; + QMAKE_CXXFLAGS=*|QMAKE_LFLAGS=*) echo "$line -isysroot $sysroot $version_min_flag" ;; *) @@ -371,6 +376,10 @@ macSDKify() ;; esac done + + if [ -z "$hasCFlags" ]; then + echo "QMAKE_CFLAGS = -isysroot $sysroot $version_min_flag"; + fi } # relies on $QMAKESPEC being set correctly. parses include statements in @@ -844,6 +853,7 @@ fi setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM" setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM" setBootstrapVariable QMAKE_CXXFLAGS + setBootstrapVariable QMAKE_CFLAGS setBootstrapVariable QMAKE_CXXFLAGS_CXX1Z setBootstrapVariable QMAKE_CXXFLAGS_SPLIT_SECTIONS setBootstrapVariable QMAKE_LFLAGS @@ -874,6 +884,7 @@ fi echo "QT_MINOR_VERSION = $QT_MINOR_VERSION" >> "$mkfile" echo "QT_PATCH_VERSION = $QT_PATCH_VERSION" >> "$mkfile" echo "CONFIG_CXXFLAGS = $EXTRA_CXXFLAGS" >> "$mkfile" + echo "CONFIG_CFLAGS = \$(QMAKE_CFLAGS)" >> "$mkfile" echo "CONFIG_LFLAGS = $EXTRA_LFLAGS" >> "$mkfile" echo "RM_F = rm -f" >> "$mkfile" echo "RM_RF = rm -rf" >> "$mkfile" diff --git a/qmake/.prev_CMakeLists.txt b/qmake/.prev_CMakeLists.txt index e926f1d125..1e2bfb2448 100644 --- a/qmake/.prev_CMakeLists.txt +++ b/qmake/.prev_CMakeLists.txt @@ -6,6 +6,37 @@ qt_add_executable(qmake SOURCES + ../src/3rdparty/pcre2/src/config.h + ../src/3rdparty/pcre2/src/pcre2.h + ../src/3rdparty/pcre2/src/pcre2_auto_possess.c + ../src/3rdparty/pcre2/src/pcre2_chartables.c + ../src/3rdparty/pcre2/src/pcre2_compile.c + ../src/3rdparty/pcre2/src/pcre2_config.c + ../src/3rdparty/pcre2/src/pcre2_context.c + ../src/3rdparty/pcre2/src/pcre2_dfa_match.c + ../src/3rdparty/pcre2/src/pcre2_error.c + ../src/3rdparty/pcre2/src/pcre2_extuni.c + ../src/3rdparty/pcre2/src/pcre2_find_bracket.c + ../src/3rdparty/pcre2/src/pcre2_internal.h + ../src/3rdparty/pcre2/src/pcre2_intmodedep.h + ../src/3rdparty/pcre2/src/pcre2_jit_compile.c + ../src/3rdparty/pcre2/src/pcre2_maketables.c + ../src/3rdparty/pcre2/src/pcre2_match.c + ../src/3rdparty/pcre2/src/pcre2_match_data.c + ../src/3rdparty/pcre2/src/pcre2_newline.c + ../src/3rdparty/pcre2/src/pcre2_ord2utf.c + ../src/3rdparty/pcre2/src/pcre2_pattern_info.c + ../src/3rdparty/pcre2/src/pcre2_script_run.c + ../src/3rdparty/pcre2/src/pcre2_serialize.c + ../src/3rdparty/pcre2/src/pcre2_string_utils.c + ../src/3rdparty/pcre2/src/pcre2_study.c + ../src/3rdparty/pcre2/src/pcre2_substitute.c + ../src/3rdparty/pcre2/src/pcre2_substring.c + ../src/3rdparty/pcre2/src/pcre2_tables.c + ../src/3rdparty/pcre2/src/pcre2_ucd.c + ../src/3rdparty/pcre2/src/pcre2_ucp.h + ../src/3rdparty/pcre2/src/pcre2_valid_utf.c + ../src/3rdparty/pcre2/src/pcre2_xclass.c ../src/corelib/codecs/qutfcodec.cpp ../src/corelib/codecs/qutfcodec_p.h ../src/corelib/global/qglobal.cpp ../src/corelib/global/qglobal.h ../src/corelib/global/qlibraryinfo.cpp @@ -93,6 +124,7 @@ qt_add_executable(qmake qlocale.cpp-NOTFOUND qlocale.h-NOTFOUND qlocale_tools.cpp-NOTFOUND qlocale_tools_p.h-NOTFOUND qregexp.cpp-NOTFOUND qregexp.h-NOTFOUND + qregularexpression.cpp-NOTFOUND qregularexpression.h-NOTFOUND qromancalendar.cpp-NOTFOUND qromancalendar_p.h-NOTFOUND qstring.cpp-NOTFOUND qstring.h-NOTFOUND qstringlist.cpp-NOTFOUND qstringlist.h-NOTFOUND @@ -100,6 +132,7 @@ qt_add_executable(qmake qvsnprintf.cpp-NOTFOUND DEFINES (QT_VERSION_STR=\"\") + HAVE_CONFIG_H PROEVALUATOR_FULL QT_BOOTSTRAPPED QT_BUILD_QMAKE @@ -107,6 +140,8 @@ qt_add_executable(qmake QT_VERSION_MAJOR= QT_VERSION_MINOR= QT_VERSION_PATCH= + PUBLIC_DEFINES + PCRE2_CODE_UNIT_WIDTH=16 INCLUDE_DIRECTORIES (..)/include (..)/include/QtCore (..)/include/QtCore @@ -119,6 +154,8 @@ qt_add_executable(qmake generators/unix generators/win32 library + PUBLIC_INCLUDE_DIRECTORIES + $ PUBLIC_LIBRARIES Qt::Gui PRECOMPILED_HEADER @@ -146,6 +183,8 @@ qt_extend_target(qmake CONDITION WIN32 _CRT_SECURE_NO_WARNINGS _ENABLE_EXTENDED_ALIGNED_STORAGE _SCL_SECURE_NO_WARNINGS + PUBLIC_DEFINES + PCRE2_STATIC PUBLIC_LIBRARIES advapi32 kernel32 diff --git a/qmake/CMakeLists.txt b/qmake/CMakeLists.txt index 7017812aca..d724b44d59 100644 --- a/qmake/CMakeLists.txt +++ b/qmake/CMakeLists.txt @@ -9,6 +9,37 @@ qt_add_tool(qmake # special case TOOLS_TARGET Core # special case # GUI # special case: remove this SOURCES + ../src/3rdparty/pcre2/src/config.h + ../src/3rdparty/pcre2/src/pcre2.h + ../src/3rdparty/pcre2/src/pcre2_auto_possess.c + ../src/3rdparty/pcre2/src/pcre2_chartables.c + ../src/3rdparty/pcre2/src/pcre2_compile.c + ../src/3rdparty/pcre2/src/pcre2_config.c + ../src/3rdparty/pcre2/src/pcre2_context.c + ../src/3rdparty/pcre2/src/pcre2_dfa_match.c + ../src/3rdparty/pcre2/src/pcre2_error.c + ../src/3rdparty/pcre2/src/pcre2_extuni.c + ../src/3rdparty/pcre2/src/pcre2_find_bracket.c + ../src/3rdparty/pcre2/src/pcre2_internal.h + ../src/3rdparty/pcre2/src/pcre2_intmodedep.h + ../src/3rdparty/pcre2/src/pcre2_jit_compile.c + ../src/3rdparty/pcre2/src/pcre2_maketables.c + ../src/3rdparty/pcre2/src/pcre2_match.c + ../src/3rdparty/pcre2/src/pcre2_match_data.c + ../src/3rdparty/pcre2/src/pcre2_newline.c + ../src/3rdparty/pcre2/src/pcre2_ord2utf.c + ../src/3rdparty/pcre2/src/pcre2_pattern_info.c + ../src/3rdparty/pcre2/src/pcre2_script_run.c + ../src/3rdparty/pcre2/src/pcre2_serialize.c + ../src/3rdparty/pcre2/src/pcre2_string_utils.c + ../src/3rdparty/pcre2/src/pcre2_study.c + ../src/3rdparty/pcre2/src/pcre2_substitute.c + ../src/3rdparty/pcre2/src/pcre2_substring.c + ../src/3rdparty/pcre2/src/pcre2_tables.c + ../src/3rdparty/pcre2/src/pcre2_ucd.c + ../src/3rdparty/pcre2/src/pcre2_ucp.h + ../src/3rdparty/pcre2/src/pcre2_valid_utf.c + ../src/3rdparty/pcre2/src/pcre2_xclass.c ../src/corelib/codecs/qutfcodec.cpp ../src/corelib/codecs/qutfcodec_p.h ../src/corelib/global/qendian.cpp # special case ../src/corelib/global/qglobal.cpp ../src/corelib/global/qglobal.h @@ -70,6 +101,7 @@ qt_add_tool(qmake # special case ../src/corelib/text/qlocale_tools.cpp ../src/corelib/text/qlocale_tools_p.h ../src/corelib/tools/qmap.cpp ../src/corelib/tools/qmap.h ../src/corelib/text/qregexp.cpp ../src/corelib/text/qregexp.h + ../src/corelib/text/qregularexpression.cpp ../src/corelib/text/qregularexpression.h ../src/corelib/tools/qringbuffer.cpp # special case ../src/corelib/text/qstring.cpp ../src/corelib/text/qstring.h ../src/corelib/text/qstringbuilder.cpp ../src/corelib/text/qstringbuilder.h @@ -117,6 +149,9 @@ qt_add_tool(qmake # special case QT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} # special case QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case QT_VERSION_PATCH=${PROJECT_VERSION_PATCH} # special case + PCRE2_CODE_UNIT_WIDTH=16 + PCRE2_DISABLE_JIT + HAVE_CONFIG_H INCLUDE_DIRECTORIES # . # special case remove generators @@ -151,6 +186,8 @@ qt_extend_target(qmake CONDITION WIN32 _CRT_SECURE_NO_WARNINGS _ENABLE_EXTENDED_ALIGNED_STORAGE _SCL_SECURE_NO_WARNINGS + PUBLIC_DEFINES + PCRE2_STATIC PUBLIC_LIBRARIES advapi32 kernel32 diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index d113b456d4..1cdf9dee4b 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -31,10 +31,17 @@ QOBJS = \ qarraydata.o qbitarray.o qbytearray.o qbytearraylist.o qbytearraymatcher.o \ qcalendar.o qgregoriancalendar.o qromancalendar.o \ qcryptographichash.o qdatetime.o qhash.o \ - qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o \ + qlocale.o qlocale_tools.o qmap.o qregularexpression.o qregexp.o qringbuffer.o \ qstringbuilder.o qstring.o qstringlist.o qversionnumber.o \ qvsnprintf.o qxmlstream.o qxmlutils.o \ - $(QTOBJS) $(QTOBJS2) + pcre2_auto_possess.o pcre2_chartables.o pcre2_compile.o pcre2_config.o \ + pcre2_context.o pcre2_dfa_match.o pcre2_error.o pcre2_extuni.o \ + pcre2_find_bracket.o pcre2_jit_compile.o pcre2_maketables.o pcre2_match.o \ + pcre2_match_data.o pcre2_newline.o pcre2_ord2utf.o pcre2_pattern_info.o pcre2_script_run.o \ + pcre2_serialize.o pcre2_string_utils.o pcre2_study.o pcre2_substitute.o \ + pcre2_substring.o pcre2_tables.o pcre2_ucd.o pcre2_valid_utf.o \ + pcre2_xclass.o \ + $(QTOBJS) $(QTOBJS2) # QTOBJS and QTOBJS2 are populated by Makefile.unix.* as for QTSRC (see below). # Note: qlibraryinfo.o omitted deliberately - see below. @@ -112,6 +119,7 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp \ $(SOURCE_PATH)/src/corelib/text/qlocale.cpp \ $(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp \ + $(SOURCE_PATH)/src/corelib/text/qregularexpression.cpp \ $(SOURCE_PATH)/src/corelib/text/qregexp.cpp \ $(SOURCE_PATH)/src/corelib/text/qstringbuilder.cpp \ $(SOURCE_PATH)/src/corelib/text/qstring.cpp \ @@ -128,6 +136,32 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/tools/qmap.cpp \ $(SOURCE_PATH)/src/corelib/tools/qringbuffer.cpp \ $(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_auto_possess.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_chartables.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_compile.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_config.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_context.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_dfa_match.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_error.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_extuni.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_find_bracket.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_jit_compile.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_maketables.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_match.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_match_data.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_newline.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_ord2utf.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_pattern_info.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_script_run.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_serialize.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_string_utils.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_study.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_substitute.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_substring.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_tables.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_ucd.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_valid_utf.c \ + $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_xclass.c \ $(QTSRCS) $(QTSRCS2) # QTSRCS and QTSRCS2 come from Makefile.unix.* (concatenated with this # by configure); QTSRCS2 may include *.mm entries on macOS. @@ -136,6 +170,7 @@ DEPEND_SRC = \ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \ -I$(QMKSRC) -I$(QMKLIBSRC) -I$(QMKGENSRC) \ -I$(SOURCE_PATH)/src/3rdparty/tinycbor/src \ + -I$(SOURCE_PATH)/src/3rdparty/pcre2/src \ -I$(QMKGENSRC)/unix -I$(QMKGENSRC)/win32 -I$(QMKGENSRC)/mac \ -I$(INC_PATH) -I$(INC_PATH)/QtCore \ -I$(INC_PATH)/QtCore/$(QT_VERSION) -I$(INC_PATH)/QtCore/$(QT_VERSION)/QtCore \ @@ -143,9 +178,12 @@ CPPFLAGS = -g $(EXTRA_CPPFLAGS) \ -I$(QMAKESPEC) \ -DQT_VERSION_STR=\"$(QT_VERSION)\" -DQT_VERSION_MAJOR=$(QT_MAJOR_VERSION) -DQT_VERSION_MINOR=$(QT_MINOR_VERSION) -DQT_VERSION_PATCH=$(QT_PATCH_VERSION) \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \ - -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER + -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER \ + -DPCRE2_CODE_UNIT_WIDTH=16 -DHAVE_CONFIG_H\ + $(EXTRA_CPPFLAGS) CXXFLAGS = $(EXTRA_CXXFLAGS) $(CONFIG_CXXFLAGS) $(CPPFLAGS) +CFLAGS = $(CPPFLAGS) $(CONFIG_CFLAGS) LFLAGS = $(EXTRA_LFLAGS) $(CONFIG_LFLAGS) first all: $(BUILD_PATH)/bin/qmake$(EXEEXT) @@ -410,6 +448,9 @@ qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< +qregularexpression.o: $(SOURCE_PATH)/src/corelib/text/qregularexpression.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $< + qregexp.o: $(SOURCE_PATH)/src/corelib/text/qregexp.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< @@ -494,4 +535,83 @@ qxmlutils.o: $(SOURCE_PATH)/src/corelib/serialization/qxmlutils.cpp qtextstream.o: $(SOURCE_PATH)/src/corelib/serialization/qtextstream.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< +pcre2_auto_possess.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_auto_possess.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_chartables.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_chartables.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_compile.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_compile.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_config.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_config.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_context.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_context.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_dfa_match.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_dfa_match.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_error.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_error.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_extuni.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_extuni.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_find_bracket.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_find_bracket.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_jit_compile.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_jit_compile.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_maketables.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_maketables.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_match.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_match.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_match_data.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_match_data.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_newline.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_newline.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_ord2utf.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_ord2utf.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_pattern_info.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_pattern_info.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_script_run.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_script_run.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_serialize.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_serialize.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_string_utils.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_string_utils.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_study.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_study.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_substitute.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_substitute.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_substring.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_substring.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_tables.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_tables.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_ucd.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_ucd.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_valid_utf.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_valid_utf.c + $(CC) -c -o $@ $(CFLAGS) $< + +pcre2_xclass.o: $(SOURCE_PATH)/src/3rdparty/pcre2/src/pcre2_xclass.c + $(CC) -c -o $@ $(CFLAGS) $< + + # DO NOT DELETE THIS LINE -- make depend depends on it diff --git a/qmake/Makefile.unix.mingw b/qmake/Makefile.unix.mingw index 6480171c69..816e5d67de 100644 --- a/qmake/Makefile.unix.mingw +++ b/qmake/Makefile.unix.mingw @@ -25,3 +25,6 @@ else RM_F = del /f RM_RF = rmdir /s /q endif +ifeq ($(CXX), g++) + CC = gcc +endif diff --git a/qmake/Makefile.unix.win32 b/qmake/Makefile.unix.win32 index faf09ac11e..3d38cd1b17 100644 --- a/qmake/Makefile.unix.win32 +++ b/qmake/Makefile.unix.win32 @@ -1,5 +1,5 @@ EXEEXT = .exe -EXTRA_CXXFLAGS = -DUNICODE -DMINGW_HAS_SECURE_API=1 +EXTRA_CPPFLAGS = -DPCRE2_STATIC -DUNICODE -DMINGW_HAS_SECURE_API=1 EXTRA_LFLAGS = -static -s -lole32 -luuid -ladvapi32 -lkernel32 -lnetapi32 QTOBJS = \ qfilesystemengine_win.o \ diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 3430cf8c7f..52a7a607e6 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -32,17 +32,20 @@ CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ $(CFLAGS_EXTRA) \ -I$(QMKSRC) -I$(QMKSRC)\library -I$(QMKSRC)\generators -I$(QMKSRC)\generators\unix -I$(QMKSRC)\generators\win32 -I$(QMKSRC)\generators\mac \ -I$(SOURCE_PATH)/src/3rdparty/tinycbor/src \ + -I$(SOURCE_PATH)/src/3rdparty/pcre2/src \ -I$(INC_PATH) -I$(INC_PATH)\QtCore -I$(INC_PATH)\QtCore\$(QT_VERSION) -I$(INC_PATH)\QtCore\$(QT_VERSION)\QtCore \ -I$(BUILD_PATH)\src\corelib\global \ -I$(SOURCE_PATH)\mkspecs\$(QMAKESPEC) \ -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS \ -DQT_VERSION_STR=\"$(QT_VERSION)\" -DQT_VERSION_MAJOR=$(QT_MAJOR_VERSION) -DQT_VERSION_MINOR=$(QT_MINOR_VERSION) -DQT_VERSION_PATCH=$(QT_PATCH_VERSION) \ -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL \ - -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER -DUNICODE -D_ENABLE_EXTENDED_ALIGNED_STORAGE -CFLAGS = $(CFLAGS_PCH) $(CFLAGS_BARE) $(CFLAGS) + -DQT_NO_FOREACH -DQT_USE_QSTRINGBUILDER -DUNICODE -D_ENABLE_EXTENDED_ALIGNED_STORAGE \ + -DPCRE2_CODE_UNIT_WIDTH=16 -DHAVE_CONFIG_H -DPCRE2_STATIC + +CFLAGS = $(CFLAGS_BARE) $(CFLAGS) CXXFLAGS_BARE = $(CFLAGS_BARE) -CXXFLAGS = $(CFLAGS) +CXXFLAGS = $(CFLAGS) $(CFLAGS_PCH) LFLAGS = LIBS = ole32.lib advapi32.lib shell32.lib netapi32.lib @@ -125,7 +128,34 @@ QTOBJS= \ qjsonparser.obj \ qjsonarray.obj \ qjsonobject.obj \ - qjsonvalue.obj + qjsonvalue.obj \ + qregularexpression.obj \ + pcre2_auto_possess.obj \ + pcre2_chartables.obj \ + pcre2_compile.obj \ + pcre2_config.obj \ + pcre2_context.obj \ + pcre2_dfa_match.obj \ + pcre2_error.obj \ + pcre2_extuni.obj \ + pcre2_find_bracket.obj \ + pcre2_jit_compile.obj \ + pcre2_maketables.obj \ + pcre2_match.obj \ + pcre2_match_data.obj \ + pcre2_newline.obj \ + pcre2_ord2utf.obj \ + pcre2_pattern_info.obj \ + pcre2_script_run.obj \ + pcre2_serialize.obj \ + pcre2_string_utils.obj \ + pcre2_study.obj \ + pcre2_substitute.obj \ + pcre2_substring.obj \ + pcre2_tables.obj \ + pcre2_ucd.obj \ + pcre2_valid_utf.obj \ + pcre2_xclass.obj \ first all: $(BUILD_PATH)\bin\qmake.exe binary: $(BUILD_PATH)\qmake\qmake.exe @@ -211,6 +241,9 @@ qmake_pch.obj: {$(SOURCE_PATH)\src\corelib\tools}.cpp{}.obj:: $(CXX) $(CXXFLAGS) $< +{$(SOURCE_PATH)\src\3rdparty\pcre2\src}.c{}.obj:: + $(CXX) $(CFLAGS) $< + # Make sure qlibraryinfo.obj isn't compiled with PCH enabled qlibraryinfo.obj: $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp $(CXX) $(CXXFLAGS_BARE) -DQT_BUILD_QMAKE_BOOTSTRAP $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp diff --git a/qmake/qmake.pro b/qmake/qmake.pro index d1532af0d2..c64017f05b 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -103,11 +103,13 @@ INCLUDEPATH += \ VPATH += \ ../src/corelib/global \ + ../src/corelib/text \ ../src/corelib/tools \ ../src/corelib/kernel \ ../src/corelib/codecs \ ../src/corelib/plugin \ ../src/corelib/io \ + ../src/corelib/time \ ../src/corelib/serialization SOURCES += \ @@ -151,6 +153,7 @@ SOURCES += \ qmetatype.cpp \ qnumeric.cpp \ qregexp.cpp \ + qregularexpression.cpp \ qromancalendar.cpp \ qsettings.cpp \ qstring.cpp \ @@ -209,6 +212,7 @@ HEADERS += \ qmetatype.h \ qnumeric.h \ qregexp.h \ + qregularexpression.h \ qromancalendar_p.h \ qstring.h \ qstringbuilder.h \ @@ -224,6 +228,8 @@ HEADERS += \ qxmlstream.h \ qxmlutils_p.h +include(../src/3rdparty/pcre2/pcre2.pri) + unix { SOURCES += \ qcore_unix.cpp \ diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 0185ad566c..c943acb602 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -106,11 +106,7 @@ #define QT_FEATURE_lttng -1 #define QT_NO_QOBJECT #define QT_FEATURE_process -1 -#ifndef QT_BUILD_QMAKE #define QT_FEATURE_regularexpression 1 -#else -#define QT_FEATURE_regularexpression -1 -#endif #ifdef __GLIBC_PREREQ # define QT_FEATURE_renameat2 (__GLIBC_PREREQ(2, 28) ? 1 : -1) #else diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 7ed8618e96..6b81f5cc79 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -1535,9 +1535,17 @@ QString QRegularExpression::errorString() const } while (errorStringLength < 0); errorString.resize(errorStringLength); +#ifdef QT_NO_TRANSLATION + return errorString; +#else return QCoreApplication::translate("QRegularExpression", std::move(errorString).toLatin1().constData()); +#endif } +#ifdef QT_NO_TRANSLATION + return QLatin1String("no error"); +#else return QCoreApplication::translate("QRegularExpression", "no error"); +#endif } /*!