aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--third-party/cmake/BuildGettext.cmake3
-rw-r--r--third-party/cmake/GettextCMakeLists.txt270
-rw-r--r--third-party/patches/gettext-Fix-building-with-MSVC.patch50
3 files changed, 161 insertions, 162 deletions
diff --git a/third-party/cmake/BuildGettext.cmake b/third-party/cmake/BuildGettext.cmake
index fcdfa2b42c..9357456343 100644
--- a/third-party/cmake/BuildGettext.cmake
+++ b/third-party/cmake/BuildGettext.cmake
@@ -12,9 +12,6 @@ if(MSVC)
-DTARGET=gettext
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
- PATCH_COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/gettext init
- COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/gettext apply --ignore-whitespace
- ${CMAKE_CURRENT_SOURCE_DIR}/patches/gettext-Fix-building-with-MSVC.patch
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt
${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt
diff --git a/third-party/cmake/GettextCMakeLists.txt b/third-party/cmake/GettextCMakeLists.txt
index e76059c9dd..c3f78716d0 100644
--- a/third-party/cmake/GettextCMakeLists.txt
+++ b/third-party/cmake/GettextCMakeLists.txt
@@ -8,6 +8,7 @@ endmacro()
file(READ gettext-runtime/config.h.in CONFIG_CONTENT)
string(REPLACE "#undef HAVE_GETCWD" "#define HAVE_GETCWD 1" CONFIG_CONTENT ${CONFIG_CONTENT})
+string(REPLACE "#undef HAVE_LONG_LONG_INT" "#define HAVE_LONG_LONG_INT 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_ICONV_H" "#define HAVE_ICONV_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_ICONV" "#define HAVE_ICONV 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" CONFIG_CONTENT ${CONFIG_CONTENT})
@@ -27,6 +28,8 @@ set(HAVE_POSIX_PRINTF 0)
set(HAVE_SNPRINTF 0)
set(HAVE_ASPRINTF 0)
set(HAVE_WPRINTF 0)
+set(HAVE_NAMELESS_LOCALES 0)
+set(HAVE_LONG_LONG_INT 1)
configure_file(gettext-runtime/intl/libgnuintl.in.h
${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl/libgnuintl.h)
@@ -48,13 +51,16 @@ add_definitions(-DLOCALEDIR=\"${LOCALDIR}\"
set(libintl_SOURCES
bindtextdom.c dcgettext.c dcigettext.c dcngettext.c dgettext.c dngettext.c
- explodename.c finddomain.c gettext.c hash-string.c l10nflist.c langprefs.c
- loadmsgcat.c localcharset.c localealias.c localename.c lock.c log.c ngettext.c
+ explodename.c finddomain.c gettext.c hash-string.c intl-compat.c l10nflist.c
+ langprefs.c loadmsgcat.c localcharset.c localealias.c localename-table.c
+ localename.c lock.c log.c ngettext.c osdep.c
plural-exp.c plural.c printf.c relocatable.c setlocale.c textdomain.c
- threadlib.c version.c)
+ threadlib.c version.c xsize.c)
+
PREFIX_LIST_ITEMS(libintl_SOURCES "gettext-runtime/intl/")
add_library(libintl ${libintl_SOURCES})
+target_link_libraries(libintl ${LIBICONV_LIBRARIES})
set_property(TARGET libintl APPEND PROPERTY INCLUDE_DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime
${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl
@@ -72,6 +78,8 @@ set_property(TARGET libintl APPEND PROPERTY COMPILE_DEFINITIONS
file(READ gettext-tools/config.h.in CONFIG_CONTENT)
+string(REPLACE "#undef FLEXIBLE_ARRAY_MEMBER" "#define FLEXIBLE_ARRAY_MEMBER 1" CONFIG_CONTENT ${CONFIG_CONTENT})
+string(REPLACE "__declspec (dllimport)" "" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef ENDIANNESS" "#define ENDIANNESS 0" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef GNULIB_FWRITEERROR" "#define GNULIB_FWRITEERROR 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_DECL_STRERROR_R" "#define HAVE_DECL_STRERROR_R 0" CONFIG_CONTENT ${CONFIG_CONTENT})
@@ -81,9 +89,11 @@ string(REPLACE "#undef HAVE_ICONV" "#define HAVE_ICONV 1" CONFIG_CONTENT ${CONFI
string(REPLACE "#undef HAVE_LIBUNISTRING" "#define HAVE_LIBUNISTRING 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_STDINT_H_WITH_UINTMAX" "#define HAVE_STDINT_H_WITH_UINTMAX 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_STDINT_H" "#define HAVE_STDINT_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
+string(REPLACE "#undef HAVE_LONG_LONG_INT" "#define HAVE_LONG_LONG_INT 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_STRING_H" "#define HAVE_STRING_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE_SYS_TIMEB_H" "#define HAVE_SYS_TIMEB_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef HAVE__FTIME" "#define HAVE__FTIME 1" CONFIG_CONTENT ${CONFIG_CONTENT})
+string(REPLACE "#undef HAVE_FLOAT_H" "#define HAVE_FLOAT_H 1" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef ICONV_CONST" "#define ICONV_CONST const" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef PACKAGE" "#define PACKAGE \"gettext\"\n#define gettext_VERSION" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef VERSION" "#define VERSION \"\"" CONFIG_CONTENT ${CONFIG_CONTENT})
@@ -92,13 +102,14 @@ string(REPLACE "#undef pid_t" "#define pid_t int" CONFIG_CONTENT ${CONFIG_CONTEN
string(REPLACE "#undef restrict" "#define restrict __restrict" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef ssize_t" "#include <BaseTsd.h>\n#define ssize_t SSIZE_T" CONFIG_CONTENT ${CONFIG_CONTENT})
string(REPLACE "#undef uid_t" "#define uid_t int" CONFIG_CONTENT ${CONFIG_CONTENT})
+string(REPLACE "#undef HAVE_DECL___ARGV" "#define HAVE_DECL___ARGV 1" CONFIG_CONTENT ${CONFIG_CONTENT})
+set(CONFIG_CONTENT "${CONFIG_CONTENT}\n#define isatty libtextstyle_isatty")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gettext-tools/config.h ${CONFIG_CONTENT})
-set(libgettextsrc_COMMON_SOURCE
+set(libgettextsrc_COMMON_SOURCE
message.c po-error.c po-xerror.c read-catalog-abstract.c po-lex.c
po-gram-gen.c po-charset.c read-po.c read-properties.c read-stringtable.c
- open-catalog.c dir-list.c
- str-list.c)
+ open-catalog.c dir-list.c str-list.c)
set(libgettextsrc_FORMAT_SOURCE
format.c format-invalid.h format-c.c format-c-parse.h format-sh.c
@@ -110,11 +121,12 @@ set(libgettextsrc_FORMAT_SOURCE
format-javascript.c)
set(libgettextsrc_SOURCES
- ${libgettextsrc_COMMON_SOURCE} read-catalog.c color.c write-catalog.c
- write-properties.c write-stringtable.c write-po.c msgl-ascii.c msgl-iconv.c
- msgl-equal.c msgl-cat.c msgl-header.c msgl-english.c msgl-check.c file-list.c
- msgl-charset.c po-time.c plural-exp.c plural-eval.c plural-count.c
- plural-table.c quote.h sentence.h sentence.c ${libgettextsrc_FORMAT_SOURCE}
+ ${libgettextsrc_COMMON_SOURCE} read-catalog.c
+ write-catalog.c write-properties.c write-stringtable.c write-po.c
+ msgl-ascii.c msgl-iconv.c msgl-equal.c msgl-cat.c msgl-header.c msgl-english.c
+ msgl-check.c file-list.c msgl-charset.c po-time.c plural-exp.c plural-eval.c
+ plural-table.c quote.h sentence.h sentence.c
+ ${libgettextsrc_FORMAT_SOURCE}
read-desktop.c locating-rule.c its.c search-path.c)
PREFIX_LIST_ITEMS(libgettextsrc_SOURCES "gettext-tools/src/")
@@ -124,101 +136,141 @@ set(GLIBC_SOURCE
gettimeofday.c getdtablesize.c fcntl.c dup-safer-flag.c cloexec.c
fd-safer-flag.c fd-safer.c pipe2.c pipe2-safer.c spawn-pipe.c xmemdup0.c
secure_getenv.c tmpdir.c tempname.c mkdtemp.c fnmatch.c clean-temp.c
- gl_array_list.c tputs.c wait-process.c waitpid.c getdelim.c getline.c
- sigprocmask.c sigaction.c addext.c argmatch.c backupfile.c basename.c
- c-strcasecmp.c c-strncasecmp.c c-strstr.c closeout.c concat-filename.c
- error-progname.c error.c exitfail.c file-ostream.c fstrcmp.c full-write.c
- fwriteerror.c getopt.c getopt1.c hash.c libxml/buf.c localcharset.c malloca.c
- mbchar.c mbslen.c mbsstr.c mbswidth.c obstack.c ostream.c html-ostream.c
- fd-ostream.c styled-ostream.c progname.c html-styled-ostream.c printf-args.c
- printf-parse.c propername.c quotearg.c rawmemchr.c safe-read.c safe-write.c
- stpcpy.c stpncpy.c strchrnul.c striconv.c striconveh.c striconveha.c strnlen1.c
- term-ostream.c term-styled-ostream.c tparm.c trim.c gcd.c gl_linkedhash_list.c
+ wait-process.c waitpid.c getdelim.c getline.c sigprocmask.c sigaction.c
+ addext.c argmatch.c backupfile.c basename.c c-strcasecmp.c c-strncasecmp.c
+ c-strstr.c closeout.c concat-filename.c error-progname.c error.c exitfail.c
+ fstrcmp.c full-write.c fwriteerror.c getopt.c getopt1.c hash.c libxml/buf.c
+ localcharset.c malloca.c mbchar.c mbslen.c mbsstr.c mbswidth.c obstack.c
+ progname.c printf-args.c printf-parse.c propername.c quotearg.c rawmemchr.c
+ safe-read.c safe-write.c stpcpy.c stpncpy.c strchrnul.c striconv.c
+ striconveh.c striconveha.c strnlen1.c trim.c gcd.c gl_linkedhash_list.c
uniconv/u8-conv-from-enc.c unictype/ctype_space.c unilbrk/lbrktables.c
unilbrk/u8-possible-linebreaks.c unilbrk/u8-width-linebreaks.c
unilbrk/ulc-common.c unilbrk/ulc-width-linebreaks.c unistr/u16-mbtouc-aux.c
- unistr/u16-mbtouc.c unistr/u8-check.c unistr/u8-mblen.c unistr/u8-mbtouc-aux.c
- unistr/u8-mbtouc-unsafe-aux.c unistr/u8-mbtouc-unsafe.c unistr/u8-mbtouc.c
- unistr/u8-mbtoucr.c unistr/u8-prev.c unistr/u8-uctomb-aux.c unistr/u8-uctomb.c
- uniwidth/width.c vasnprintf.c vasprintf.c wcwidth.c xasprintf.c
- xconcat-filename.c xerror.c xmalloc.c xstrdup.c xstriconv.c xstriconveh.c xvasprintf.c glib/ghash.c
- glib/glist.c glib/gmessages.c glib/gprimes.c glib/gstrfuncs.c glib/gstring.c
- libcroco/cr-additional-sel.c libcroco/cr-attr-sel.c libcroco/cr-cascade.c
- libcroco/cr-declaration.c libcroco/cr-doc-handler.c libcroco/cr-enc-handler.c
- libcroco/cr-fonts.c libcroco/cr-input.c libcroco/cr-num.c
- libcroco/cr-om-parser.c libcroco/cr-parser.c libcroco/cr-parsing-location.c
- libcroco/cr-prop-list.c libcroco/cr-pseudo.c libcroco/cr-rgb.c
- libcroco/cr-sel-eng.c libcroco/cr-selector.c libcroco/cr-simple-sel.c
- libcroco/cr-statement.c libcroco/cr-string.c libcroco/cr-style.c
- libcroco/cr-stylesheet.c libcroco/cr-term.c libcroco/cr-tknzr.c
- libcroco/cr-token.c libcroco/cr-utils.c libxml/DOCBparser.c
- libxml/HTMLparser.c libxml/HTMLtree.c libxml/SAX.c libxml/SAX2.c libxml/c14n.c
- libxml/catalog.c libxml/chvalid.c libxml/debugXML.c libxml/dict.c
- libxml/encoding.c libxml/entities.c libxml/error.c libxml/globals.c
- libxml/hash.c libxml/legacy.c libxml/list.c libxml/nanoftp.c libxml/nanohttp.c
- libxml/parser.c libxml/parserInternals.c libxml/pattern.c libxml/relaxng.c
- libxml/schematron.c libxml/threads.c libxml/tree.c libxml/trionan.c
- libxml/uri.c libxml/valid.c libxml/xinclude.c libxml/xlink.c libxml/xmlIO.c
- libxml/xmlmemory.c libxml/xmlmodule.c libxml/xmlreader.c libxml/xmlregexp.c
- libxml/xmlsave.c libxml/xmlschemas.c libxml/xmlschemastypes.c
- libxml/xmlstring.c libxml/xmlunicode.c libxml/xmlwriter.c libxml/xpath.c
- libxml/xpointer.c fatal-signal.c copy-file.c)
+ unistr/u16-mbtouc.c unistr/u8-check.c unistr/u8-mblen.c
+ unistr/u8-mbtouc-aux.c unistr/u8-mbtouc-unsafe-aux.c
+ unistr/u8-mbtouc-unsafe.c unistr/u8-mbtouc.c unistr/u8-mbtoucr.c
+ unistr/u8-prev.c unistr/u8-uctomb-aux.c unistr/u8-uctomb.c uniwidth/width.c
+ vasnprintf.c vasprintf.c wcwidth.c xasprintf.c xconcat-filename.c xerror.c
+ xmalloc.c xstrdup.c xstriconv.c xstriconveh.c xvasprintf.c
+ libxml/DOCBparser.c libxml/HTMLparser.c libxml/HTMLtree.c libxml/SAX.c
+ libxml/SAX2.c libxml/c14n.c libxml/catalog.c libxml/chvalid.c
+ libxml/debugXML.c libxml/dict.c libxml/encoding.c libxml/entities.c
+ libxml/error.c libxml/globals.c libxml/hash.c libxml/legacy.c libxml/list.c
+ libxml/nanoftp.c libxml/nanohttp.c libxml/parser.c libxml/parserInternals.c
+ libxml/pattern.c libxml/relaxng.c libxml/schematron.c libxml/threads.c
+ libxml/tree.c libxml/trionan.c libxml/uri.c libxml/valid.c libxml/xinclude.c
+ libxml/xlink.c libxml/xmlIO.c libxml/xmlmemory.c libxml/xmlmodule.c
+ libxml/xmlreader.c libxml/xmlregexp.c libxml/xmlsave.c libxml/xmlschemas.c
+ libxml/xmlschemastypes.c libxml/xmlstring.c libxml/xmlunicode.c
+ libxml/xmlwriter.c libxml/xpath.c libxml/xpointer.c fatal-signal.c
+ copy-file.c read-file.c ftello.c utime.c gettime.c utimens.c)
PREFIX_LIST_ITEMS(GLIBC_SOURCE "gettext-tools/gnulib-lib/")
-set(libgettextsrc_SOURCES ${libgettextsrc_SOURCES} ${GLIBC_SOURCE})
-
-set(HEADER_TEMPLATES_PATH "gettext-tools/gnulib-lib")
-set(HEADER_TEMPLATES_ABS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_TEMPLATES_PATH}")
-file(GLOB_RECURSE HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/*.in.h")
-list(REMOVE_ITEM HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/stdint.in.h")
-list(REMOVE_ITEM HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/wchar.in.h")
-foreach(HEADER_TEMPLATE ${HEADER_TEMPLATES})
- file(READ ${HEADER_TEMPLATE} HEADER_CONTENT)
- string(REPLACE "/* The definition of _GL_ARG_NONNULL is copied here. */" "#include \"arg-nonnull.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "/* The definition of _GL_WARN_ON_USE is copied here. */" "#include \"warn-on-use.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */" "#include \"c++defs.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@GNULIB_LSTAT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@GNULIB_MBSINIT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@GNULIB_SIGACTION@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@GNULIB_SIGPROCMASK@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@GNULIB_STPCPY@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@GNULIB_STPNCPY@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@GNULIB_STRCHRNUL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@HAVE_ISWCNTRL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@HAVE_WCTYPE_T@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
- string(REPLACE "@PRAGMA_COLUMNS@" "" HEADER_CONTENT "${HEADER_CONTENT}")
-
- string(REGEX REPLACE "^${HEADER_TEMPLATES_ABS_PATH}/" "" HEADER_PATH "${HEADER_TEMPLATE}")
- string(REPLACE ".in" "" HEADER_PATH ${HEADER_PATH})
- string(REPLACE "_" "/" HEADER_PATH ${HEADER_PATH})
- # find_file will create a cache entry for the variable
- # SYSTEM_HEADER, so reset it before each call
- set(SYSTEM_HEADER "SYSTEM_HEADER-NOTFOUND")
- find_file(SYSTEM_HEADER ${HEADER_PATH} PATHS "${LIBICONV_INCLUDE_DIRS}")
- if(SYSTEM_HEADER)
- # Gnulib uses #include_next to extend system header files,
- # but MSVC doesn't support it, so a regular include directive
- # with a relative path is used instead
- string(REGEX REPLACE ".*/(.*/${HEADER_PATH})" "../\\1"
- INCLUDE_PATH "${SYSTEM_HEADER}")
- string(REGEX REPLACE "@INCLUDE_NEXT[^@]*@ @NEXT_[^@\n]+@"
- "include <${INCLUDE_PATH}>" HEADER_CONTENT "${HEADER_CONTENT}")
- endif()
-
- # Default any remaining template variables to 0
- string(REGEX REPLACE "@[^@\n]+@" "0" HEADER_CONTENT "${HEADER_CONTENT}")
-
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_TEMPLATES_PATH}/${HEADER_PATH}" "${HEADER_CONTENT}")
-endforeach()
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gettext-tools/gnulib-lib/configmake.h "#define PKGDATADIR \"gettext\"")
+
+set(LIBGLIB_SOURCES
+ ghash.c glist.c gmessages.c gprimes.c gstrfuncs.c gstring.c)
+PREFIX_LIST_ITEMS(LIBGLIB_SOURCES "libtextstyle/lib/glib/")
+
+set(LIBTEXTSTYLE_SOURCE
+ gl_array_list.h gl_array_list.c binary-io.h
+ binary-io.c c-ctype.h c-ctype.c c-strcase.h c-strcasecmp.c
+ c-strncasecmp.c concat-filename.c dirname-lgpl.c
+ basename-lgpl.c stripslash.c exitfail.c fatal-signal.h
+ fatal-signal.c fd-hook.c fd-ostream.c file-ostream.c
+ full-write.h full-write.c getprogname.h getprogname.c
+ gettext.h hash.h hash.c html-ostream.c html-styled-ostream.c
+ iconv-ostream.c gl_list.h gl_list.c math.c memory-ostream.c
+ minmax.h noop-styled-ostream.c ostream.c safe-read.c
+ safe-write.c sig-handler.c size_max.h styled-ostream.c
+ term-ostream.c term-style-control.c term-styled-ostream.c
+ unistd.c xalloc.h xmalloc.c xstrdup.c
+ xconcat-filename.c gl_xlist.h gl_xlist.c xsize.h xsize.c
+ xvasprintf.h xvasprintf.c xasprintf.c color.h color.c misc.h
+ misc.c version.c isatty.c fsync.c tparm.c tputs.c)
+PREFIX_LIST_ITEMS(LIBTEXTSTYLE_SOURCE "libtextstyle/lib/")
+
+configure_file(
+ libtextstyle/lib/stdbool.mini.h
+ ${CMAKE_CURRENT_BINARY_DIR}/libtextstyle/lib/textstyle/stdbool.h
+ COPYONLY)
+
+set(LIBCROCO_SOURCES
+ cr-additional-sel.c cr-attr-sel.c cr-cascade.c cr-declaration.c
+ cr-doc-handler.c cr-enc-handler.c cr-fonts.c cr-input.c cr-num.c
+ cr-om-parser.c cr-parser.c cr-parsing-location.c cr-prop-list.c cr-pseudo.c
+ cr-rgb.c cr-sel-eng.c cr-selector.c cr-simple-sel.c cr-statement.c
+ cr-string.c cr-style.c cr-stylesheet.c cr-term.c cr-tknzr.c cr-token.c
+ cr-utils.c)
+PREFIX_LIST_ITEMS(LIBCROCO_SOURCES "libtextstyle/lib/libcroco/")
+
+set(libgettextsrc_SOURCES
+ ${libgettextsrc_SOURCES} ${GLIBC_SOURCE} ${LIBGLIB_SOURCES}
+ ${LIBTEXTSTYLE_SOURCE} ${LIBCROCO_SOURCES})
+
+macro(CONFIGURE_HEADER_FILES HEADER_TEMPLATES_PATH)
+ set(HEADER_TEMPLATES_ABS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_TEMPLATES_PATH}")
+ file(GLOB_RECURSE HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/*.in.h")
+ list(REMOVE_ITEM HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/stdint.in.h")
+ list(REMOVE_ITEM HEADER_TEMPLATES "${HEADER_TEMPLATES_ABS_PATH}/wchar.in.h")
+ foreach(HEADER_TEMPLATE ${HEADER_TEMPLATES})
+ file(READ ${HEADER_TEMPLATE} HEADER_CONTENT)
+ string(REPLACE "/* The definition of _GL_ARG_NONNULL is copied here. */" "#include \"arg-nonnull.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "/* The definition of _GL_WARN_ON_USE is copied here. */" "#include \"warn-on-use.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */" "#include \"c++defs.h\"" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@GNULIB_LSTAT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@GNULIB_MBSINIT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@GNULIB_SIGACTION@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@GNULIB_SIGPROCMASK@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@GNULIB_STPCPY@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@GNULIB_STPNCPY@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@GNULIB_STRCHRNUL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@HAVE_ISWCNTRL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@HAVE_WCTYPE_T@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@HAVE_STRUCT_TIMEVAL@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@HAVE_WINSOCK2_H@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@DLL_VARIABLE@" "" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@HAVE_NEWLOCALE@" "0" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@PRAGMA_COLUMNS@" "" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "#if @GNULIB_UTIME@" "#if 1\n#define utime gl_utime" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@HAVE_UTIME@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+ string(REPLACE "@HAVE_LONG_LONG_INT@" "1" HEADER_CONTENT "${HEADER_CONTENT}")
+
+ string(REGEX REPLACE "^${HEADER_TEMPLATES_ABS_PATH}/" "" HEADER_PATH "${HEADER_TEMPLATE}")
+ string(REPLACE ".in" "" HEADER_PATH ${HEADER_PATH})
+ string(REPLACE "_" "/" HEADER_PATH ${HEADER_PATH})
+ # find_file will create a cache entry for the variable
+ # SYSTEM_HEADER, so reset it before each call
+ set(SYSTEM_HEADER "SYSTEM_HEADER-NOTFOUND")
+ find_file(SYSTEM_HEADER ${HEADER_PATH} PATHS "${LIBICONV_INCLUDE_DIRS}")
+ if(SYSTEM_HEADER)
+ # Gnulib uses #include_next to extend system header files,
+ # but MSVC doesn't support it, so a regular include directive
+ # with a relative path is used instead
+ string(REGEX REPLACE ".*/(.*/${HEADER_PATH})" "../\\1"
+ INCLUDE_PATH "${SYSTEM_HEADER}")
+ string(REGEX REPLACE "@INCLUDE_NEXT[^@]*@ @NEXT_[^@\n]+@"
+ "include <${INCLUDE_PATH}>" HEADER_CONTENT "${HEADER_CONTENT}")
+ endif()
+
+ # Default any remaining template variables to 0
+ string(REGEX REPLACE "@[^@\n]+@" "0" HEADER_CONTENT "${HEADER_CONTENT}")
+
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_TEMPLATES_PATH}/${HEADER_PATH}" "${HEADER_CONTENT}")
+ endforeach()
+endmacro()
+
+CONFIGURE_HEADER_FILES("gettext-tools/gnulib-lib")
+CONFIGURE_HEADER_FILES("libtextstyle/lib")
add_library(libgettextsrc ${libgettextsrc_SOURCES})
target_link_libraries(libgettextsrc ${LIBICONV_LIBRARIES})
+set_property(TARGET libgettextsrc APPEND PROPERTY COMPILE_DEFINITIONS
+ LIBTEXTSTYLE_DLL_VARIABLE=)
set(msgmerge_SOURCES
- msgmerge.c
- msgl-fsearch.c
- lang-table.c
- )
+ msgmerge.c msgl-fsearch.c lang-table.c plural-count.c)
PREFIX_LIST_ITEMS(msgmerge_SOURCES "gettext-tools/src/")
add_executable(msgmerge ${msgmerge_SOURCES})
@@ -226,25 +278,21 @@ target_link_libraries(msgmerge libgettextsrc)
add_dependencies(msgmerge libgettextsrc libintl)
set(msgfmt_SOURCES
- msgfmt.c
- write-mo.c
- write-java.c
- write-csharp.c
- write-resources.c
- write-tcl.c
- write-qt.c
- write-desktop.c
- write-xml.c)
+ msgfmt.c write-mo.c write-java.c write-csharp.c write-resources.c write-tcl.c
+ write-qt.c write-desktop.c write-xml.c
+ ../../gettext-runtime/intl/hash-string.c)
PREFIX_LIST_ITEMS(msgfmt_SOURCES "gettext-tools/src/")
-add_executable(msgfmt ${msgfmt_SOURCES} gettext-runtime/intl/hash-string.c)
+add_executable(msgfmt ${msgfmt_SOURCES})
target_link_libraries(msgfmt libgettextsrc)
add_dependencies(msgfmt libgettextsrc libintl)
set(xgettext_SOURCES
- xgettext.c x-c.c x-po.c x-sh.c x-python.c x-lisp.c x-elisp.c x-librep.c
- x-scheme.c x-smalltalk.c x-java.c x-csharp.c x-awk.c x-ycp.c x-tcl.c x-perl.c
- x-php.c x-rst.c x-lua.c x-javascript.c x-vala.c x-desktop.c)
+ xgettext.c xg-pos.c xg-encoding.c xg-mixed-string.c xg-arglist-context.c
+ xg-arglist-callshape.c xg-arglist-parser.c xg-message.c x-c.c x-po.c x-sh.c
+ x-python.c x-lisp.c x-elisp.c x-librep.c x-scheme.c x-smalltalk.c x-java.c
+ x-csharp.c x-awk.c x-ycp.c x-tcl.c x-perl.c x-php.c x-rst.c x-lua.c
+ x-javascript.c x-vala.c x-desktop.c)
PREFIX_LIST_ITEMS(xgettext_SOURCES "gettext-tools/src/")
add_executable(xgettext ${xgettext_SOURCES})
@@ -258,9 +306,13 @@ set_property(TARGET msgmerge msgfmt xgettext libgettextsrc APPEND PROPERTY
${CMAKE_CURRENT_SOURCE_DIR}/gettext-tools/gnulib-lib
${CMAKE_CURRENT_SOURCE_DIR}/gettext-tools/gnulib-lib/libcroco
${CMAKE_CURRENT_SOURCE_DIR}/build-aux/snippet
+ ${CMAKE_CURRENT_SOURCE_DIR}/libtextstyle/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/libtextstyle/lib/libcroco
${CMAKE_CURRENT_BINARY_DIR}/gettext-runtime/intl
${CMAKE_CURRENT_BINARY_DIR}/gettext-tools
${CMAKE_CURRENT_BINARY_DIR}/gettext-tools/gnulib-lib
+ ${CMAKE_CURRENT_BINARY_DIR}/libtextstyle/lib
+ ${CMAKE_CURRENT_BINARY_DIR}/libtextstyle/lib/textstyle
${LIBICONV_INCLUDE_DIRS})
include(GNUInstallDirs)
diff --git a/third-party/patches/gettext-Fix-building-with-MSVC.patch b/third-party/patches/gettext-Fix-building-with-MSVC.patch
deleted file mode 100644
index d15901bce3..0000000000
--- a/third-party/patches/gettext-Fix-building-with-MSVC.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-diff --git a/gettext-tools/config.h.in b/gettext-tools/config.h.in
-index 6818a4d..9842a71 100644
---- a/gettext-tools/config.h.in
-+++ b/gettext-tools/config.h.in
-@@ -3147,7 +3147,7 @@
- #define PAGE_WIDTH 79
-
- /* On Windows, variables that may be in a DLL must be marked specially. */
--#if ((defined _MSC_VER && defined _DLL) || defined WOE32DLL) && !defined IN_RELOCWRAPPER
-+#if ((defined _MSC_VER && defined DLL_IMPORT) || defined WOE32DLL) && !defined IN_RELOCWRAPPER
- # define DLL_VARIABLE __declspec (dllimport)
- #else
- # define DLL_VARIABLE
-diff --git a/gettext-tools/gnulib-lib/javaversion.c b/gettext-tools/gnulib-lib/javaversion.c
-index d760c32..4867fda 100644
---- a/gettext-tools/gnulib-lib/javaversion.c
-+++ b/gettext-tools/gnulib-lib/javaversion.c
-@@ -39,7 +39,7 @@
- #define _(str) gettext (str)
-
- /* Get PKGDATADIR. */
--#include "configmake.h"
-+#define PKGDATADIR ""
-
-
- struct locals
-diff --git a/gettext-tools/libgettextpo/xalloc.h b/gettext-tools/libgettextpo/xalloc.h
-index f4a329e..a38dcf1 100644
---- a/gettext-tools/libgettextpo/xalloc.h
-+++ b/gettext-tools/libgettextpo/xalloc.h
-@@ -60,7 +60,7 @@ extern "C" {
- in charge of honoring the three previous items. This is the
- function to call when one wants the program to die because of a
- memory allocation failure. */
--extern void xalloc_die (void)
-+extern _Noreturn void xalloc_die (void)
- #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)) && !__STRICT_ANSI__
- __attribute__ ((__noreturn__))
- #endif
-diff --git a/gettext-tools/src/plural-exp.c b/gettext-tools/src/plural-exp.c
-index d5b9deb..e2c6bc4 100644
---- a/gettext-tools/src/plural-exp.c
-+++ b/gettext-tools/src/plural-exp.c
-@@ -17,5 +17,5 @@
-
- /* Include the expression parsing code from libintl, with different function
- names. */
--#include "../intl/pluralx.c"
-+#include "../intl/plural.c"
- #include "../../gettext-runtime/intl/plural-exp.c"