From 06d34c462699618b9491b5be14f5176d162f4540 Mon Sep 17 00:00:00 2001 From: StefanStojanovic Date: Thu, 22 Aug 2024 15:18:06 +0200 Subject: [PATCH] build: add required ICU patch changes Added new folder to include when dealing with ICU patches folder. Copied .h files to patches folder to fix include issues. --- configure.py | 1 + tools/icu/icu-generic.gyp | 1 + .../75/source/tools/genccode/pkg_genc.h | 111 +++++++++++ .../75/source/tools/pkgdata/pkg_genc.h | 111 +++++++++++ .../75/source/tools/pkgdata/pkgtypes.h | 172 ++++++++++++++++++ 5 files changed, 396 insertions(+) create mode 100644 tools/icu/patches/75/source/tools/genccode/pkg_genc.h create mode 100644 tools/icu/patches/75/source/tools/pkgdata/pkg_genc.h create mode 100644 tools/icu/patches/75/source/tools/pkgdata/pkgtypes.h diff --git a/configure.py b/configure.py index a4222691cb4d97..4aafc4be57df0f 100755 --- a/configure.py +++ b/configure.py @@ -2048,6 +2048,7 @@ def icu_download(path): 'genccode': 'tools/genccode', 'genrb': 'tools/genrb', 'icupkg': 'tools/icupkg', + 'pkgdata': 'tools/pkgdata', } # this creates a variable icu_src_XXX for each of the subdirs # with a list of the src files to use diff --git a/tools/icu/icu-generic.gyp b/tools/icu/icu-generic.gyp index 2655b9e694fc13..494e82dd730ccc 100644 --- a/tools/icu/icu-generic.gyp +++ b/tools/icu/icu-generic.gyp @@ -371,6 +371,7 @@ '<@(icu_src_common)', '<@(icu_src_i18n)', '<@(icu_src_stubdata)', + '<@(icu_src_pkgdata)', ], 'sources!': [ '<(icu_path)/source/tools/toolutil/udbgutil.cpp', diff --git a/tools/icu/patches/75/source/tools/genccode/pkg_genc.h b/tools/icu/patches/75/source/tools/genccode/pkg_genc.h new file mode 100644 index 00000000000000..76474ec7df6fd8 --- /dev/null +++ b/tools/icu/patches/75/source/tools/genccode/pkg_genc.h @@ -0,0 +1,111 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/****************************************************************************** + * Copyright (C) 2008-2011, International Business Machines + * Corporation and others. All Rights Reserved. + ******************************************************************************* + */ + +#ifndef __PKG_GENC_H__ +#define __PKG_GENC_H__ + +#include "unicode/utypes.h" +#include "toolutil.h" + +#include "unicode/putil.h" +#include "putilimp.h" + +/*** Platform #defines move here ***/ +#if U_PLATFORM_HAS_WIN32_API +#ifdef __GNUC__ +#define WINDOWS_WITH_GNUC +#else +#define WINDOWS_WITH_MSVC +#endif +#endif + + +#if !defined(WINDOWS_WITH_MSVC) +#define BUILD_DATA_WITHOUT_ASSEMBLY +#endif + +#ifndef U_DISABLE_OBJ_CODE /* testing */ +#if defined(WINDOWS_WITH_MSVC) || U_PLATFORM_IS_LINUX_BASED +#define CAN_WRITE_OBJ_CODE +#endif +#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) +#define CAN_GENERATE_OBJECTS +#endif +#endif + +#if U_PLATFORM == U_PF_CYGWIN || defined(CYGWINMSVC) +#define USING_CYGWIN +#endif + +/* + * When building the data library without assembly, + * some platforms use a single c code file for all of + * the data to generate the final data library. This can + * increase the performance of the pkdata tool. + */ +#if U_PLATFORM == U_PF_OS400 +#define USE_SINGLE_CCODE_FILE +#endif + +/* Need to fix the file seperator character when using MinGW. */ +#if defined(WINDOWS_WITH_GNUC) || defined(USING_CYGWIN) +#define PKGDATA_FILE_SEP_STRING "/" +#else +#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING +#endif + +#define LARGE_BUFFER_MAX_SIZE 2048 +#define SMALL_BUFFER_MAX_SIZE 512 +#define SMALL_BUFFER_FLAG_NAMES 32 +#define BUFFER_PADDING_SIZE 20 + +/** End platform defines **/ + + + +U_CAPI void U_EXPORT2 +printAssemblyHeadersToStdErr(void); + +U_CAPI UBool U_EXPORT2 +checkAssemblyHeaderName(const char* optAssembly); + +U_CAPI UBool U_EXPORT2 +checkCpuArchitecture(const char* optCpuArch); + +U_CAPI void U_EXPORT2 +writeCCode( + const char *filename, + const char *destdir, + const char *optEntryPoint, + const char *optName, + const char *optFilename, + char *outFilePath, + size_t outFilePathCapacity); + +U_CAPI void U_EXPORT2 +writeAssemblyCode( + const char *filename, + const char *destdir, + const char *optEntryPoint, + const char *optFilename, + char *outFilePath, + size_t outFilePathCapacity); + +U_CAPI void U_EXPORT2 +writeObjectCode( + const char *filename, + const char *destdir, + const char *optEntryPoint, + const char *optMatchArch, + const char *optCpuArch, + const char *optFilename, + char *outFilePath, + size_t outFilePathCapacity, + UBool optWinDllExport); + +#endif diff --git a/tools/icu/patches/75/source/tools/pkgdata/pkg_genc.h b/tools/icu/patches/75/source/tools/pkgdata/pkg_genc.h new file mode 100644 index 00000000000000..76474ec7df6fd8 --- /dev/null +++ b/tools/icu/patches/75/source/tools/pkgdata/pkg_genc.h @@ -0,0 +1,111 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/****************************************************************************** + * Copyright (C) 2008-2011, International Business Machines + * Corporation and others. All Rights Reserved. + ******************************************************************************* + */ + +#ifndef __PKG_GENC_H__ +#define __PKG_GENC_H__ + +#include "unicode/utypes.h" +#include "toolutil.h" + +#include "unicode/putil.h" +#include "putilimp.h" + +/*** Platform #defines move here ***/ +#if U_PLATFORM_HAS_WIN32_API +#ifdef __GNUC__ +#define WINDOWS_WITH_GNUC +#else +#define WINDOWS_WITH_MSVC +#endif +#endif + + +#if !defined(WINDOWS_WITH_MSVC) +#define BUILD_DATA_WITHOUT_ASSEMBLY +#endif + +#ifndef U_DISABLE_OBJ_CODE /* testing */ +#if defined(WINDOWS_WITH_MSVC) || U_PLATFORM_IS_LINUX_BASED +#define CAN_WRITE_OBJ_CODE +#endif +#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) +#define CAN_GENERATE_OBJECTS +#endif +#endif + +#if U_PLATFORM == U_PF_CYGWIN || defined(CYGWINMSVC) +#define USING_CYGWIN +#endif + +/* + * When building the data library without assembly, + * some platforms use a single c code file for all of + * the data to generate the final data library. This can + * increase the performance of the pkdata tool. + */ +#if U_PLATFORM == U_PF_OS400 +#define USE_SINGLE_CCODE_FILE +#endif + +/* Need to fix the file seperator character when using MinGW. */ +#if defined(WINDOWS_WITH_GNUC) || defined(USING_CYGWIN) +#define PKGDATA_FILE_SEP_STRING "/" +#else +#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING +#endif + +#define LARGE_BUFFER_MAX_SIZE 2048 +#define SMALL_BUFFER_MAX_SIZE 512 +#define SMALL_BUFFER_FLAG_NAMES 32 +#define BUFFER_PADDING_SIZE 20 + +/** End platform defines **/ + + + +U_CAPI void U_EXPORT2 +printAssemblyHeadersToStdErr(void); + +U_CAPI UBool U_EXPORT2 +checkAssemblyHeaderName(const char* optAssembly); + +U_CAPI UBool U_EXPORT2 +checkCpuArchitecture(const char* optCpuArch); + +U_CAPI void U_EXPORT2 +writeCCode( + const char *filename, + const char *destdir, + const char *optEntryPoint, + const char *optName, + const char *optFilename, + char *outFilePath, + size_t outFilePathCapacity); + +U_CAPI void U_EXPORT2 +writeAssemblyCode( + const char *filename, + const char *destdir, + const char *optEntryPoint, + const char *optFilename, + char *outFilePath, + size_t outFilePathCapacity); + +U_CAPI void U_EXPORT2 +writeObjectCode( + const char *filename, + const char *destdir, + const char *optEntryPoint, + const char *optMatchArch, + const char *optCpuArch, + const char *optFilename, + char *outFilePath, + size_t outFilePathCapacity, + UBool optWinDllExport); + +#endif diff --git a/tools/icu/patches/75/source/tools/pkgdata/pkgtypes.h b/tools/icu/patches/75/source/tools/pkgdata/pkgtypes.h new file mode 100644 index 00000000000000..51c11e0a14d751 --- /dev/null +++ b/tools/icu/patches/75/source/tools/pkgdata/pkgtypes.h @@ -0,0 +1,172 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/************************************************************************** +* +* Copyright (C) 2000-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +*************************************************************************** +* file name: pkgdata.c +* encoding: ANSI X3.4 (1968) +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2000may16 +* created by: Steven \u24C7 Loomis +* +* common types for pkgdata +*/ + +#ifndef _PKGTYPES +#define _PKGTYPES + +/* headers */ +#include "unicode/utypes.h" +#include "filestrm.h" + +/* linked list */ +struct _CharList; + +typedef struct _CharList +{ + const char *str; + struct _CharList *next; +} CharList; + + + +/* + * write CharList 'l' into stream 's' using delimiter 'delim' (delim can be nullptr). quoted: -1 remove, 0 as is, 1 add quotes + */ +const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quoted); + +/* + * Same, but use line breaks. quoted: -1 remove, 0 as is, 1 add quotes + */ +const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim, const char *brk, int32_t quoted); + + +/* + * Count items . 0 if null + */ +uint32_t pkg_countCharList(CharList *l); + +/* + * Prepend string to CharList. Str is adopted! + */ +CharList *pkg_prependToList(CharList *l, const char *str); + +/* + * append string to CharList. *end or even end can be null if you don't + * know it.[slow] + * Str is adopted! + */ +CharList *pkg_appendToList(CharList *l, CharList** end, const char *str); + +/* + * strAlias is an alias to a full or relative path to a FILE. This function + * will search strAlias for the directory name (with strrchr). Then, it will + * determine if that directory is already in list l. If not, it will add it + * with strdup(strAlias). + * @param l list to append to , or nullptr + * @param end end pointer-to-pointer. Can point to null, or be null. + * @param strAlias alias to full path string + * @return new list + */ +CharList *pkg_appendUniqueDirToList(CharList *l, CharList** end, const char *strAlias); + +/* + * does list contain string? Returns: t/f + */ +UBool pkg_listContains(CharList *l, const char *str); + +/* + * Delete list + */ +void pkg_deleteList(CharList *l); + +/* + * Mode package function + */ +struct UPKGOptions_; +typedef void (UPKGMODE)(struct UPKGOptions_ *, FileStream *s, UErrorCode *status); + +/* + * Static mode - write the readme file + * @param opt UPKGOptions + * @param libName Name of the .lib, etc file + * @param status ICU error code + */ +void pkg_sttc_writeReadme(struct UPKGOptions_ *opt, const char *libName, UErrorCode *status); + +/* + * Options to be passed throughout the program + */ + +typedef struct UPKGOptions_ +{ + CharList *fileListFiles; /* list of files containing files for inclusion in the package */ + CharList *filePaths; /* All the files, with long paths */ + CharList *files; /* All the files */ + CharList *outFiles; /* output files [full paths] */ + + const char *shortName; /* name of what we're building */ + const char *cShortName; /* name of what we're building as a C identifier */ + const char *entryName; /* special entrypoint name */ + const char *targetDir; /* dir for packaged data to go */ + const char *dataDir; /* parent of dir for package (default: tmpdir) */ + const char *tmpDir; + const char *srcDir; + const char *options; /* Options arg */ + const char *mode; /* Mode of building */ + const char *version; /* Library version */ + const char *comment; /* comment string */ + const char *install; /* Where to install to (nullptr = don't install) */ + const char *icuroot; /* where does ICU lives */ + const char *libName; /* name for library (default: shortName) */ + UBool rebuild; + UBool verbose; + UBool quiet; + UBool withoutAssembly; + UBool pdsbuild; /* for building PDS in z/OS */ +} UPKGOptions; + +char * convertToNativePathSeparators(char *path); + + +/* set up common defines for library naming */ + +#if U_PLATFORM_HAS_WIN32_API +# ifndef UDATA_SO_SUFFIX +# define UDATA_SO_SUFFIX ".dll" +# endif +# define LIB_PREFIX "" +# define LIB_STATIC_PREFIX "" +# define OBJ_SUFFIX ".obj" +# define UDATA_LIB_SUFFIX ".lib" + +#elif U_PLATFORM == U_PF_CYGWIN +# define LIB_PREFIX "cyg" +# define LIB_STATIC_PREFIX "lib" +# define OBJ_SUFFIX ".o" +# define UDATA_LIB_SUFFIX ".a" + +#else /* POSIX? */ +# define LIB_PREFIX "lib" +# define LIB_STATIC_PREFIX "lib" +# define OBJ_SUFFIX ".o" +# define UDATA_LIB_SUFFIX ".a" +#endif + +#define ASM_SUFFIX ".s" + +/* defines for common file names */ +#define UDATA_CMN_PREFIX "" +#define UDATA_CMN_SUFFIX ".dat" +#define UDATA_CMN_INTERMEDIATE_SUFFIX "_dat" + +#define ICUDATA_RES_FILE "icudata.res" + +#define PKGDATA_DERIVED_PATH '\t' + +#endif