[0-9]+(?:\.[0-9]+)*) # release segment
- (?P # pre-release
- [-_\.]?
- (?Palpha|a|beta|b|preview|pre|c|rc)
- [-_\.]?
- (?P[0-9]+)?
- )?
- (?P # post release
- (?:-(?P[0-9]+))
- |
- (?:
- [-_\.]?
- (?Ppost|rev|r)
- [-_\.]?
- (?P[0-9]+)?
- )
- )?
- (?P # dev release
- [-_\.]?
- (?Pdev)
- [-_\.]?
- (?P[0-9]+)?
- )?
- )
- (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
-"""
-
-VERSION_PATTERN = _VERSION_PATTERN
-"""
-A string containing the regular expression used to match a valid version.
-
-The pattern is not anchored at either end, and is intended for embedding in larger
-expressions (for example, matching a version number as part of a file name). The
-regular expression should be compiled with the ``re.VERBOSE`` and ``re.IGNORECASE``
-flags set.
-
-:meta hide-value:
-"""
-
-
-class Version(_BaseVersion):
- """This class abstracts handling of a project's versions.
-
- A :class:`Version` instance is comparison aware and can be compared and
- sorted using the standard Python interfaces.
-
- >>> v1 = Version("1.0a5")
- >>> v2 = Version("1.0")
- >>> v1
-
- >>> v2
-
- >>> v1 < v2
- True
- >>> v1 == v2
- False
- >>> v1 > v2
- False
- >>> v1 >= v2
- False
- >>> v1 <= v2
- True
- """
-
- _regex = re.compile(r"^\s*" + VERSION_PATTERN + r"\s*$", re.VERBOSE | re.IGNORECASE)
- _key: CmpKey
-
- def __init__(self, version: str) -> None:
- """Initialize a Version object.
-
- :param version:
- The string representation of a version which will be parsed and normalized
- before use.
- :raises InvalidVersion:
- If the ``version`` does not conform to PEP 440 in any way then this
- exception will be raised.
- """
-
- # Validate the version and parse it into pieces
- match = self._regex.search(version)
- if not match:
- raise InvalidVersion(f"Invalid version: '{version}'")
-
- # Store the parsed out pieces of the version
- self._version = _Version(
- epoch=int(match.group("epoch")) if match.group("epoch") else 0,
- release=tuple(int(i) for i in match.group("release").split(".")),
- pre=_parse_letter_version(match.group("pre_l"), match.group("pre_n")),
- post=_parse_letter_version(
- match.group("post_l"), match.group("post_n1") or match.group("post_n2")
- ),
- dev=_parse_letter_version(match.group("dev_l"), match.group("dev_n")),
- local=_parse_local_version(match.group("local")),
- )
-
- # Generate a key which will be used for sorting
- self._key = _cmpkey(
- self._version.epoch,
- self._version.release,
- self._version.pre,
- self._version.post,
- self._version.dev,
- self._version.local,
- )
-
- def __repr__(self) -> str:
- """A representation of the Version that shows all internal state.
-
- >>> Version('1.0.0')
-
- """
- return f""
-
- def __str__(self) -> str:
- """A string representation of the version that can be rounded-tripped.
-
- >>> str(Version("1.0a5"))
- '1.0a5'
- """
- parts = []
-
- # Epoch
- if self.epoch != 0:
- parts.append(f"{self.epoch}!")
-
- # Release segment
- parts.append(".".join(str(x) for x in self.release))
-
- # Pre-release
- if self.pre is not None:
- parts.append("".join(str(x) for x in self.pre))
-
- # Post-release
- if self.post is not None:
- parts.append(f".post{self.post}")
-
- # Development release
- if self.dev is not None:
- parts.append(f".dev{self.dev}")
-
- # Local version segment
- if self.local is not None:
- parts.append(f"+{self.local}")
-
- return "".join(parts)
-
- @property
- def epoch(self) -> int:
- """The epoch of the version.
-
- >>> Version("2.0.0").epoch
- 0
- >>> Version("1!2.0.0").epoch
- 1
- """
- return self._version.epoch
-
- @property
- def release(self) -> Tuple[int, ...]:
- """The components of the "release" segment of the version.
-
- >>> Version("1.2.3").release
- (1, 2, 3)
- >>> Version("2.0.0").release
- (2, 0, 0)
- >>> Version("1!2.0.0.post0").release
- (2, 0, 0)
-
- Includes trailing zeroes but not the epoch or any pre-release / development /
- post-release suffixes.
- """
- return self._version.release
-
- @property
- def pre(self) -> Optional[Tuple[str, int]]:
- """The pre-release segment of the version.
-
- >>> print(Version("1.2.3").pre)
- None
- >>> Version("1.2.3a1").pre
- ('a', 1)
- >>> Version("1.2.3b1").pre
- ('b', 1)
- >>> Version("1.2.3rc1").pre
- ('rc', 1)
- """
- return self._version.pre
-
- @property
- def post(self) -> Optional[int]:
- """The post-release number of the version.
-
- >>> print(Version("1.2.3").post)
- None
- >>> Version("1.2.3.post1").post
- 1
- """
- return self._version.post[1] if self._version.post else None
-
- @property
- def dev(self) -> Optional[int]:
- """The development number of the version.
-
- >>> print(Version("1.2.3").dev)
- None
- >>> Version("1.2.3.dev1").dev
- 1
- """
- return self._version.dev[1] if self._version.dev else None
-
- @property
- def local(self) -> Optional[str]:
- """The local version segment of the version.
-
- >>> print(Version("1.2.3").local)
- None
- >>> Version("1.2.3+abc").local
- 'abc'
- """
- if self._version.local:
- return ".".join(str(x) for x in self._version.local)
- else:
- return None
-
- @property
- def public(self) -> str:
- """The public portion of the version.
-
- >>> Version("1.2.3").public
- '1.2.3'
- >>> Version("1.2.3+abc").public
- '1.2.3'
- >>> Version("1.2.3+abc.dev1").public
- '1.2.3'
- """
- return str(self).split("+", 1)[0]
-
- @property
- def base_version(self) -> str:
- """The "base version" of the version.
-
- >>> Version("1.2.3").base_version
- '1.2.3'
- >>> Version("1.2.3+abc").base_version
- '1.2.3'
- >>> Version("1!1.2.3+abc.dev1").base_version
- '1!1.2.3'
-
- The "base version" is the public version of the project without any pre or post
- release markers.
- """
- parts = []
-
- # Epoch
- if self.epoch != 0:
- parts.append(f"{self.epoch}!")
-
- # Release segment
- parts.append(".".join(str(x) for x in self.release))
-
- return "".join(parts)
-
- @property
- def is_prerelease(self) -> bool:
- """Whether this version is a pre-release.
-
- >>> Version("1.2.3").is_prerelease
- False
- >>> Version("1.2.3a1").is_prerelease
- True
- >>> Version("1.2.3b1").is_prerelease
- True
- >>> Version("1.2.3rc1").is_prerelease
- True
- >>> Version("1.2.3dev1").is_prerelease
- True
- """
- return self.dev is not None or self.pre is not None
-
- @property
- def is_postrelease(self) -> bool:
- """Whether this version is a post-release.
-
- >>> Version("1.2.3").is_postrelease
- False
- >>> Version("1.2.3.post1").is_postrelease
- True
- """
- return self.post is not None
-
- @property
- def is_devrelease(self) -> bool:
- """Whether this version is a development release.
-
- >>> Version("1.2.3").is_devrelease
- False
- >>> Version("1.2.3.dev1").is_devrelease
- True
- """
- return self.dev is not None
-
- @property
- def major(self) -> int:
- """The first item of :attr:`release` or ``0`` if unavailable.
-
- >>> Version("1.2.3").major
- 1
- """
- return self.release[0] if len(self.release) >= 1 else 0
-
- @property
- def minor(self) -> int:
- """The second item of :attr:`release` or ``0`` if unavailable.
-
- >>> Version("1.2.3").minor
- 2
- >>> Version("1").minor
- 0
- """
- return self.release[1] if len(self.release) >= 2 else 0
-
- @property
- def micro(self) -> int:
- """The third item of :attr:`release` or ``0`` if unavailable.
-
- >>> Version("1.2.3").micro
- 3
- >>> Version("1").micro
- 0
- """
- return self.release[2] if len(self.release) >= 3 else 0
-
-
-def _parse_letter_version(
- letter: Optional[str], number: Union[str, bytes, SupportsInt, None]
-) -> Optional[Tuple[str, int]]:
-
- if letter:
- # We consider there to be an implicit 0 in a pre-release if there is
- # not a numeral associated with it.
- if number is None:
- number = 0
-
- # We normalize any letters to their lower case form
- letter = letter.lower()
-
- # We consider some words to be alternate spellings of other words and
- # in those cases we want to normalize the spellings to our preferred
- # spelling.
- if letter == "alpha":
- letter = "a"
- elif letter == "beta":
- letter = "b"
- elif letter in ["c", "pre", "preview"]:
- letter = "rc"
- elif letter in ["rev", "r"]:
- letter = "post"
-
- return letter, int(number)
- if not letter and number:
- # We assume if we are given a number, but we are not given a letter
- # then this is using the implicit post release syntax (e.g. 1.0-1)
- letter = "post"
-
- return letter, int(number)
-
- return None
-
-
-_local_version_separators = re.compile(r"[\._-]")
-
-
-def _parse_local_version(local: Optional[str]) -> Optional[LocalType]:
- """
- Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
- """
- if local is not None:
- return tuple(
- part.lower() if not part.isdigit() else int(part)
- for part in _local_version_separators.split(local)
- )
- return None
-
-
-def _cmpkey(
- epoch: int,
- release: Tuple[int, ...],
- pre: Optional[Tuple[str, int]],
- post: Optional[Tuple[str, int]],
- dev: Optional[Tuple[str, int]],
- local: Optional[LocalType],
-) -> CmpKey:
-
- # When we compare a release version, we want to compare it with all of the
- # trailing zeros removed. So we'll use a reverse the list, drop all the now
- # leading zeros until we come to something non zero, then take the rest
- # re-reverse it back into the correct order and make it a tuple and use
- # that for our sorting key.
- _release = tuple(
- reversed(list(itertools.dropwhile(lambda x: x == 0, reversed(release))))
- )
-
- # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
- # We'll do this by abusing the pre segment, but we _only_ want to do this
- # if there is not a pre or a post segment. If we have one of those then
- # the normal sorting rules will handle this case correctly.
- if pre is None and post is None and dev is not None:
- _pre: CmpPrePostDevType = NegativeInfinity
- # Versions without a pre-release (except as noted above) should sort after
- # those with one.
- elif pre is None:
- _pre = Infinity
- else:
- _pre = pre
-
- # Versions without a post segment should sort before those with one.
- if post is None:
- _post: CmpPrePostDevType = NegativeInfinity
-
- else:
- _post = post
-
- # Versions without a development segment should sort after those with one.
- if dev is None:
- _dev: CmpPrePostDevType = Infinity
-
- else:
- _dev = dev
-
- if local is None:
- # Versions without a local segment should sort before those with one.
- _local: CmpLocalType = NegativeInfinity
- else:
- # Versions with a local segment need that segment parsed to implement
- # the sorting rules in PEP440.
- # - Alpha numeric segments sort before numeric segments
- # - Alpha numeric segments sort lexicographically
- # - Numeric segments sort numerically
- # - Shorter versions sort before longer versions when the prefixes
- # match exactly
- _local = tuple(
- (i, "") if isinstance(i, int) else (NegativeInfinity, i) for i in local
- )
-
- return epoch, _release, _pre, _post, _dev, _local
diff --git a/tools/gyp/pyproject.toml b/tools/gyp/pyproject.toml
deleted file mode 100644
index 487cb75002d..00000000000
--- a/tools/gyp/pyproject.toml
+++ /dev/null
@@ -1,116 +0,0 @@
-[build-system]
-requires = ["setuptools>=61.0"]
-build-backend = "setuptools.build_meta"
-
-[project]
-name = "gyp-next"
-version = "0.22.2"
-authors = [
- { name="Node.js contributors", email="ryzokuken@disroot.org" },
-]
-description = "A fork of the GYP build system for use in the Node.js projects"
-readme = "README.md"
-license = "BSD-3-Clause"
-license-files = ["LICENSE"]
-requires-python = ">=3.9"
-dependencies = ["packaging>=24.0", "setuptools>=77.0.3"]
-classifiers = [
- "Development Status :: 3 - Alpha",
- "Environment :: Console",
- "Intended Audience :: Developers",
- "Natural Language :: English",
- "Programming Language :: Python",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.9",
- "Programming Language :: Python :: 3.10",
- "Programming Language :: Python :: 3.11",
- "Programming Language :: Python :: 3.12",
- "Programming Language :: Python :: 3.13",
- "Programming Language :: Python :: 3.14",
-]
-
-[project.optional-dependencies]
-dev = ["pytest", "ruff"]
-
-[project.scripts]
-gyp = "gyp:script_main"
-
-[project.urls]
-"Homepage" = "https://github.com/nodejs/gyp-next"
-
-[tool.ruff]
-extend-exclude = ["pylib/packaging"]
-line-length = 88
-
-[tool.ruff.lint]
-select = [
- "C4", # flake8-comprehensions
- "C90", # McCabe cyclomatic complexity
- "DTZ", # flake8-datetimez
- "E", # pycodestyle
- "F", # Pyflakes
- "G", # flake8-logging-format
- "ICN", # flake8-import-conventions
- "INT", # flake8-gettext
- "PL", # Pylint
- "PYI", # flake8-pyi
- "RSE", # flake8-raise
- "RUF", # Ruff-specific rules
- "T10", # flake8-debugger
- "TCH", # flake8-type-checking
- "TID", # flake8-tidy-imports
- "UP", # pyupgrade
- "W", # pycodestyle
- "YTT", # flake8-2020
- # "A", # flake8-builtins
- # "ANN", # flake8-annotations
- # "ARG", # flake8-unused-arguments
- # "B", # flake8-bugbear
- # "BLE", # flake8-blind-except
- # "COM", # flake8-commas
- # "D", # pydocstyle
- # "DJ", # flake8-django
- # "EM", # flake8-errmsg
- # "ERA", # eradicate
- # "EXE", # flake8-executable
- # "FBT", # flake8-boolean-trap
- # "I", # isort
- # "INP", # flake8-no-pep420
- # "ISC", # flake8-implicit-str-concat
- # "N", # pep8-naming
- # "NPY", # NumPy-specific rules
- # "PD", # pandas-vet
- # "PGH", # pygrep-hooks
- # "PIE", # flake8-pie
- # "PT", # flake8-pytest-style
- # "PTH", # flake8-use-pathlib
- # "Q", # flake8-quotes
- # "RET", # flake8-return
- # "S", # flake8-bandit
- # "SIM", # flake8-simplify
- # "SLF", # flake8-self
- # "T20", # flake8-print
- # "TRY", # tryceratops
-]
-ignore = [
- "PLR1714",
- "PLW0603",
- "PLW2901",
- "RUF005",
- "RUF012",
- "UP031",
-]
-
-[tool.ruff.lint.mccabe]
-max-complexity = 101
-
-[tool.ruff.lint.pylint]
-allow-magic-value-types = ["float", "int", "str"]
-max-args = 11
-max-branches = 108
-max-returns = 10
-max-statements = 286
-
-[tool.setuptools]
-package-dir = {"" = "pylib"}
-packages = ["gyp", "gyp.generator"]
diff --git a/tools/gyp/release-please-config.json b/tools/gyp/release-please-config.json
deleted file mode 100644
index b6cad32a2dd..00000000000
--- a/tools/gyp/release-please-config.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "last-release-sha": "78756421b0d7bb335992a9c7d26ba3cc8b619708",
- "packages": {
- ".": {
- "release-type": "python",
- "package-name": "gyp-next",
- "bump-minor-pre-major": true,
- "include-component-in-tag": false
- }
- }
-}
diff --git a/tools/gyp/test/fixtures/expected-darwin/cmake/CMakeLists.txt b/tools/gyp/test/fixtures/expected-darwin/cmake/CMakeLists.txt
deleted file mode 100644
index 90b95e75eb5..00000000000
--- a/tools/gyp/test/fixtures/expected-darwin/cmake/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
-cmake_policy(VERSION 2.8.8)
-project(test)
-set(configuration "Default")
-enable_language(ASM)
-set(builddir "${CMAKE_CURRENT_BINARY_DIR}")
-set(obj "${builddir}/obj")
-
-set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
-set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
-
-
-
-#*/gyp-next/test/fixtures/integration.gyp:test#target
-set(TARGET "test")
-set(TOOLSET "target")
-set(test__cxx_srcs "../../test.cc")
-link_directories( ../../mylib
-)
-add_executable(test ${test__cxx_srcs})
-set_target_properties(test PROPERTIES EXCLUDE_FROM_ALL "FALSE")
-set_target_properties(test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${builddir}")
-set_target_properties(test PROPERTIES PREFIX "")
-set_target_properties(test PROPERTIES RUNTIME_OUTPUT_NAME "test")
-set_target_properties(test PROPERTIES SUFFIX "")
-set_source_files_properties(${builddir}/test PROPERTIES GENERATED "TRUE")
-set(test__include_dirs "${CMAKE_CURRENT_LIST_DIR}/../../include")
-set_property(TARGET test APPEND PROPERTY INCLUDE_DIRECTORIES ${test__include_dirs})
-set_target_properties(test PROPERTIES COMPILE_FLAGS "-fasm-blocks -mpascal-strings -Os -gdwarf-2 -arch x86_64 ")
-unset(TOOLSET)
-unset(TARGET)
diff --git a/tools/gyp/test/fixtures/expected-darwin/make/test.target.mk b/tools/gyp/test/fixtures/expected-darwin/make/test.target.mk
deleted file mode 100644
index c9e16b63445..00000000000
--- a/tools/gyp/test/fixtures/expected-darwin/make/test.target.mk
+++ /dev/null
@@ -1,86 +0,0 @@
-# This file is generated by gyp; do not edit.
-
-TOOLSET := target
-TARGET := test
-DEFS_Default :=
-
-# Flags passed to all source files.
-CFLAGS_Default := \
- -fasm-blocks \
- -mpascal-strings \
- -Os \
- -gdwarf-2 \
- -arch \
- x86_64
-
-# Flags passed to only C files.
-CFLAGS_C_Default :=
-
-# Flags passed to only C++ files.
-CFLAGS_CC_Default :=
-
-# Flags passed to only ObjC files.
-CFLAGS_OBJC_Default :=
-
-# Flags passed to only ObjC++ files.
-CFLAGS_OBJCC_Default :=
-
-INCS_Default := \
- -I$(srcdir)/include
-
-OBJS := \
- $(obj).target/$(TARGET)/test.o
-
-# Add to the list of files we specially track dependencies for.
-all_deps += $(OBJS)
-
-# CFLAGS et al overrides must be target-local.
-# See "Target-specific Variable Values" in the GNU Make manual.
-$(OBJS): TOOLSET := $(TOOLSET)
-$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
-$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
-$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))
-$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))
-
-# Suffix rules, putting all outputs into $(obj).
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-# Try building from generated source, too.
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-# End of this set of suffix rules
-### Rules for final target.
-LDFLAGS_Default := \
- -arch \
- x86_64 \
- -L$(builddir) \
- -L$(srcdir)/mylib
-
-LIBTOOLFLAGS_Default :=
-
-LIBS :=
-
-$(builddir)/test: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
-$(builddir)/test: LIBS := $(LIBS)
-$(builddir)/test: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))
-$(builddir)/test: LD_INPUTS := $(OBJS)
-$(builddir)/test: TOOLSET := $(TOOLSET)
-$(builddir)/test: $(OBJS) FORCE_DO_CMD
- $(call do_cmd,link)
-
-all_deps += $(builddir)/test
-# Add target alias
-.PHONY: test
-test: $(builddir)/test
-
-# Add executable to "all" target.
-.PHONY: all
-all: $(builddir)/test
-
diff --git a/tools/gyp/test/fixtures/expected-darwin/ninja/test.ninja b/tools/gyp/test/fixtures/expected-darwin/ninja/test.ninja
deleted file mode 100644
index fcb13208633..00000000000
--- a/tools/gyp/test/fixtures/expected-darwin/ninja/test.ninja
+++ /dev/null
@@ -1,15 +0,0 @@
-defines =
-includes = -I../../include
-cflags = -fasm-blocks -mpascal-strings -Os -gdwarf-2 -arch x86_64
-cflags_c =
-cflags_cc =
-cflags_objc = $cflags_c
-cflags_objcc = $cflags_cc
-arflags =
-
-build obj/test.test.o: cxx ../../test.cc
-
-ldflags = -arch x86_64 -L./
-libs = -L../../mylib
-build test: link obj/test.test.o
- ld = $ldxx
diff --git a/tools/gyp/test/fixtures/expected-linux/cmake/CMakeLists.txt b/tools/gyp/test/fixtures/expected-linux/cmake/CMakeLists.txt
deleted file mode 100644
index 968642201ac..00000000000
--- a/tools/gyp/test/fixtures/expected-linux/cmake/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
-cmake_policy(VERSION 2.8.8)
-project(test)
-set(configuration "Default")
-enable_language(ASM)
-set(builddir "${CMAKE_CURRENT_BINARY_DIR}")
-set(obj "${builddir}/obj")
-
-set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
-set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
-
-set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1)
-
-
-#*/test/fixtures/integration.gyp:test#target
-set(TARGET "test")
-set(TOOLSET "target")
-set(test__cxx_srcs "../../test.cc")
-link_directories( ../../mylib
-)
-add_executable(test ${test__cxx_srcs})
-set_target_properties(test PROPERTIES EXCLUDE_FROM_ALL "FALSE")
-set_target_properties(test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${builddir}")
-set_target_properties(test PROPERTIES PREFIX "")
-set_target_properties(test PROPERTIES RUNTIME_OUTPUT_NAME "test")
-set_target_properties(test PROPERTIES SUFFIX "")
-set_source_files_properties(${builddir}/test PROPERTIES GENERATED "TRUE")
-set(test__include_dirs "${CMAKE_CURRENT_LIST_DIR}/../../include")
-set_property(TARGET test APPEND PROPERTY INCLUDE_DIRECTORIES ${test__include_dirs})
-set_target_properties(test PROPERTIES COMPILE_FLAGS "")
-unset(TOOLSET)
-unset(TARGET)
diff --git a/tools/gyp/test/fixtures/expected-linux/make/test.target.mk b/tools/gyp/test/fixtures/expected-linux/make/test.target.mk
deleted file mode 100644
index bae91717b42..00000000000
--- a/tools/gyp/test/fixtures/expected-linux/make/test.target.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-# This file is generated by gyp; do not edit.
-
-TOOLSET := target
-TARGET := test
-DEFS_Default :=
-
-# Flags passed to all source files.
-CFLAGS_Default :=
-
-# Flags passed to only C files.
-CFLAGS_C_Default :=
-
-# Flags passed to only C++ files.
-CFLAGS_CC_Default :=
-
-INCS_Default := \
- -I$(srcdir)/include
-
-OBJS := \
- $(obj).target/$(TARGET)/test.o
-
-# Add to the list of files we specially track dependencies for.
-all_deps += $(OBJS)
-
-# CFLAGS et al overrides must be target-local.
-# See "Target-specific Variable Values" in the GNU Make manual.
-$(OBJS): TOOLSET := $(TOOLSET)
-$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
-$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
-
-# Suffix rules, putting all outputs into $(obj).
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-# Try building from generated source, too.
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
- @$(call do_cmd,cxx,1)
-
-# End of this set of suffix rules
-### Rules for final target.
-LDFLAGS_Default := \
- -L$(srcdir)/mylib
-
-LIBS :=
-
-$(builddir)/test: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
-$(builddir)/test: LIBS := $(LIBS)
-$(builddir)/test: LD_INPUTS := $(OBJS)
-$(builddir)/test: TOOLSET := $(TOOLSET)
-$(builddir)/test: $(OBJS) FORCE_DO_CMD
- $(call do_cmd,link)
-
-all_deps += $(builddir)/test
-# Add target alias
-.PHONY: test
-test: $(builddir)/test
-
-# Add executable to "all" target.
-.PHONY: all
-all: $(builddir)/test
-
diff --git a/tools/gyp/test/fixtures/expected-linux/ninja/test.ninja b/tools/gyp/test/fixtures/expected-linux/ninja/test.ninja
deleted file mode 100644
index 15c6c3d6978..00000000000
--- a/tools/gyp/test/fixtures/expected-linux/ninja/test.ninja
+++ /dev/null
@@ -1,13 +0,0 @@
-defines =
-includes = -I../../include
-cflags =
-cflags_c =
-cflags_cc =
-arflags =
-
-build obj/test.test.o: cxx ../../test.cc
-
-ldflags =
-libs = -L../../mylib
-build test: link obj/test.test.o
- ld = $ldxx
diff --git a/tools/gyp/test/fixtures/expected-win32/msvs/integration.sln b/tools/gyp/test/fixtures/expected-win32/msvs/integration.sln
deleted file mode 100644
index 276e0693118..00000000000
--- a/tools/gyp/test/fixtures/expected-win32/msvs/integration.sln
+++ /dev/null
@@ -1,16 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{*}") = "test", "test.vcproj", "{*}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Default|Win32 = Default|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {*}.Default|Win32.ActiveCfg = Default|Win32
- {*}.Default|Win32.Build.0 = Default|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/tools/gyp/test/fixtures/expected-win32/msvs/test.vcproj b/tools/gyp/test/fixtures/expected-win32/msvs/test.vcproj
deleted file mode 100644
index 981a106ce47..00000000000
--- a/tools/gyp/test/fixtures/expected-win32/msvs/test.vcproj
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/tools/gyp/test/fixtures/include/test.h b/tools/gyp/test/fixtures/include/test.h
deleted file mode 100644
index eacbb8d7731..00000000000
--- a/tools/gyp/test/fixtures/include/test.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-int foo();
diff --git a/tools/gyp/test/fixtures/integration.gyp b/tools/gyp/test/fixtures/integration.gyp
deleted file mode 100644
index c4835117002..00000000000
--- a/tools/gyp/test/fixtures/integration.gyp
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- 'targets': [
- {
- 'target_name': 'test',
- 'type': 'executable',
- 'sources': [
- 'test.cc',
- ],
- 'include_dirs': [
- 'include',
- ],
- 'library_dirs': [
- 'mylib'
- ],
- },
- ]
-}
diff --git a/tools/gyp/test/fixtures/test.cc b/tools/gyp/test/fixtures/test.cc
deleted file mode 100644
index 8b1ecf89811..00000000000
--- a/tools/gyp/test/fixtures/test.cc
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "test.h"
-
-int main() {
- return foo();
-}
-
-int foo() {
- return 0;
-}
diff --git a/tools/gyp/test/integration_test.py b/tools/gyp/test/integration_test.py
deleted file mode 100644
index 26d78763078..00000000000
--- a/tools/gyp/test/integration_test.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python3
-
-"""Integration test"""
-
-import os
-import re
-import shutil
-import sys
-import unittest
-
-import gyp
-
-fixture_dir = os.path.join(os.path.dirname(__file__), "fixtures")
-gyp_file = os.path.join(os.path.dirname(__file__), "fixtures/integration.gyp")
-
-if sys.platform == "win32":
- sysname = sys.platform
-else:
- sysname = os.uname().sysname.lower()
-expected_dir = os.path.join(fixture_dir, f"expected-{sysname}")
-
-
-def assert_file(test, actual, expected) -> None:
- actual_filepath = os.path.join(fixture_dir, actual)
- expected_filepath = os.path.join(expected_dir, expected)
-
- with open(expected_filepath) as in_file:
- in_bytes = in_file.read()
- in_bytes = in_bytes.strip()
- expected_bytes = re.escape(in_bytes)
- expected_bytes = expected_bytes.replace("\\*", ".*")
- expected_re = re.compile(expected_bytes)
-
- with open(actual_filepath) as in_file:
- actual_bytes = in_file.read()
- actual_bytes = actual_bytes.strip()
-
- try:
- test.assertRegex(actual_bytes, expected_re)
- except Exception:
- shutil.copyfile(actual_filepath, f"{expected_filepath}.actual")
- raise
-
-
-class TestGypUnix(unittest.TestCase):
- supported_sysnames = {"darwin", "linux"}
-
- def setUp(self) -> None:
- if sysname not in TestGypUnix.supported_sysnames:
- self.skipTest(f"Unsupported system: {sysname}")
- shutil.rmtree(os.path.join(fixture_dir, "out"), ignore_errors=True)
-
- def test_ninja(self) -> None:
- rc = gyp.main(["-f", "ninja", "--depth", fixture_dir, gyp_file])
- assert rc == 0
-
- assert_file(self, "out/Default/obj/test.ninja", "ninja/test.ninja")
-
- def test_make(self) -> None:
- rc = gyp.main(
- [
- "-f",
- "make",
- "--depth",
- fixture_dir,
- "--generator-output",
- "out",
- gyp_file,
- ]
- )
- assert rc == 0
-
- assert_file(self, "out/test.target.mk", "make/test.target.mk")
-
- def test_cmake(self) -> None:
- rc = gyp.main(["-f", "cmake", "--depth", fixture_dir, gyp_file])
- assert rc == 0
-
- assert_file(self, "out/Default/CMakeLists.txt", "cmake/CMakeLists.txt")
-
-
-class TestGypWindows(unittest.TestCase):
- def setUp(self) -> None:
- if sys.platform != "win32":
- self.skipTest("Windows-only test")
- shutil.rmtree(os.path.join(fixture_dir, "out"), ignore_errors=True)
-
- def test_msvs(self) -> None:
- rc = gyp.main(["-f", "msvs", "--depth", fixture_dir, gyp_file])
- assert rc == 0
-
- assert_file(self, "test.vcproj", "msvs/test.vcproj")
- assert_file(self, "integration.sln", "msvs/integration.sln")
diff --git a/tools/gyp/test_gyp.py b/tools/gyp/test_gyp.py
deleted file mode 100755
index 70c81ae8ca3..00000000000
--- a/tools/gyp/test_gyp.py
+++ /dev/null
@@ -1,260 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""gyptest.py -- test runner for GYP tests."""
-
-import argparse
-import os
-import platform
-import subprocess
-import sys
-import time
-
-
-def is_test_name(f):
- return f.startswith("gyptest") and f.endswith(".py")
-
-
-def find_all_gyptest_files(directory):
- result = []
- for root, dirs, files in os.walk(directory):
- result.extend([os.path.join(root, f) for f in files if is_test_name(f)])
- result.sort()
- return result
-
-
-def main(argv=None):
- if argv is None:
- argv = sys.argv
-
- parser = argparse.ArgumentParser()
- parser.add_argument("-a", "--all", action="store_true", help="run all tests")
- parser.add_argument("-C", "--chdir", action="store", help="change to directory")
- parser.add_argument(
- "-f",
- "--format",
- action="store",
- default="",
- help="run tests with the specified formats",
- )
- parser.add_argument(
- "-G",
- "--gyp_option",
- action="append",
- default=[],
- help="Add -G options to the gyp command line",
- )
- parser.add_argument(
- "-l", "--list", action="store_true", help="list available tests and exit"
- )
- parser.add_argument(
- "-n",
- "--no-exec",
- action="store_true",
- help="no execute, just print the command line",
- )
- parser.add_argument(
- "--path", action="append", default=[], help="additional $PATH directory"
- )
- parser.add_argument(
- "-q",
- "--quiet",
- action="store_true",
- help="quiet, don't print anything unless there are failures",
- )
- parser.add_argument(
- "-v",
- "--verbose",
- action="store_true",
- help="print configuration info and test results.",
- )
- parser.add_argument("tests", nargs="*")
- args = parser.parse_args(argv[1:])
-
- if args.chdir:
- os.chdir(args.chdir)
-
- if args.path:
- extra_path = [os.path.abspath(p) for p in args.path]
- extra_path = os.pathsep.join(extra_path)
- os.environ["PATH"] = extra_path + os.pathsep + os.environ["PATH"]
-
- if not args.tests:
- if not args.all:
- sys.stderr.write("Specify -a to get all tests.\n")
- return 1
- args.tests = ["test"]
-
- tests = []
- for arg in args.tests:
- if os.path.isdir(arg):
- tests.extend(find_all_gyptest_files(os.path.normpath(arg)))
- else:
- if not is_test_name(os.path.basename(arg)):
- print(arg, "is not a valid gyp test name.", file=sys.stderr)
- sys.exit(1)
- tests.append(arg)
-
- if args.list:
- for test in tests:
- print(test)
- sys.exit(0)
-
- os.environ["PYTHONPATH"] = os.path.abspath("test/lib")
-
- if args.verbose:
- print_configuration_info()
-
- if args.gyp_option and not args.quiet:
- print("Extra Gyp options: %s\n" % args.gyp_option)
-
- if args.format:
- format_list = args.format.split(",")
- else:
- format_list = {
- "aix5": ["make"],
- "os400": ["make"],
- "freebsd7": ["make"],
- "freebsd8": ["make"],
- "openbsd5": ["make"],
- "cygwin": ["msvs"],
- "win32": ["msvs", "ninja"],
- "linux": ["make", "ninja"],
- "linux2": ["make", "ninja"],
- "linux3": ["make", "ninja"],
- # TODO: Re-enable xcode-ninja.
- # https://bugs.chromium.org/p/gyp/issues/detail?id=530
- # 'darwin': ['make', 'ninja', 'xcode', 'xcode-ninja'],
- "darwin": ["make", "ninja", "xcode"],
- }[sys.platform]
-
- gyp_options = []
- for option in args.gyp_option:
- gyp_options += ["-G", option]
-
- runner = Runner(format_list, tests, gyp_options, args.verbose)
- runner.run()
-
- if not args.quiet:
- runner.print_results()
-
- return 1 if runner.failures else 0
-
-
-def print_configuration_info():
- print("Test configuration:")
- if sys.platform == "darwin":
- sys.path.append(os.path.abspath("test/lib"))
- import TestMac # noqa: PLC0415
-
- print(f" Mac {platform.mac_ver()[0]} {platform.mac_ver()[2]}")
- print(f" Xcode {TestMac.Xcode.Version()}")
- elif sys.platform == "win32":
- sys.path.append(os.path.abspath("pylib"))
- import gyp.MSVSVersion # noqa: PLC0415
-
- print(" Win %s %s\n" % platform.win32_ver()[0:2])
- print(" MSVS %s" % gyp.MSVSVersion.SelectVisualStudioVersion().Description())
- elif sys.platform in ("linux", "linux2"):
- print(" Linux %s" % " ".join(platform.linux_distribution()))
- print(f" Python {platform.python_version()}")
- print(f" PYTHONPATH={os.environ['PYTHONPATH']}")
- print()
-
-
-class Runner:
- def __init__(self, formats, tests, gyp_options, verbose):
- self.formats = formats
- self.tests = tests
- self.verbose = verbose
- self.gyp_options = gyp_options
- self.failures = []
- self.num_tests = len(formats) * len(tests)
- num_digits = len(str(self.num_tests))
- self.fmt_str = "[%%%dd/%%%dd] (%%s) %%s" % (num_digits, num_digits)
- self.isatty = sys.stdout.isatty() and not self.verbose
- self.env = os.environ.copy()
- self.hpos = 0
-
- def run(self):
- run_start = time.time()
-
- i = 1
- for fmt in self.formats:
- for test in self.tests:
- self.run_test(test, fmt, i)
- i += 1
-
- if self.isatty:
- self.erase_current_line()
-
- self.took = time.time() - run_start
-
- def run_test(self, test, fmt, i):
- if self.isatty:
- self.erase_current_line()
-
- msg = self.fmt_str % (i, self.num_tests, fmt, test)
- self.print_(msg)
-
- start = time.time()
- cmd = [sys.executable, test] + self.gyp_options
- self.env["TESTGYP_FORMAT"] = fmt
- proc = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.env
- )
- proc.wait()
- took = time.time() - start
-
- stdout = proc.stdout.read().decode("utf8")
- if proc.returncode == 2:
- res = "skipped"
- elif proc.returncode:
- res = "failed"
- self.failures.append(f"({test}) {fmt}")
- else:
- res = "passed"
- res_msg = f" {res} {took:.3f}s"
- self.print_(res_msg)
-
- if stdout and not stdout.endswith(("PASSED\n", "NO RESULT\n")):
- print()
- print("\n".join(f" {line}" for line in stdout.splitlines()))
- elif not self.isatty:
- print()
-
- def print_(self, msg):
- print(msg, end="")
- index = msg.rfind("\n")
- if index == -1:
- self.hpos += len(msg)
- else:
- self.hpos = len(msg) - index
- sys.stdout.flush()
-
- def erase_current_line(self):
- print("\b" * self.hpos + " " * self.hpos + "\b" * self.hpos, end="")
- sys.stdout.flush()
- self.hpos = 0
-
- def print_results(self):
- num_failures = len(self.failures)
- if num_failures:
- print()
- if num_failures == 1:
- print("Failed the following test:")
- else:
- print("Failed the following %d tests:" % num_failures)
- print("\t" + "\n\t".join(sorted(self.failures)))
- print()
- print(
- "Ran %d tests in %.3fs, %d failed."
- % (self.num_tests, self.took, num_failures)
- )
- print()
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/tools/gyp/tools/README b/tools/gyp/tools/README
deleted file mode 100644
index 84a73d15214..00000000000
--- a/tools/gyp/tools/README
+++ /dev/null
@@ -1,15 +0,0 @@
-pretty_vcproj:
- Usage: pretty_vcproj.py "c:\path\to\vcproj.vcproj" [key1=value1] [key2=value2]
-
- They key/value pair are used to resolve vsprops name.
-
- For example, if I want to diff the base.vcproj project:
-
- pretty_vcproj.py z:\dev\src-chrome\src\base\build\base.vcproj "$(SolutionDir)=z:\dev\src-chrome\src\chrome\\" "$(CHROMIUM_BUILD)=" "$(CHROME_BUILD_TYPE)=" > original.txt
- pretty_vcproj.py z:\dev\src-chrome\src\base\base_gyp.vcproj "$(SolutionDir)=z:\dev\src-chrome\src\chrome\\" "$(CHROMIUM_BUILD)=" "$(CHROME_BUILD_TYPE)=" > gyp.txt
-
- And you can use your favorite diff tool to see the changes.
-
- Note: In the case of base.vcproj, the original vcproj is one level up the generated one.
- I suggest you do a search and replace for '"..\' and replace it with '"' in original.txt
- before you perform the diff.
\ No newline at end of file
diff --git a/tools/gyp/tools/Xcode/README b/tools/gyp/tools/Xcode/README
deleted file mode 100644
index 2492a2c2f8f..00000000000
--- a/tools/gyp/tools/Xcode/README
+++ /dev/null
@@ -1,5 +0,0 @@
-Specifications contains syntax formatters for Xcode 3. These do not appear to be supported yet on Xcode 4. To use these with Xcode 3 please install both the gyp.pbfilespec and gyp.xclangspec files in
-
-~/Library/Application Support/Developer/Shared/Xcode/Specifications/
-
-and restart Xcode.
\ No newline at end of file
diff --git a/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec b/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec
deleted file mode 100644
index 85e2e268a51..00000000000
--- a/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- gyp.pbfilespec
- GYP source file spec for Xcode 3
-
- There is not much documentation available regarding the format
- of .pbfilespec files. As a starting point, see for instance the
- outdated documentation at:
- http://maxao.free.fr/xcode-plugin-interface/specifications.html
- and the files in:
- /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/
-
- Place this file in directory:
- ~/Library/Application Support/Developer/Shared/Xcode/Specifications/
-*/
-
-(
- {
- Identifier = sourcecode.gyp;
- BasedOn = sourcecode;
- Name = "GYP Files";
- Extensions = ("gyp", "gypi");
- MIMETypes = ("text/gyp");
- Language = "xcode.lang.gyp";
- IsTextFile = YES;
- IsSourceFile = YES;
- }
-)
diff --git a/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec b/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec
deleted file mode 100644
index 3b3506d319e..00000000000
--- a/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- Copyright (c) 2011 Google Inc. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file.
-
- gyp.xclangspec
- GYP language specification for Xcode 3
-
- There is not much documentation available regarding the format
- of .xclangspec files. As a starting point, see for instance the
- outdated documentation at:
- http://maxao.free.fr/xcode-plugin-interface/specifications.html
- and the files in:
- /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/
-
- Place this file in directory:
- ~/Library/Application Support/Developer/Shared/Xcode/Specifications/
-*/
-
-(
-
- {
- Identifier = "xcode.lang.gyp.keyword";
- Syntax = {
- Words = (
- "and",
- "or",
- " (caar gyp-parse-history) target-point)
- (setq gyp-parse-history (cdr gyp-parse-history))))
-
-(defun gyp-parse-point ()
- "The point of the last parse state added by gyp-parse-to."
- (caar gyp-parse-history))
-
-(defun gyp-parse-sections ()
- "A list of section symbols holding at the last parse state point."
- (cdar gyp-parse-history))
-
-(defun gyp-inside-dictionary-p ()
- "Predicate returning true if the parser is inside a dictionary."
- (not (eq (cadar gyp-parse-history) 'list)))
-
-(defun gyp-add-parse-history (point sections)
- "Add parse state SECTIONS to the parse history at POINT so that parsing can be
- resumed instantly."
- (while (>= (caar gyp-parse-history) point)
- (setq gyp-parse-history (cdr gyp-parse-history)))
- (setq gyp-parse-history (cons (cons point sections) gyp-parse-history)))
-
-(defun gyp-parse-to (target-point)
- "Parses from (point) to TARGET-POINT adding the parse state information to
- gyp-parse-state-history. Parsing stops if TARGET-POINT is reached or if a
- string literal has been parsed. Returns nil if no further parsing can be
- done, otherwise returns the position of the start of a parsed string, leaving
- the point at the end of the string."
- (let ((parsing t)
- string-start)
- (while parsing
- (setq string-start nil)
- ;; Parse up to a character that starts a sexp, or if the nesting
- ;; level decreases.
- (let ((state (parse-partial-sexp (gyp-parse-point)
- target-point
- -1
- t))
- (sections (gyp-parse-sections)))
- (if (= (nth 0 state) -1)
- (setq sections (cdr sections)) ; pop out a level
- (cond ((looking-at-p "['\"]") ; a string
- (setq string-start (point))
- (goto-char (scan-sexps (point) 1))
- (if (gyp-inside-dictionary-p)
- ;; Look for sections inside a dictionary
- (let ((section (gyp-section-name
- (buffer-substring-no-properties
- (+ 1 string-start)
- (- (point) 1)))))
- (setq sections (cons section (cdr sections)))))
- ;; Stop after the string so it can be fontified.
- (setq target-point (point)))
- ((looking-at-p "{")
- ;; Inside a dictionary. Increase nesting.
- (forward-char 1)
- (setq sections (cons 'unknown sections)))
- ((looking-at-p "\\[")
- ;; Inside a list. Increase nesting
- (forward-char 1)
- (setq sections (cons 'list sections)))
- ((not (eobp))
- ;; other
- (forward-char 1))))
- (gyp-add-parse-history (point) sections)
- (setq parsing (< (point) target-point))))
- string-start))
-
-(defun gyp-section-at-point ()
- "Transform the last parse state, which is a list of nested sections and return
- the section symbol that should be used to determine font-lock information for
- the string. Can return nil indicating the string should not have any attached
- section."
- (let ((sections (gyp-parse-sections)))
- (cond
- ((eq (car sections) 'conditions)
- ;; conditions can occur in a variables section, but we still want to
- ;; highlight it as a keyword.
- nil)
- ((and (eq (car sections) 'list)
- (eq (cadr sections) 'list))
- ;; conditions and sources can have items in [[ ]]
- (caddr sections))
- (t (cadr sections)))))
-
-(defun gyp-section-match (limit)
- "Parse from (point) to LIMIT returning by means of match data what was
- matched. The group of the match indicates what style font-lock should apply.
- See also `gyp-add-font-lock-keywords'."
- (gyp-invalidate-parse-states-after (point))
- (let ((group nil)
- (string-start t))
- (while (and (< (point) limit)
- (not group)
- string-start)
- (setq string-start (gyp-parse-to limit))
- (if string-start
- (setq group (cl-case (gyp-section-at-point)
- ('dependencies 1)
- ('variables 2)
- ('conditions 2)
- ('sources 3)
- ('defines 4)
- (nil nil)))))
- (if group
- (progn
- ;; Set the match data to indicate to the font-lock mechanism the
- ;; highlighting to be performed.
- (set-match-data (append (list string-start (point))
- (make-list (* (1- group) 2) nil)
- (list (1+ string-start) (1- (point)))))
- t))))
-
-;;; Please see http://code.google.com/p/gyp/wiki/GypLanguageSpecification for
-;;; canonical list of keywords.
-(defun gyp-add-font-lock-keywords ()
- "Add gyp-mode keywords to font-lock mechanism."
- ;; TODO(jknotten): Move all the keyword highlighting into gyp-section-match
- ;; so that we can do the font-locking in a single font-lock pass.
- (font-lock-add-keywords
- nil
- (list
- ;; Top-level keywords
- (list (concat "['\"]\\("
- (regexp-opt (list "action" "action_name" "actions" "cflags"
- "cflags_cc" "conditions" "configurations"
- "copies" "defines" "dependencies" "destination"
- "direct_dependent_settings"
- "export_dependent_settings" "extension" "files"
- "include_dirs" "includes" "inputs" "ldflags" "libraries"
- "link_settings" "mac_bundle" "message"
- "msvs_external_rule" "outputs" "product_name"
- "process_outputs_as_sources" "rules" "rule_name"
- "sources" "suppress_wildcard"
- "target_conditions" "target_defaults"
- "target_defines" "target_name" "toolsets"
- "targets" "type" "variables" "xcode_settings"))
- "[!/+=]?\\)") 1 'font-lock-keyword-face t)
- ;; Type of target
- (list (concat "['\"]\\("
- (regexp-opt (list "loadable_module" "static_library"
- "shared_library" "executable" "none"))
- "\\)") 1 'font-lock-type-face t)
- (list "\\(?:target\\|action\\)_name['\"]\\s-*:\\s-*['\"]\\([^ '\"]*\\)" 1
- 'font-lock-function-name-face t)
- (list 'gyp-section-match
- (list 1 'font-lock-function-name-face t t) ; dependencies
- (list 2 'font-lock-variable-name-face t t) ; variables, conditions
- (list 3 'font-lock-constant-face t t) ; sources
- (list 4 'font-lock-preprocessor-face t t)) ; preprocessor
- ;; Variable expansion
- (list "<@?(\\([^\n )]+\\))" 1 'font-lock-variable-name-face t)
- ;; Command expansion
- (list " "{dst}"')
-
- print("}")
-
-
-def main():
- if len(sys.argv) < 2:
- print(__doc__, file=sys.stderr)
- print(file=sys.stderr)
- print("usage: %s target1 target2..." % (sys.argv[0]), file=sys.stderr)
- return 1
-
- edges = LoadEdges("dump.json", sys.argv[1:])
-
- WriteGraph(edges)
- return 0
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/tools/gyp/tools/pretty_gyp.py b/tools/gyp/tools/pretty_gyp.py
deleted file mode 100755
index 562a73ee672..00000000000
--- a/tools/gyp/tools/pretty_gyp.py
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Pretty-prints the contents of a GYP file."""
-
-import re
-import sys
-
-# Regex to remove comments when we're counting braces.
-COMMENT_RE = re.compile(r"\s*#.*")
-
-# Regex to remove quoted strings when we're counting braces.
-# It takes into account quoted quotes, and makes sure that the quotes match.
-# NOTE: It does not handle quotes that span more than one line, or
-# cases where an escaped quote is preceded by an escaped backslash.
-QUOTE_RE_STR = r'(?P[\'"])(.*?)(? 0:
- after = True
-
- # This catches the special case of a closing brace having something
- # other than just whitespace ahead of it -- we don't want to
- # unindent that until after this line is printed so it stays with
- # the previous indentation level.
- if cnt < 0 and closing_prefix_re.match(stripline):
- after = True
- return (cnt, after)
-
-
-def prettyprint_input(lines):
- """Does the main work of indenting the input based on the brace counts."""
- indent = 0
- basic_offset = 2
- for line in lines:
- if COMMENT_RE.match(line):
- print(line)
- else:
- line = line.strip("\r\n\t ") # Otherwise doesn't strip \r on Unix.
- if len(line) > 0:
- (brace_diff, after) = count_braces(line)
- if brace_diff != 0:
- if after:
- print(" " * (basic_offset * indent) + line)
- indent += brace_diff
- else:
- indent += brace_diff
- print(" " * (basic_offset * indent) + line)
- else:
- print(" " * (basic_offset * indent) + line)
- else:
- print()
-
-
-def main():
- if len(sys.argv) > 1:
- data = open(sys.argv[1]).read().splitlines()
- else:
- data = sys.stdin.read().splitlines()
- # Split up the double braces.
- lines = split_double_braces(data)
-
- # Indent and print the output.
- prettyprint_input(lines)
- return 0
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/tools/gyp/tools/pretty_sln.py b/tools/gyp/tools/pretty_sln.py
deleted file mode 100755
index 70c91aefad4..00000000000
--- a/tools/gyp/tools/pretty_sln.py
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Prints the information in a sln file in a diffable way.
-
-It first outputs each projects in alphabetical order with their
-dependencies.
-
-Then it outputs a possible build order.
-"""
-
-import os
-import re
-import sys
-
-import pretty_vcproj
-
-__author__ = "nsylvain (Nicolas Sylvain)"
-
-
-def BuildProject(project, built, projects, deps):
- # if all dependencies are done, we can build it, otherwise we try to build the
- # dependency.
- # This is not infinite-recursion proof.
- for dep in deps[project]:
- if dep not in built:
- BuildProject(dep, built, projects, deps)
- print(project)
- built.append(project)
-
-
-def ParseSolution(solution_file):
- # All projects, their clsid and paths.
- projects = {}
-
- # A list of dependencies associated with a project.
- dependencies = {}
-
- # Regular expressions that matches the SLN format.
- # The first line of a project definition.
- begin_project = re.compile(
- r'^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'
- r'}"\) = "(.*)", "(.*)", "(.*)"$'
- )
- # The last line of a project definition.
- end_project = re.compile("^EndProject$")
- # The first line of a dependency list.
- begin_dep = re.compile(r"ProjectSection\(ProjectDependencies\) = postProject$")
- # The last line of a dependency list.
- end_dep = re.compile("EndProjectSection$")
- # A line describing a dependency.
- dep_line = re.compile(" *({.*}) = ({.*})$")
-
- in_deps = False
- solution = open(solution_file)
- for line in solution:
- results = begin_project.search(line)
- if results:
- # Hack to remove icu because the diff is too different.
- if results.group(1).find("icu") != -1:
- continue
- # We remove "_gyp" from the names because it helps to diff them.
- current_project = results.group(1).replace("_gyp", "")
- projects[current_project] = [
- results.group(2).replace("_gyp", ""),
- results.group(3),
- results.group(2),
- ]
- dependencies[current_project] = []
- continue
-
- results = end_project.search(line)
- if results:
- current_project = None
- continue
-
- results = begin_dep.search(line)
- if results:
- in_deps = True
- continue
-
- results = end_dep.search(line)
- if results:
- in_deps = False
- continue
-
- results = dep_line.search(line)
- if results and in_deps and current_project:
- dependencies[current_project].append(results.group(1))
- continue
-
- # Change all dependencies clsid to name instead.
- for project, deps in dependencies.items():
- # For each dependencies in this project
- new_dep_array = []
- for dep in deps:
- # Look for the project name matching this cldis
- for project_info in projects:
- if projects[project_info][1] == dep:
- new_dep_array.append(project_info)
- dependencies[project] = sorted(new_dep_array)
-
- return (projects, dependencies)
-
-
-def PrintDependencies(projects, deps):
- print("---------------------------------------")
- print("Dependencies for all projects")
- print("---------------------------------------")
- print("-- --")
-
- for project, dep_list in sorted(deps.items()):
- print("Project : %s" % project)
- print("Path : %s" % projects[project][0])
- if dep_list:
- for dep in dep_list:
- print(" - %s" % dep)
- print()
-
- print("-- --")
-
-
-def PrintBuildOrder(projects, deps):
- print("---------------------------------------")
- print("Build order ")
- print("---------------------------------------")
- print("-- --")
-
- built = []
- for project, _ in sorted(deps.items()):
- if project not in built:
- BuildProject(project, built, projects, deps)
-
- print("-- --")
-
-
-def PrintVCProj(projects):
- for project in projects:
- print("-------------------------------------")
- print("-------------------------------------")
- print(project)
- print(project)
- print(project)
- print("-------------------------------------")
- print("-------------------------------------")
-
- project_path = os.path.abspath(
- os.path.join(os.path.dirname(sys.argv[1]), projects[project][2])
- )
-
- pretty = pretty_vcproj
- argv = [
- "",
- project_path,
- "$(SolutionDir)=%s\\" % os.path.dirname(sys.argv[1]),
- ]
- argv.extend(sys.argv[3:])
- pretty.main(argv)
-
-
-def main():
- # check if we have exactly 1 parameter.
- if len(sys.argv) < 2:
- print('Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0])
- return 1
-
- (projects, deps) = ParseSolution(sys.argv[1])
- PrintDependencies(projects, deps)
- PrintBuildOrder(projects, deps)
-
- if "--recursive" in sys.argv:
- PrintVCProj(projects)
- return 0
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/tools/gyp/tools/pretty_vcproj.py b/tools/gyp/tools/pretty_vcproj.py
deleted file mode 100755
index 82d47a0bdd4..00000000000
--- a/tools/gyp/tools/pretty_vcproj.py
+++ /dev/null
@@ -1,336 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright (c) 2012 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Make the format of a vcproj really pretty.
-
-This script normalize and sort an xml. It also fetches all the properties
-inside linked vsprops and include them explicitly in the vcproj.
-
-It outputs the resulting xml to stdout.
-"""
-
-import os
-import sys
-from xml.dom.minidom import Node, parse
-
-__author__ = "nsylvain (Nicolas Sylvain)"
-ARGUMENTS = None
-REPLACEMENTS = {}
-
-
-def cmp(x, y):
- return (x > y) - (x < y)
-
-
-class CmpTuple:
- """Compare function between 2 tuple."""
-
- def __call__(self, x, y):
- return cmp(x[0], y[0])
-
-
-class CmpNode:
- """Compare function between 2 xml nodes."""
-
- def __call__(self, x, y):
- def get_string(node):
- node_string = "node"
- node_string += node.nodeName
- if node.nodeValue:
- node_string += node.nodeValue
-
- if node.attributes:
- # We first sort by name, if present.
- node_string += node.getAttribute("Name")
-
- all_nodes = []
- for name, value in node.attributes.items():
- all_nodes.append((name, value))
-
- all_nodes.sort(CmpTuple())
- for name, value in all_nodes:
- node_string += name
- node_string += value
-
- return node_string
-
- return cmp(get_string(x), get_string(y))
-
-
-def PrettyPrintNode(node, indent=0):
- if node.nodeType == Node.TEXT_NODE:
- if node.data.strip():
- print("{}{}".format(" " * indent, node.data.strip()))
- return
-
- if node.childNodes:
- node.normalize()
- # Get the number of attributes
- attr_count = 0
- if node.attributes:
- attr_count = node.attributes.length
-
- # Print the main tag
- if attr_count == 0:
- print("{}<{}>".format(" " * indent, node.nodeName))
- else:
- print("{}<{}".format(" " * indent, node.nodeName))
-
- all_attributes = []
- for name, value in node.attributes.items():
- all_attributes.append((name, value))
- all_attributes.sort(CmpTuple())
- for name, value in all_attributes:
- print('{} {}="{}"'.format(" " * indent, name, value))
- print("%s>" % (" " * indent))
- if node.nodeValue:
- print("{} {}".format(" " * indent, node.nodeValue))
-
- for sub_node in node.childNodes:
- PrettyPrintNode(sub_node, indent=indent + 2)
- print("{}{}>".format(" " * indent, node.nodeName))
-
-
-def FlattenFilter(node):
- """Returns a list of all the node and sub nodes."""
- node_list = []
-
- if node.attributes and node.getAttribute("Name") == "_excluded_files":
- # We don't add the "_excluded_files" filter.
- return []
-
- for current in node.childNodes:
- if current.nodeName == "Filter":
- node_list.extend(FlattenFilter(current))
- else:
- node_list.append(current)
-
- return node_list
-
-
-def FixFilenames(filenames, current_directory):
- new_list = []
- for filename in filenames:
- if filename:
- for key, value in REPLACEMENTS.items():
- filename = filename.replace(key, value)
- os.chdir(current_directory)
- filename = filename.strip("\"' ")
- if filename.startswith("$"):
- new_list.append(filename)
- else:
- new_list.append(os.path.abspath(filename))
- return new_list
-
-
-def AbsoluteNode(node):
- """Makes all the properties we know about in this node absolute."""
- if node.attributes:
- for name, value in node.attributes.items():
- if name in [
- "InheritedPropertySheets",
- "RelativePath",
- "AdditionalIncludeDirectories",
- "IntermediateDirectory",
- "OutputDirectory",
- "AdditionalLibraryDirectories",
- ]:
- # We want to fix up these paths
- path_list = value.split(";")
- new_list = FixFilenames(path_list, os.path.dirname(ARGUMENTS[1]))
- node.setAttribute(name, ";".join(new_list))
- if not value:
- node.removeAttribute(name)
-
-
-def CleanupVcproj(node):
- """For each sub node, we call recursively this function."""
- for sub_node in node.childNodes:
- AbsoluteNode(sub_node)
- CleanupVcproj(sub_node)
-
- # Normalize the node, and remove all extraneous whitespaces.
- for sub_node in node.childNodes:
- if sub_node.nodeType == Node.TEXT_NODE:
- sub_node.data = sub_node.data.replace("\r", "")
- sub_node.data = sub_node.data.replace("\n", "")
- sub_node.data = sub_node.data.rstrip()
-
- # Fix all the semicolon separated attributes to be sorted, and we also
- # remove the dups.
- if node.attributes:
- for name, value in node.attributes.items():
- sorted_list = sorted(value.split(";"))
- unique_list = []
- for i in sorted_list:
- if not unique_list.count(i):
- unique_list.append(i)
- node.setAttribute(name, ";".join(unique_list))
- if not value:
- node.removeAttribute(name)
-
- if node.childNodes:
- node.normalize()
-
- # For each node, take a copy, and remove it from the list.
- node_array = []
- while node.childNodes and node.childNodes[0]:
- # Take a copy of the node and remove it from the list.
- current = node.childNodes[0]
- node.removeChild(current)
-
- # If the child is a filter, we want to append all its children
- # to this same list.
- if current.nodeName == "Filter":
- node_array.extend(FlattenFilter(current))
- else:
- node_array.append(current)
-
- # Sort the list.
- node_array.sort(CmpNode())
-
- # Insert the nodes in the correct order.
- for new_node in node_array:
- # But don't append empty tool node.
- if new_node.nodeName == "Tool":
- if new_node.attributes and new_node.attributes.length == 1:
- # This one was empty.
- continue
- if new_node.nodeName == "UserMacro":
- continue
- node.appendChild(new_node)
-
-
-def GetConfigurationNodes(vcproj):
- # TODO(nsylvain): Find a better way to navigate the xml.
- nodes = []
- for node in vcproj.childNodes:
- if node.nodeName == "Configurations":
- for sub_node in node.childNodes:
- if sub_node.nodeName == "Configuration":
- nodes.append(sub_node)
-
- return nodes
-
-
-def GetChildrenVsprops(filename):
- dom = parse(filename)
- if dom.documentElement.attributes:
- vsprops = dom.documentElement.getAttribute("InheritedPropertySheets")
- return FixFilenames(vsprops.split(";"), os.path.dirname(filename))
- return []
-
-
-def SeekToNode(node1, child2):
- # A text node does not have properties.
- if child2.nodeType == Node.TEXT_NODE:
- return None
-
- # Get the name of the current node.
- current_name = child2.getAttribute("Name")
- if not current_name:
- # There is no name. We don't know how to merge.
- return None
-
- # Look through all the nodes to find a match.
- for sub_node in node1.childNodes:
- if sub_node.nodeName == child2.nodeName:
- name = sub_node.getAttribute("Name")
- if name == current_name:
- return sub_node
-
- # No match. We give up.
- return None
-
-
-def MergeAttributes(node1, node2):
- # No attributes to merge?
- if not node2.attributes:
- return
-
- for name, value2 in node2.attributes.items():
- # Don't merge the 'Name' attribute.
- if name == "Name":
- continue
- value1 = node1.getAttribute(name)
- if value1:
- # The attribute exist in the main node. If it's equal, we leave it
- # untouched, otherwise we concatenate it.
- if value1 != value2:
- node1.setAttribute(name, ";".join([value1, value2]))
- else:
- # The attribute does not exist in the main node. We append this one.
- node1.setAttribute(name, value2)
-
- # If the attribute was a property sheet attributes, we remove it, since
- # they are useless.
- if name == "InheritedPropertySheets":
- node1.removeAttribute(name)
-
-
-def MergeProperties(node1, node2):
- MergeAttributes(node1, node2)
- for child2 in node2.childNodes:
- child1 = SeekToNode(node1, child2)
- if child1:
- MergeProperties(child1, child2)
- else:
- node1.appendChild(child2.cloneNode(True))
-
-
-def main(argv):
- """Main function of this vcproj prettifier."""
- global ARGUMENTS
- ARGUMENTS = argv
-
- # check if we have exactly 1 parameter.
- if len(argv) < 2:
- print(
- 'Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] '
- "[key2=value2]" % argv[0]
- )
- return 1
-
- # Parse the keys
- for i in range(2, len(argv)):
- (key, value) = argv[i].split("=")
- REPLACEMENTS[key] = value
-
- # Open the vcproj and parse the xml.
- dom = parse(argv[1])
-
- # First thing we need to do is find the Configuration Node and merge them
- # with the vsprops they include.
- for configuration_node in GetConfigurationNodes(dom.documentElement):
- # Get the property sheets associated with this configuration.
- vsprops = configuration_node.getAttribute("InheritedPropertySheets")
-
- # Fix the filenames to be absolute.
- vsprops_list = FixFilenames(
- vsprops.strip().split(";"), os.path.dirname(argv[1])
- )
-
- # Extend the list of vsprops with all vsprops contained in the current
- # vsprops.
- for current_vsprops in vsprops_list:
- vsprops_list.extend(GetChildrenVsprops(current_vsprops))
-
- # Now that we have all the vsprops, we need to merge them.
- for current_vsprops in vsprops_list:
- MergeProperties(configuration_node, parse(current_vsprops).documentElement)
-
- # Now that everything is merged, we need to cleanup the xml.
- CleanupVcproj(dom.documentElement)
-
- # Finally, we use the prett xml function to print the vcproj back to the
- # user.
- # print dom.toprettyxml(newl="\n")
- PrettyPrintNode(dom.documentElement)
- return 0
-
-
-if __name__ == "__main__":
- sys.exit(main(sys.argv))
diff --git a/tools/gyp_node.py b/tools/gyp_node.py
deleted file mode 100755
index 2bcc912a4da..00000000000
--- a/tools/gyp_node.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python
-from __future__ import print_function
-import os
-import sys
-
-script_dir = os.path.dirname(__file__)
-node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
-
-sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
-import gyp
-
-# Add search path for `pymod_do_main` first to avoid depending on
-# load order of gyp files.
-sys.path.insert(0, os.path.join(node_root, 'tools', 'v8_gypfiles'))
-
-# Directory within which we want all generated files (including Makefiles)
-# to be written.
-output_dir = os.path.join(os.path.abspath(node_root), 'out')
-
-def run_gyp(args):
- # GYP bug.
- # On msvs it will crash if it gets an absolute path.
- # On Mac/make it will crash if it doesn't get an absolute path.
- a_path = node_root if sys.platform == 'win32' else os.path.abspath(node_root)
- args.append(os.path.join(a_path, 'node.gyp'))
- common_fn = os.path.join(a_path, 'common.gypi')
- options_fn = os.path.join(a_path, 'config.gypi')
-
- if os.path.exists(common_fn):
- args.extend(['-I', common_fn])
-
- if os.path.exists(options_fn):
- args.extend(['-I', options_fn])
-
- args.append('--depth=' + node_root)
-
- # There's a bug with windows which doesn't allow this feature.
- if sys.platform != 'win32' and 'ninja' not in args:
- # Tell gyp to write the Makefiles into output_dir
- args.extend(['--generator-output', output_dir])
-
- # Tell make to write its output into the same dir
- args.extend(['-Goutput_dir=' + output_dir])
-
- args.append('-Dcomponent=static_library')
- args.append('-Dlibrary=static_library')
-
- rc = gyp.main(args)
- if rc != 0:
- print('Error running GYP')
- sys.exit(rc)
-
-
-if __name__ == '__main__':
- run_gyp(sys.argv[1:])
diff --git a/tools/gypi_to_gn.py b/tools/gypi_to_gn.py
deleted file mode 100755
index 327cd38d7ba..00000000000
--- a/tools/gypi_to_gn.py
+++ /dev/null
@@ -1,334 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2014 The Chromium Authors. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google LLC nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# Deleted from Chromium in https://crrev.com/097f64c631.
-
-"""Converts a given gypi file to a python scope and writes the result to stdout.
-USING THIS SCRIPT IN CHROMIUM
-Forking Python to run this script in the middle of GN is slow, especially on
-Windows, and it makes both the GYP and GN files harder to follow. You can't
-use "git grep" to find files in the GN build any more, and tracking everything
-in GYP down requires a level of indirection. Any calls will have to be removed
-and cleaned up once the GYP-to-GN transition is complete.
-As a result, we only use this script when the list of files is large and
-frequently-changing. In these cases, having one canonical list outweighs the
-downsides.
-As of this writing, the GN build is basically complete. It's likely that all
-large and frequently changing targets where this is appropriate use this
-mechanism already. And since we hope to turn down the GYP build soon, the time
-horizon is also relatively short. As a result, it is likely that no additional
-uses of this script should every be added to the build. During this later part
-of the transition period, we should be focusing more and more on the absolute
-readability of the GN build.
-HOW TO USE
-It is assumed that the file contains a toplevel dictionary, and this script
-will return that dictionary as a GN "scope" (see example below). This script
-does not know anything about GYP and it will not expand variables or execute
-conditions.
-It will strip conditions blocks.
-A variables block at the top level will be flattened so that the variables
-appear in the root dictionary. This way they can be returned to the GN code.
-Say your_file.gypi looked like this:
- {
- 'sources': [ 'a.cc', 'b.cc' ],
- 'defines': [ 'ENABLE_DOOM_MELON' ],
- }
-You would call it like this:
- gypi_values = exec_script("//build/gypi_to_gn.py",
- [ rebase_path("your_file.gypi") ],
- "scope",
- [ "your_file.gypi" ])
-Notes:
- - The rebase_path call converts the gypi file from being relative to the
- current build file to being system absolute for calling the script, which
- will have a different current directory than this file.
- - The "scope" parameter tells GN to interpret the result as a series of GN
- variable assignments.
- - The last file argument to exec_script tells GN that the given file is a
- dependency of the build so Ninja can automatically re-run GN if the file
- changes.
-Read the values into a target like this:
- component("mycomponent") {
- sources = gypi_values.sources
- defines = gypi_values.defines
- }
-Sometimes your .gypi file will include paths relative to a different
-directory than the current .gn file. In this case, you can rebase them to
-be relative to the current directory.
- sources = rebase_path(gypi_values.sources, ".",
- "//path/gypi/input/values/are/relative/to")
-This script will tolerate a 'variables' in the toplevel dictionary or not. If
-the toplevel dictionary just contains one item called 'variables', it will be
-collapsed away and the result will be the contents of that dictinoary. Some
-.gypi files are written with or without this, depending on how they expect to
-be embedded into a .gyp file.
-This script also has the ability to replace certain substrings in the input.
-Generally this is used to emulate GYP variable expansion. If you passed the
-argument "--replace=<(foo)=bar" then all instances of "<(foo)" in strings in
-the input will be replaced with "bar":
- gypi_values = exec_script("//build/gypi_to_gn.py",
- [ rebase_path("your_file.gypi"),
- "--replace=<(foo)=bar"],
- "scope",
- [ "your_file.gypi" ])
-"""
-
-from __future__ import absolute_import
-from __future__ import print_function
-from optparse import OptionParser
-import sys
-
-
-# This function is copied from build/gn_helpers.py in Chromium.
-def ToGNString(value, pretty=False):
- """Returns a stringified GN equivalent of a Python value.
-
- Args:
- value: The Python value to convert.
- pretty: Whether to pretty print. If true, then non-empty lists are rendered
- recursively with one item per line, with indents. Otherwise lists are
- rendered without new line.
- Returns:
- The stringified GN equivalent to |value|.
-
- Raises:
- ValueError: |value| cannot be printed to GN.
- """
-
- # Emits all output tokens without intervening whitespaces.
- def GenerateTokens(v, level):
- if isinstance(v, str):
- yield '"' + ''.join(TranslateToGnChars(v)) + '"'
-
- elif isinstance(v, bool):
- yield 'true' if v else 'false'
-
- elif isinstance(v, int):
- yield str(v)
-
- elif isinstance(v, list):
- yield '['
- for i, item in enumerate(v):
- if i > 0:
- yield ','
- for tok in GenerateTokens(item, level + 1):
- yield tok
- yield ']'
-
- elif isinstance(v, dict):
- if level > 0:
- yield '{'
- for key in sorted(v):
- if not isinstance(key, str):
- raise ValueError('Dictionary key is not a string.')
- if not key or key[0].isdigit() or not key.replace('_', '').isalnum():
- raise ValueError('Dictionary key is not a valid GN identifier.')
- yield key # No quotations.
- yield '='
- for tok in GenerateTokens(v[key], level + 1):
- yield tok
- if level > 0:
- yield '}'
-
- else: # Not supporting float: Add only when needed.
- raise ValueError('Unsupported type when printing to GN.')
-
- can_start = lambda tok: tok and tok not in ',}]='
- can_end = lambda tok: tok and tok not in ',{[='
-
- # Adds whitespaces, trying to keep everything (except dicts) in 1 line.
- def PlainGlue(gen):
- prev_tok = None
- for i, tok in enumerate(gen):
- if i > 0:
- if can_end(prev_tok) and can_start(tok):
- yield '\n' # New dict item.
- elif prev_tok == '[' and tok == ']':
- yield ' ' # Special case for [].
- elif tok != ',':
- yield ' '
- yield tok
- prev_tok = tok
-
- # Adds whitespaces so non-empty lists can span multiple lines, with indent.
- def PrettyGlue(gen):
- prev_tok = None
- level = 0
- for i, tok in enumerate(gen):
- if i > 0:
- if can_end(prev_tok) and can_start(tok):
- yield '\n' + ' ' * level # New dict item.
- elif tok == '=' or prev_tok in '=':
- yield ' ' # Separator before and after '=', on same line.
- if tok in ']}':
- level -= 1
- # Exclude '[]' and '{}' cases.
- if int(prev_tok == '[') + int(tok == ']') == 1 or \
- int(prev_tok == '{') + int(tok == '}') == 1:
- yield '\n' + ' ' * level
- yield tok
- if tok in '[{':
- level += 1
- if tok == ',':
- yield '\n' + ' ' * level
- prev_tok = tok
-
- token_gen = GenerateTokens(value, 0)
- ret = ''.join((PrettyGlue if pretty else PlainGlue)(token_gen))
- # Add terminating '\n' for dict |value| or multi-line output.
- if isinstance(value, dict) or '\n' in ret:
- return ret + '\n'
- return ret
-
-
-def TranslateToGnChars(s):
- for code in s.encode('utf-8'):
- if code in (34, 36, 92): # For '"', '$', or '\\'.
- yield '\\' + chr(code)
- elif 32 <= code < 127:
- yield chr(code)
- else:
- yield '$0x%02X' % code
-
-
-def LoadPythonDictionary(path):
- file_string = open(path).read()
- try:
- file_data = eval(file_string, {'__builtins__': None}, None)
- except SyntaxError as e:
- e.filename = path
- raise
- except Exception as e:
- raise Exception("Unexpected error while reading %s: %s" % (path, str(e)))
-
- assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path
-
- # Flatten any variables to the top level.
- if 'variables' in file_data:
- file_data.update(file_data['variables'])
- del file_data['variables']
-
- # Strip all elements that this script can't process.
- elements_to_strip = [
- 'conditions',
- 'direct_dependent_settings',
- 'target_conditions',
- 'target_defaults',
- 'targets',
- 'includes',
- 'actions',
- ]
- for element in elements_to_strip:
- if element in file_data:
- del file_data[element]
-
- return file_data
-
-
-def ReplaceSubstrings(values, search_for, replace_with):
- """Recursively replaces substrings in a value.
- Replaces all substrings of the "search_for" with "replace_with" for all
- strings occurring in "values". This is done by recursively iterating into
- lists as well as the keys and values of dictionaries."""
- if isinstance(values, str):
- return values.replace(search_for, replace_with)
-
- if isinstance(values, list):
- result = []
- for v in values:
- # Remove the item from list for complete match.
- if v == search_for and replace_with == '':
- continue
- result.append(ReplaceSubstrings(v, search_for, replace_with))
- return result
-
- if isinstance(values, dict):
- # For dictionaries, do the search for both the key and values.
- result = {}
- for key, value in values.items():
- new_key = ReplaceSubstrings(key, search_for, replace_with)
- new_value = ReplaceSubstrings(value, search_for, replace_with)
- result[new_key] = new_value
- return result
-
- # Assume everything else is unchanged.
- return values
-
-
-def DeduplicateLists(values):
- """Recursively remove duplicate values in lists."""
- if isinstance(values, list):
- return sorted(list(set(values)))
-
- if isinstance(values, dict):
- for key in values:
- values[key] = DeduplicateLists(values[key])
- return values
-
-
-def main():
- parser = OptionParser()
- parser.add_option("-r", "--replace", action="append",
- help="Replaces substrings. If passed a=b, replaces all substrs a with b.")
- (options, args) = parser.parse_args()
-
- if len(args) != 1:
- raise Exception("Need one argument which is the .gypi file to read.")
-
- data = LoadPythonDictionary(args[0])
- if options.replace:
- # Do replacements for all specified patterns.
- for replace in options.replace:
- split = replace.split('=')
- # Allow "foo=" to replace with nothing.
- if len(split) == 1:
- split.append('')
- assert len(split) == 2, "Replacement must be of the form 'key=value'."
- data = ReplaceSubstrings(data, split[0], split[1])
-
- gn_dict = {}
- for key in data:
- gn_key = key.replace('-', '_')
- # Sometimes .gypi files use the GYP syntax with percents at the end of the
- # variable name (to indicate not to overwrite a previously-defined value):
- # 'foo%': 'bar',
- # Convert these to regular variables.
- if len(key) > 1 and key[len(key) - 1] == '%':
- gn_dict[gn_key[:-1]] = data[key]
- else:
- gn_dict[gn_key] = data[key]
-
- print(ToGNString(DeduplicateLists(gn_dict)))
-
-if __name__ == '__main__':
- try:
- main()
- except Exception as e:
- print(str(e))
- sys.exit(1)
diff --git a/tools/icu/README.md b/tools/icu/README.md
deleted file mode 100644
index 711f459696b..00000000000
--- a/tools/icu/README.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# Notes about the `tools/icu` subdirectory
-
-This directory contains tools and information about the
-[International Components for Unicode][ICU] (ICU) integration.
-Both V8 and Node.js use ICU to provide internationalization functionality.
-
-* `patches/` are one-off patches, actually entire source file replacements,
- organized by ICU version number.
-* `icu_small.json` controls the "small" (English only) ICU. It is input to
- `icutrim.py`
-* `icu-generic.gyp` is the build file used for most ICU builds within ICU.
-
-* `icu-system.gyp` is an alternate build file used when `--with-intl=system-icu`
- is invoked. It builds against the `pkg-config` located ICU.
-* `iculslocs.cc` is source for the `iculslocs` utility, invoked by `icutrim.py`
- as part of repackaging. Not used separately. See source for more details.
-* `no-op.cc` contains an empty function to convince gyp to use a C++ compiler.
-* `shrink-icu-src.py` is used during upgrade (see guide below).
-
-Note:
-
-> The files in this directory were written for the Node.js 0.12 effort.
-> The original intent was to merge the tools such as `icutrim.py` and `iculslocs.cc`
-> back into ICU. ICU has gained its own “data slicer” tool.
-> There is an issue open,
-> for replacing `icutrim.py` with the [ICU data slicer][].
-
-## See Also
-
-* [docs/guides/maintaining-icu.md](../../doc/contributing/maintaining/maintaining-icu.md)
- for information on maintaining ICU in Node.js
-
-* [docs/api/intl.md](../../doc/api/intl.md) for information on the
- internationalization-related APIs in Node.js
-
-* [The ICU Homepage][ICU]
-
-[ICU]: http://icu-project.org
-[ICU data slicer]: https://github.com/unicode-org/icu/blob/HEAD/docs/userguide/icu_data/buildtool.md
diff --git a/tools/icu/current_ver.dep b/tools/icu/current_ver.dep
deleted file mode 100644
index 3d923fec865..00000000000
--- a/tools/icu/current_ver.dep
+++ /dev/null
@@ -1,6 +0,0 @@
-[
- {
- "url": "https://github.com/unicode-org/icu/releases/download/release-78.3/icu4c-78.3-sources.tgz",
- "md5": "a7b736b570ef0e180c96a31715a00c78"
- }
-]
diff --git a/tools/icu/icu-generic.gyp b/tools/icu/icu-generic.gyp
deleted file mode 100644
index c4e8c6fbb9f..00000000000
--- a/tools/icu/icu-generic.gyp
+++ /dev/null
@@ -1,555 +0,0 @@
-# Copyright (c) IBM Corporation and Others. All Rights Reserved.
-# very loosely based on icu.gyp from Chromium:
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-{
- 'variables': {
- 'icu_src_derb': [
- '<(icu_path)/source/tools/genrb/derb.c',
- '<(icu_path)/source/tools/genrb/derb.cpp'
- ],
- },
- 'includes': [ '../../icu_config.gypi' ],
- 'targets': [
- {
- # a target for additional uconfig defines, target only
- 'target_name': 'icu_uconfig_target',
- 'type': 'none',
- 'toolsets': [ 'target' ],
- 'direct_dependent_settings': {
- 'defines': []
- },
- },
- {
- # a target to hold uconfig defines.
- # for now these are hard coded, but could be defined.
- 'target_name': 'icu_uconfig',
- 'type': 'none',
- 'toolsets': [ 'host', 'target' ],
- 'direct_dependent_settings': {
- 'defines': [
- 'UCONFIG_NO_SERVICE=1',
- 'U_ENABLE_DYLOAD=0',
- 'U_STATIC_IMPLEMENTATION=1',
- 'U_HAVE_STD_STRING=1',
- # TODO(srl295): reenable following pending
- # https://code.google.com/p/v8/issues/detail?id=3345
- # (saves some space)
- 'UCONFIG_NO_BREAK_ITERATION=0',
- ],
- }
- },
- {
- # a target to hold common settings.
- # make any target that is ICU implementation depend on this.
- 'target_name': 'icu_implementation',
- 'toolsets': [ 'host', 'target' ],
- 'type': 'none',
- 'direct_dependent_settings': {
- 'conditions': [
- [ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
- 'cflags': [ '-Wno-deprecated-declarations', '-Wno-strict-aliasing' ],
- 'cflags_cc': [ '-frtti' ],
- 'cflags_cc!': [ '-fno-rtti' ],
- }],
- [ 'OS == "mac" or OS == "ios"', {
- 'xcode_settings': {'GCC_ENABLE_CPP_RTTI': 'YES' },
- }],
- [ 'OS == "win"', {
- 'msvs_settings': {
- 'VCCLCompilerTool': {'RuntimeTypeInfo': 'true'},
- }
- }],
- ],
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'RuntimeTypeInfo': 'true',
- 'ExceptionHandling': '1',
- 'AdditionalOptions': [ '/source-charset:utf-8' ],
- },
- },
- 'configurations': {
- # TODO: why does this need to be redefined for Release and Debug?
- # Maybe this should be pushed into common.gypi with an "if v8 i18n"?
- 'Release': {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'RuntimeTypeInfo': 'true',
- 'ExceptionHandling': '1',
- },
- },
- },
- 'Debug': {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'RuntimeTypeInfo': 'true',
- 'ExceptionHandling': '1',
- },
- },
- },
- },
- 'defines': [
- 'U_ATTRIBUTE_DEPRECATED=',
- 'U_STATIC_IMPLEMENTATION=1',
- ],
- },
- },
- {
- 'target_name': 'icui18n',
- 'toolsets': [ 'target', 'host' ],
- 'conditions' : [
- ['_toolset=="target"', {
- 'type': '<(library)',
- 'sources': [
- '<@(icu_src_i18n)'
- ],
- 'include_dirs': [
- '<(icu_path)/source/i18n',
- ],
- 'defines': [
- 'U_I18N_IMPLEMENTATION=1',
- ],
- 'dependencies': [ 'icuucx', 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
- 'direct_dependent_settings': {
- 'include_dirs': [
- '<(icu_path)/source/i18n',
- ],
- },
- 'export_dependent_settings': [ 'icuucx', 'icu_uconfig_target' ],
- }],
- ['_toolset=="host"', {
- 'type': 'none',
- 'dependencies': [ 'icutools#host' ],
- 'export_dependent_settings': [ 'icutools' ],
- }],
- ],
- },
- # This exports actual ICU data
- {
- 'target_name': 'icudata',
- 'type': '<(library)',
- 'toolsets': [ 'target' ],
- 'conditions': [
- [ 'OS == "win"', {
- 'conditions': [
- [ 'icu_small == "false"', { # and OS=win
- # full data - just build the full data file, then we are done.
- 'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
- 'dependencies': [ 'genccode#host' ],
- 'conditions': [
- [ 'clang==1', {
- 'actions': [
- {
- 'action_name': 'icudata',
- 'msvs_quote_cmd': 0,
- 'inputs': [ '<(icu_data_in)' ],
- 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
- # on Windows, we can go directly to .obj file (-o) option.
- # for Clang use "-c <(target_arch)" option
- 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
- '<@(icu_asm_opts)', # -o
- '-c', '<(target_arch)',
- '-d', '<(SHARED_INTERMEDIATE_DIR)',
- '-n', 'icudata',
- '-e', 'icudt<(icu_ver_major)',
- '<@(_inputs)' ],
- },
- ],
- }, {
- 'actions': [
- {
- 'action_name': 'icudata',
- 'msvs_quote_cmd': 0,
- 'inputs': [ '<(icu_data_in)' ],
- 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
- # on Windows, we can go directly to .obj file (-o) option.
- # for MSVC do not use "-c <(target_arch)" option
- 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
- '<@(icu_asm_opts)', # -o
- '-d', '<(SHARED_INTERMEDIATE_DIR)',
- '-n', 'icudata',
- '-e', 'icudt<(icu_ver_major)',
- '<@(_inputs)' ],
- },
- ],
- }]
- ],
- }, { # icu_small == TRUE and OS == win
- # link against stub data primarily
- # then, use icupkg and genccode to rebuild data
- 'dependencies': [ 'icustubdata', 'genccode#host', 'icupkg#host', 'genrb#host', 'iculslocs#host' ],
- 'export_dependent_settings': [ 'icustubdata' ],
- 'actions': [
- {
- # trim down ICU
- 'action_name': 'icutrim',
- 'msvs_quote_cmd': 0,
- 'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
- 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
- 'action': [ '<(python)',
- 'icutrim.py',
- '-P', '<(PRODUCT_DIR)/.', # '.' suffix is a workaround against GYP assumptions :(
- '-D', '<(icu_data_in)',
- '--delete-tmp',
- '-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
- '-F', 'icu_small.json',
- '-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
- '-v',
- '-L', '<(icu_locales)'],
- },
- {
- # build final .dat -> .obj
- 'action_name': 'genccode',
- 'msvs_quote_cmd': 0,
- 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
- 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
- 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
- '<@(icu_asm_opts)', # -o
- '-c', '<(target_arch)',
- '-d', '<(SHARED_INTERMEDIATE_DIR)/',
- '-n', 'icudata',
- '-e', 'icusmdt<(icu_ver_major)',
- '<@(_inputs)' ],
- },
- ],
- # This file contains the small ICU data.
- 'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.<(icu_asm_ext)' ],
- } ] ], #end of OS==win and icu_small == true
- }, { # OS != win
- 'conditions': [
- [ 'icu_small == "false"', {
- # full data - no trim needed
- 'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
- 'dependencies': [ 'genccode#host', 'icupkg#host', 'icu_implementation#host', 'icu_uconfig' ],
- 'include_dirs': [
- '<(icu_path)/source/common',
- ],
- 'actions': [
- {
- # Copy the .dat file, swapping endianness if needed.
- 'action_name': 'icupkg',
- 'inputs': [ '<(icu_data_in)' ],
- 'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness).dat' ],
- 'action': [ '<(PRODUCT_DIR)/icupkg<(EXECUTABLE_SUFFIX)',
- '-t<(icu_endianness)',
- '<@(_inputs)',
- '<@(_outputs)',
- ],
- },
- {
- # Rename without the endianness marker (icudt64l.dat -> icudt64.dat)
- 'action_name': 'copy',
- 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness).dat' ],
- 'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major).dat' ],
- 'action': [ 'cp',
- '<@(_inputs)',
- '<@(_outputs)',
- ],
- },
- {
- # convert full ICU data file to .c, or .S, etc.
- 'action_name': 'icudata',
- 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major).dat' ],
- 'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
- 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
- '-e', 'icudt<(icu_ver_major)',
- '-d', '<(SHARED_INTERMEDIATE_DIR)',
- '<@(icu_asm_opts)',
- '-f', 'icudt<(icu_ver_major)_dat',
- '<@(_inputs)' ],
- },
- ], # end actions
- }, { # icu_small == true ( and OS != win )
- # link against stub data (as primary data)
- # then, use icupkg and genccode to rebuild small data
- 'dependencies': [ 'icustubdata', 'genccode#host', 'icupkg#host', 'genrb#host', 'iculslocs#host',
- 'icu_implementation', 'icu_uconfig' ],
- 'export_dependent_settings': [ 'icustubdata' ],
- 'actions': [
- {
- # Trim down ICU.
- # Note that icupkg is invoked automatically, swapping endianness if needed.
- 'action_name': 'icutrim',
- 'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
- 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
- 'action': [ '<(python)',
- 'icutrim.py',
- '-P', '<(PRODUCT_DIR)',
- '-D', '<(icu_data_in)',
- '--delete-tmp',
- '-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
- '-F', 'icu_small.json',
- '-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
- '-v',
- '-L', '<(icu_locales)'],
- }, {
- # rename to get the final entrypoint name right (icudt64l.dat -> icusmdt64.dat)
- 'action_name': 'rename',
- 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
- 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
- 'action': [ 'cp',
- '<@(_inputs)',
- '<@(_outputs)',
- ],
- }, {
- # For icu-small, always use .c, don't try to use .S, etc.
- 'action_name': 'genccode',
- 'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
- 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
- 'action': [ '<(PRODUCT_DIR)/genccode<(EXECUTABLE_SUFFIX)',
- '<@(icu_asm_opts)',
- '-d', '<(SHARED_INTERMEDIATE_DIR)',
- '<@(_inputs)' ],
- },
- ],
- # This file contains the small ICU data
- 'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.<(icu_asm_ext)' ],
- # for umachine.h
- 'include_dirs': [
- '<(icu_path)/source/common',
- ],
- }]], # end icu_small == true
- }]], # end OS != win
- }, # end icudata
- # icustubdata is a tiny (~1k) symbol with no ICU data in it.
- # tools must link against it as they are generating the full data.
- {
- 'target_name': 'icustubdata',
- 'type': '<(library)',
- 'toolsets': [ 'target' ],
- 'dependencies': [ 'icu_implementation' ],
- 'sources': [
- '<@(icu_src_stubdata)'
- ],
- 'include_dirs': [
- '<(icu_path)/source/common',
- ],
- },
- # this target is for v8 consumption.
- # it is icuuc + stubdata
- # it is only built for target
- {
- 'target_name': 'icuuc',
- 'type': 'none',
- 'toolsets': [ 'target', 'host' ],
- 'conditions' : [
- ['_toolset=="host"', {
- 'dependencies': [ 'icutools#host' ],
- 'export_dependent_settings': [ 'icutools' ],
- }],
- ['_toolset=="target"', {
- 'dependencies': [ 'icuucx', 'icudata' ],
- 'export_dependent_settings': [ 'icuucx', 'icudata' ],
- }],
- ],
- },
- # This is the 'real' icuuc.
- {
- 'target_name': 'icuucx',
- 'type': '<(library)',
- 'dependencies': [ 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
- 'toolsets': [ 'target' ],
- 'sources': [
- '<@(icu_src_common)',
- ],
- ## if your compiler can dead-strip, this will
- ## make ZERO difference to binary size.
- ## Made ICU-specific for future-proofing.
- 'conditions': [
- [ 'OS == "solaris"', { 'defines': [
- '_XOPEN_SOURCE_EXTENDED=0',
- ]}],
- ],
- 'include_dirs': [
- '<(icu_path)/source/common',
- ],
- 'defines': [
- 'U_COMMON_IMPLEMENTATION=1',
- ],
- 'cflags_c': ['-std=c99'],
- 'export_dependent_settings': [ 'icu_uconfig', 'icu_uconfig_target' ],
- 'direct_dependent_settings': {
- 'include_dirs': [
- '<(icu_path)/source/common',
- ],
- 'conditions': [
- [ 'OS=="win"', {
- 'link_settings': {
- 'libraries': [ '-lAdvAPI32.lib', '-lUser32.lib' ],
- },
- }],
- ],
- },
- },
- # tools library. This builds all of ICU together.
- {
- 'target_name': 'icutools',
- 'type': '<(library)',
- 'toolsets': [ 'host' ],
- 'dependencies': [ 'icu_implementation', 'icu_uconfig' ],
- 'sources': [
- '<@(icu_src_tools)',
- '<@(icu_src_common)',
- '<@(icu_src_i18n)',
- '<@(icu_src_stubdata)',
- ],
- 'sources!': [
- '<(icu_path)/source/tools/toolutil/udbgutil.cpp',
- '<(icu_path)/source/tools/toolutil/udbgutil.h',
- '<(icu_path)/source/tools/toolutil/dbgutil.cpp',
- '<(icu_path)/source/tools/toolutil/dbgutil.h',
- ],
- 'include_dirs': [
- '<(icu_path)/source/common',
- '<(icu_path)/source/i18n',
- '<(icu_path)/source/tools/toolutil',
- ],
- 'defines': [
- 'U_COMMON_IMPLEMENTATION=1',
- 'U_I18N_IMPLEMENTATION=1',
- 'U_IO_IMPLEMENTATION=1',
- 'U_TOOLUTIL_IMPLEMENTATION=1',
- #'DEBUG=0', # http://bugs.icu-project.org/trac/ticket/10977
- ],
- 'cflags_c': ['-std=c99'],
- 'conditions': [
- ['OS == "solaris"', {
- 'defines': [ '_XOPEN_SOURCE_EXTENDED=0' ]
- }]
- ],
- 'direct_dependent_settings': {
- 'include_dirs': [
- '<(icu_path)/source/common',
- '<(icu_path)/source/i18n',
- '<(icu_path)/source/tools/toolutil',
- ],
- 'conditions': [
- [ 'OS=="win"', {
- 'link_settings': {
- 'libraries': [ '-lAdvAPI32.lib', '-lUser32.lib' ],
- },
- }],
- ],
- },
- 'export_dependent_settings': [ 'icu_uconfig' ],
- },
- # This tool is needed to rebuild .res files from .txt,
- # or to build index (res_index.txt) files for small-icu
- {
- 'target_name': 'genrb',
- 'type': 'executable',
- 'toolsets': [ 'host' ],
- 'dependencies': [ 'icutools', 'icu_implementation' ],
- 'sources': [
- '<@(icu_src_genrb)'
- ],
- # derb is a separate executable
- # (which is not currently built)
- 'sources!': [
- '<@(icu_src_derb)',
- 'no-op.cc',
- ],
- 'conditions': [
- # Avoid excessive LTO
- ['enable_lto=="true"', {
- 'ldflags': [ '-fno-lto' ],
- }],
- ['node_with_ltcg=="true" or enable_lto=="true" or enable_thin_lto=="true"', {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- 'VCLinkerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- },
- }],
- ],
- },
- # This tool is used to rebuild res_index.res manifests
- {
- 'target_name': 'iculslocs',
- 'toolsets': [ 'host' ],
- 'type': 'executable',
- 'dependencies': [ 'icutools' ],
- 'sources': [
- 'iculslocs.cc',
- 'no-op.cc',
- ],
- 'conditions': [
- # Avoid excessive LTO
- ['enable_lto=="true"', {
- 'ldflags': [ '-fno-lto' ],
- }],
- ['node_with_ltcg=="true" or enable_lto=="true" or enable_thin_lto=="true"', {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- 'VCLinkerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- },
- }],
- ],
- },
- # This tool is used to package, unpackage, repackage .dat files
- # and convert endianesses
- {
- 'target_name': 'icupkg',
- 'toolsets': [ 'host' ],
- 'type': 'executable',
- 'dependencies': [ 'icutools' ],
- 'sources': [
- '<@(icu_src_icupkg)',
- 'no-op.cc',
- ],
- 'conditions': [
- # Avoid excessive LTO
- ['enable_lto=="true"', {
- 'ldflags': [ '-fno-lto' ],
- }],
- ['node_with_ltcg=="true" or enable_lto=="true" or enable_thin_lto=="true"', {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- 'VCLinkerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- },
- }],
- ],
- },
- # this is used to convert .dat directly into .obj
- {
- 'target_name': 'genccode',
- 'toolsets': [ 'host' ],
- 'type': 'executable',
- 'dependencies': [ 'icutools' ],
- 'sources': [
- '<@(icu_src_genccode)',
- 'no-op.cc',
- ],
- 'conditions': [
- # Avoid excessive LTO
- ['enable_lto=="true"', {
- 'ldflags': [ '-fno-lto' ],
- }],
- ['node_with_ltcg=="true" or enable_lto=="true" or enable_thin_lto=="true"', {
- 'msvs_settings': {
- 'VCCLCompilerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- 'VCLinkerTool': {
- 'AdditionalOptions': ['-fno-lto'],
- },
- },
- }],
- ],
- },
- ],
-}
diff --git a/tools/icu/icu-system.gyp b/tools/icu/icu-system.gyp
deleted file mode 100644
index b3ca0e39b6c..00000000000
--- a/tools/icu/icu-system.gyp
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2014 IBM Corporation and Others. All Rights Reserved.
-
-# This variant is used for the '--with-intl=system-icu' option.
-# 'configure' has already set 'libs' and 'cflags' - so,
-# there's nothing to do in these targets.
-
-{
- 'targets': [
- {
- 'target_name': 'icuuc',
- 'type': 'none',
- 'toolsets': [ 'host', 'target' ],
- },
- {
- 'target_name': 'icui18n',
- 'type': 'none',
- 'toolsets': [ 'host', 'target' ],
- },
- ],
-}
diff --git a/tools/icu/icu_small.json b/tools/icu/icu_small.json
deleted file mode 100644
index 712998f2ade..00000000000
--- a/tools/icu/icu_small.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "copyright": "Copyright (c) 2014 IBM Corporation and Others. All Rights Reserved.",
- "comment": "icutrim.py config: Trim down ICU to just a certain locale set, needed for node.js use.",
- "variables": {
- "none": {
- "only": []
- },
- "locales": {
- "only": [
- "root",
- "en"
- ]
- },
- "leavealone": {
- }
- },
- "trees": {
- "ROOT": "locales",
- "brkitr": "none",
- "coll": "locales",
- "curr": "locales",
- "lang": "none",
- "rbnf": "none",
- "region": "none",
- "zone": "locales",
- "converters": "none",
- "stringprep": "locales",
- "translit": "locales",
- "brkfiles": "none",
- "brkdict": "none",
- "confusables": "none",
- "unit": "locales"
- },
- "remove": [
- "cnvalias.icu",
- "postalCodeData.res",
- "genderList.res",
- "brkitr/root.res",
- "unames.icu"
- ],
- "keep": [
- "pool.res",
- "supplementalData.res",
- "zoneinfo64.res",
- "likelySubtags.res"
- ]
-}
diff --git a/tools/icu/icu_versions.json b/tools/icu/icu_versions.json
deleted file mode 100644
index e635d9b841a..00000000000
--- a/tools/icu/icu_versions.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "minimum_icu": 73
-}
diff --git a/tools/icu/iculslocs.cc b/tools/icu/iculslocs.cc
deleted file mode 100644
index 85cf1f77c35..00000000000
--- a/tools/icu/iculslocs.cc
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
-**********************************************************************
-* Copyright (C) 2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-*
-* Created 2014-06-20 by Steven R. Loomis
-*
-* See: http://bugs.icu-project.org/trac/ticket/10922
-*
-*/
-
-/*
-WHAT IS THIS?
-
-Here's the problem: It's difficult to reconfigure ICU from the command
-line without using the full makefiles. You can do a lot, but not
-everything.
-
-Consider:
-
- $ icupkg -r 'ja*' icudt53l.dat
-
-Great, you've now removed the (main) Japanese data. But something's
-still wrong-- res_index (and thus, getAvailable* functions) still
-claim the locale is present.
-
-You are reading the source to a tool (using only public API C code)
-that can solve this problem. Use as follows:
-
- $ iculslocs -i . -N icudt53l -b res_index.txt
-
-.. Generates a NEW res_index.txt (by looking at the .dat file, and
-figuring out which locales are actually available. Has commented out
-the ones which are no longer available:
-
- ...
- it_SM {""}
-// ja {""}
-// ja_JP {""}
- jgo {""}
- ...
-
-Then you can build and in-place patch it with existing ICU tools:
- $ genrb res_index.txt
- $ icupkg -a res_index.res icudt53l.dat
-
-.. Now you have a patched icudt539.dat that not only doesn't have
-Japanese, it doesn't *claim* to have Japanese.
-
-*/
-
-#include
-#include "charstr.h" // ICU internal header
-#include
-#include
-#include
-#include
-
-const char* PROG = "iculslocs";
-const char* NAME = U_ICUDATA_NAME; // assume ICU data
-const char* TREE = "ROOT";
-int VERBOSE = 0;
-
-#define RES_INDEX "res_index"
-#define INSTALLEDLOCALES "InstalledLocales"
-
-icu::CharString packageName;
-const char* locale = RES_INDEX; // locale referring to our index
-
-void usage() {
- printf("Usage: %s [options]\n", PROG);
- printf(
- "This program lists and optionally regenerates the locale "
- "manifests\n"
- " in ICU 'res_index.res' files.\n");
- printf(
- " -i ICUDATA Set ICUDATA dir to ICUDATA.\n"
- " NOTE: this must be the first option given.\n");
- printf(" -h This Help\n");
- printf(" -v Verbose Mode on\n");
- printf(" -l List locales to stdout\n");
- printf(
- " if Verbose mode, then missing (unopenable)"
- "locales\n"
- " will be listed preceded by a '#'.\n");
- printf(
- " -b res_index.txt Write 'corrected' bundle "
- "to res_index.txt\n"
- " missing bundles will be "
- "OMITTED\n");
- printf(
- " -T TREE Choose tree TREE\n"
- " (TREE should be one of: \n"
- " ROOT, brkitr, coll, curr, lang, rbnf, region, zone)\n");
- // see ureslocs.h and elsewhere
- printf(
- " -N NAME Choose name NAME\n"
- " (default: '%s')\n",
- U_ICUDATA_NAME);
- printf(
- "\nNOTE: for best results, this tool ought to be "
- "linked against\n"
- "stubdata. i.e. '%s -l' SHOULD return an error with "
- " no data.\n",
- PROG);
-}
-
-#define ASSERT_SUCCESS(status, what) \
- if (U_FAILURE(*status)) { \
- printf("%s:%d: %s: ERROR: %s %s\n", \
- __FILE__, \
- __LINE__, \
- PROG, \
- u_errorName(*status), \
- what); \
- return 1; \
- }
-
-/**
- * @param status changed from reference to pointer to match node.js style
- */
-void calculatePackageName(UErrorCode* status) {
- packageName.clear();
- if (strcmp(NAME, "NONE")) {
- packageName.append(NAME, *status);
- if (strcmp(TREE, "ROOT")) {
- packageName.append(U_TREE_SEPARATOR_STRING, *status);
- packageName.append(TREE, *status);
- }
- }
- if (VERBOSE) {
- printf("packageName: %s\n", packageName.data());
- }
-}
-
-/**
- * Does the locale exist?
- * return zero for false, or nonzero if it was openable.
- * Assumes calculatePackageName was called.
- * @param exists set to TRUE if exists, FALSE otherwise.
- * Changed from reference to pointer to match node.js style
- * @returns 0 on "OK" (success or resource-missing),
- * 1 on "FAILURE" (unexpected error)
- */
-int localeExists(const char* loc, UBool* exists) {
- UErrorCode status = U_ZERO_ERROR;
- if (VERBOSE > 1) {
- printf("Trying to open %s:%s\n", packageName.data(), loc);
- }
- icu::LocalUResourceBundlePointer aResource(
- ures_openDirect(packageName.data(), loc, &status));
- *exists = false;
- if (U_SUCCESS(status)) {
- *exists = true;
- if (VERBOSE > 1) {
- printf("%s:%s existed!\n", packageName.data(), loc);
- }
- return 0;
- } else if (status == U_MISSING_RESOURCE_ERROR) {
- *exists = false;
- if (VERBOSE > 1) {
- printf("%s:%s did NOT exist (%s)!\n",
- packageName.data(),
- loc,
- u_errorName(status));
- }
- return 0; // "good" failure
- } else {
- // some other failure..
- printf("%s:%d: %s: ERROR %s opening %s for test.\n",
- __FILE__,
- __LINE__,
- u_errorName(status),
- packageName.data(),
- loc);
- return 1; // abort
- }
-}
-
-void printIndent(FILE* bf, int indent) {
- for (int i = 0; i < indent + 1; i++) {
- fprintf(bf, " ");
- }
-}
-
-/**
- * Dumps a table resource contents
- * if lev==0, skips INSTALLEDLOCALES
- * @returns 0 for OK, 1 for err
- */
-int dumpAllButInstalledLocales(int lev,
- icu::LocalUResourceBundlePointer* bund,
- FILE* bf,
- UErrorCode* status) {
- ures_resetIterator(bund->getAlias());
- icu::LocalUResourceBundlePointer t;
- while (U_SUCCESS(*status) && ures_hasNext(bund->getAlias())) {
- t.adoptInstead(ures_getNextResource(bund->getAlias(), t.orphan(), status));
- ASSERT_SUCCESS(status, "while processing table");
- const char* key = ures_getKey(t.getAlias());
- if (VERBOSE > 1) {
- printf("dump@%d: got key %s\n", lev, key);
- }
- if (lev == 0 && !strcmp(key, INSTALLEDLOCALES)) {
- if (VERBOSE > 1) {
- printf("dump: skipping '%s' as it must be evaluated.\n", key);
- }
- } else {
- printIndent(bf, lev);
- fprintf(bf, "%s", key);
- const UResType type = ures_getType(t.getAlias());
- switch (type) {
- case URES_STRING: {
- int32_t len = 0;
- const UChar* s = ures_getString(t.getAlias(), &len, status);
- ASSERT_SUCCESS(status, "getting string");
- fprintf(bf, ":string {\"");
- fwrite(s, len, 1, bf);
- fprintf(bf, "\"}");
- } break;
- case URES_TABLE: {
- fprintf(bf, ":table {\n");
- dumpAllButInstalledLocales(lev+1, &t, bf, status);
- printIndent(bf, lev);
- fprintf(bf, "}\n");
- } break;
- default: {
- printf("ERROR: unhandled type %d for key %s "
- "in dumpAllButInstalledLocales().\n",
- static_cast(type), key);
- return 1;
- } break;
- }
- fprintf(bf, "\n");
- }
- }
- return 0;
-}
-
-int list(const char* toBundle) {
- UErrorCode status = U_ZERO_ERROR;
-
- FILE* bf = nullptr;
-
- if (toBundle != nullptr) {
- if (VERBOSE) {
- printf("writing to bundle %s\n", toBundle);
- }
- bf = fopen(toBundle, "wb");
- if (bf == nullptr) {
- printf("ERROR: Could not open '%s' for writing.\n", toBundle);
- return 1;
- }
- fprintf(bf, "\xEF\xBB\xBF"); // write UTF-8 BOM
- fprintf(bf, "// -*- Coding: utf-8; -*-\n//\n");
- }
-
- // first, calculate the bundle name.
- calculatePackageName(&status);
- ASSERT_SUCCESS(&status, "calculating package name");
-
- if (VERBOSE) {
- printf("\"locale\": %s\n", locale);
- }
-
- icu::LocalUResourceBundlePointer bund(
- ures_openDirect(packageName.data(), locale, &status));
- ASSERT_SUCCESS(&status, "while opening the bundle");
- icu::LocalUResourceBundlePointer installedLocales(
- // NOLINTNEXTLINE (readability/null_usage)
- ures_getByKey(bund.getAlias(), INSTALLEDLOCALES, nullptr, &status));
- ASSERT_SUCCESS(&status, "while fetching installed locales");
-
- int32_t count = ures_getSize(installedLocales.getAlias());
- if (VERBOSE) {
- printf("Locales: %d\n", count);
- }
-
- if (bf != nullptr) {
- // write the HEADER
- fprintf(bf,
- "// NOTE: This file was generated during the build process.\n"
- "// Generator: tools/icu/iculslocs.cc\n"
- "// Input package-tree/item: %s/%s.res\n",
- packageName.data(),
- locale);
- fprintf(bf,
- "%s:table(nofallback) {\n"
- " // First, everything besides InstalledLocales:\n",
- locale);
- if (dumpAllButInstalledLocales(0, &bund, bf, &status)) {
- printf("Error dumping prolog for %s\n", toBundle);
- fclose(bf);
- return 1;
- }
- // in case an error was missed
- ASSERT_SUCCESS(&status, "while writing prolog");
-
- fprintf(bf,
- " %s:table { // %d locales in input %s.res\n",
- INSTALLEDLOCALES,
- count,
- locale);
- }
-
- // OK, now list them.
- icu::LocalUResourceBundlePointer subkey;
-
- int validCount = 0;
- for (int32_t i = 0; i < count; i++) {
- subkey.adoptInstead(ures_getByIndex(
- installedLocales.getAlias(), i, subkey.orphan(), &status));
- ASSERT_SUCCESS(&status, "while fetching an installed locale's name");
-
- const char* key = ures_getKey(subkey.getAlias());
- if (VERBOSE > 1) {
- printf("@%d: %s\n", i, key);
- }
- // now, see if the locale is installed..
-
- UBool exists;
- if (localeExists(key, &exists)) {
- if (bf != nullptr) fclose(bf);
- return 1; // get out.
- }
- if (exists) {
- validCount++;
- printf("%s\n", key);
- if (bf != nullptr) {
- fprintf(bf, " %s {\"\"}\n", key);
- }
- } else {
- if (bf != nullptr) {
- fprintf(bf, "// %s {\"\"}\n", key);
- }
- if (VERBOSE) {
- printf("#%s\n", key); // verbosity one - '' vs '#'
- }
- }
- }
-
- if (bf != nullptr) {
- fprintf(bf, " } // %d/%d valid\n", validCount, count);
- // write the HEADER
- fprintf(bf, "}\n");
- fclose(bf);
- }
-
- return 0;
-}
-
-int main(int argc, const char* argv[]) {
- PROG = argv[0];
- for (int i = 1; i < argc; i++) {
- const char* arg = argv[i];
- int argsLeft = argc - i - 1; /* how many remain? */
- if (!strcmp(arg, "-v")) {
- VERBOSE++;
- } else if (!strcmp(arg, "-i") && (argsLeft >= 1)) {
- if (i != 1) {
- printf("ERROR: -i must be the first argument given.\n");
- usage();
- return 1;
- }
- const char* dir = argv[++i];
- u_setDataDirectory(dir);
- if (VERBOSE) {
- printf("ICUDATA is now %s\n", dir);
- }
- } else if (!strcmp(arg, "-T") && (argsLeft >= 1)) {
- TREE = argv[++i];
- if (VERBOSE) {
- printf("TREE is now %s\n", TREE);
- }
- } else if (!strcmp(arg, "-N") && (argsLeft >= 1)) {
- NAME = argv[++i];
- if (VERBOSE) {
- printf("NAME is now %s\n", NAME);
- }
- } else if (!strcmp(arg, "-?") || !strcmp(arg, "-h")) {
- usage();
- return 0;
- } else if (!strcmp(arg, "-l")) {
- if (list(nullptr)) {
- return 1;
- }
- } else if (!strcmp(arg, "-b") && (argsLeft >= 1)) {
- if (list(argv[++i])) {
- return 1;
- }
- } else {
- printf("Unknown or malformed option: %s\n", arg);
- usage();
- return 1;
- }
- }
-}
-
-// Local Variables:
-// compile-command: "icurun iculslocs.cpp"
-// End:
diff --git a/tools/icu/icutrim.py b/tools/icu/icutrim.py
deleted file mode 100755
index 4441550df09..00000000000
--- a/tools/icu/icutrim.py
+++ /dev/null
@@ -1,355 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2014 IBM Corporation and Others. All Rights Reserved.
-#
-# @author Steven R. Loomis
-#
-# This tool slims down an ICU data (.dat) file according to a config file.
-#
-# See: http://bugs.icu-project.org/trac/ticket/10922
-#
-# Usage:
-# Use "-h" to get help options.
-
-from __future__ import print_function
-
-import io
-import json
-import optparse
-import os
-import re
-import shutil
-import sys
-
-try:
- # for utf-8 on Python 2
- reload(sys)
- sys.setdefaultencoding("utf-8")
-except NameError:
- pass # Python 3 already defaults to utf-8
-
-try:
- basestring # Python 2
-except NameError:
- basestring = str # Python 3
-
-endian=sys.byteorder
-
-parser = optparse.OptionParser(usage="usage: mkdir tmp ; %prog -D ~/Downloads/icudt53l.dat -T tmp -F trim_en.json -O icudt53l.dat" )
-
-parser.add_option("-P","--tool-path",
- action="store",
- dest="toolpath",
- help="set the prefix directory for ICU tools")
-
-parser.add_option("-D","--input-file",
- action="store",
- dest="datfile",
- help="input data file (icudt__.dat)",
- ) # required
-
-parser.add_option("-F","--filter-file",
- action="store",
- dest="filterfile",
- help="filter file (JSON format)",
- ) # required
-
-parser.add_option("-T","--tmp-dir",
- action="store",
- dest="tmpdir",
- help="working directory.",
- ) # required
-
-parser.add_option("--delete-tmp",
- action="count",
- dest="deltmpdir",
- help="delete working directory.",
- default=0)
-
-parser.add_option("-O","--outfile",
- action="store",
- dest="outfile",
- help="outfile (NOT a full path)",
- ) # required
-
-parser.add_option("-v","--verbose",
- action="count",
- default=0)
-
-parser.add_option('-L',"--locales",
- action="store",
- dest="locales",
- help="sets the 'locales.only' variable",
- default=None)
-
-parser.add_option('-e', '--endian', action='store', dest='endian', help='endian, big, little or host, your default is "%s".' % endian, default=endian, metavar='endianness')
-
-(options, args) = parser.parse_args()
-
-optVars = vars(options)
-
-for opt in [ "datfile", "filterfile", "tmpdir", "outfile" ]:
- if optVars[opt] is None:
- print("Missing required option: %s" % opt)
- sys.exit(1)
-
-if options.verbose>0:
- print("Options: "+str(options))
-
-if (os.path.isdir(options.tmpdir) and options.deltmpdir):
- if options.verbose>1:
- print("Deleting tmp dir %s.." % (options.tmpdir))
- shutil.rmtree(options.tmpdir)
-
-if not (os.path.isdir(options.tmpdir)):
- os.mkdir(options.tmpdir)
-else:
- print("Please delete tmpdir %s before beginning." % options.tmpdir)
- sys.exit(1)
-
-if options.endian not in ("big","little","host"):
- print("Unknown endianness: %s" % options.endian)
- sys.exit(1)
-
-if options.endian == "host":
- options.endian = endian
-
-if not os.path.isdir(options.tmpdir):
- print("Error, tmpdir not a directory: %s" % (options.tmpdir))
- sys.exit(1)
-
-if not os.path.isfile(options.filterfile):
- print("Filterfile doesn't exist: %s" % (options.filterfile))
- sys.exit(1)
-
-if not os.path.isfile(options.datfile):
- print("Datfile doesn't exist: %s" % (options.datfile))
- sys.exit(1)
-
-if not options.datfile.endswith(".dat"):
- print("Datfile doesn't end with .dat: %s" % (options.datfile))
- sys.exit(1)
-
-outfile = os.path.join(options.tmpdir, options.outfile)
-
-if os.path.isfile(outfile):
- print("Error, output file does exist: %s" % (outfile))
- sys.exit(1)
-
-if not options.outfile.endswith(".dat"):
- print("Outfile doesn't end with .dat: %s" % (options.outfile))
- sys.exit(1)
-
-dataname=options.outfile[0:-4]
-
-
-## TODO: need to improve this. Quotes, etc.
-def runcmd(tool, cmd, doContinue=False):
- if(options.toolpath):
- cmd = os.path.join(options.toolpath, tool) + " " + cmd
- else:
- cmd = tool + " " + cmd
-
- if(options.verbose>4):
- print("# " + cmd)
-
- rc = os.system(cmd)
- if rc != 0 and not doContinue:
- print("FAILED: %s" % cmd)
- sys.exit(1)
- return rc
-
-## STEP 0 - read in json config
-with io.open(options.filterfile, encoding='utf-8') as fi:
- config = json.load(fi)
-
-if options.locales:
- config["variables"] = config.get("variables", {})
- config["variables"]["locales"] = config["variables"].get("locales", {})
- config["variables"]["locales"]["only"] = options.locales.split(',')
-
-if options.verbose > 6:
- print(config)
-
-if "comment" in config:
- print("%s: %s" % (options.filterfile, config["comment"]))
-
-## STEP 1 - copy the data file, swapping endianness
-## The first letter of endian_letter will be 'b' or 'l' for big or little
-endian_letter = options.endian[0]
-
-runcmd("icupkg", "-t%s %s %s""" % (endian_letter, options.datfile, outfile))
-
-## STEP 2 - get listing
-listfile = os.path.join(options.tmpdir,"icudata.lst")
-runcmd("icupkg", "-l %s > %s""" % (outfile, listfile))
-
-with open(listfile, 'rb') as fi:
- items = [line.strip() for line in fi.read().decode("utf-8").splitlines()]
-itemset = set(items)
-
-if options.verbose > 1:
- print("input file: %d items" % len(items))
-
-# list of all trees
-trees = {}
-RES_INDX = "res_index.res"
-remove = None
-# remove - always remove these
-if "remove" in config:
- remove = set(config["remove"])
-else:
- remove = set()
-
-# keep - always keep these
-if "keep" in config:
- keep = set(config["keep"])
-else:
- keep = set()
-
-def queueForRemoval(tree):
- global remove
- if tree not in config.get("trees", {}):
- return
- mytree = trees[tree]
- if options.verbose > 0:
- print("* %s: %d items" % (tree, len(mytree["locs"])))
- # do varible substitution for this tree here
- if isinstance(config["trees"][tree], basestring):
- treeStr = config["trees"][tree]
- if options.verbose > 5:
- print(" Substituting $%s for tree %s" % (treeStr, tree))
- if treeStr not in config.get("variables", {}):
- print(" ERROR: no variable: variables.%s for tree %s" % (treeStr, tree))
- sys.exit(1)
- config["trees"][tree] = config["variables"][treeStr]
- myconfig = config["trees"][tree]
- if options.verbose > 4:
- print(" Config: %s" % (myconfig))
- # Process this tree
- if(len(myconfig)==0 or len(mytree["locs"])==0):
- if(options.verbose>2):
- print(" No processing for %s - skipping" % (tree))
- else:
- only = None
- if "only" in myconfig:
- only = set(myconfig["only"])
- if (len(only)==0) and (mytree["treeprefix"] != ""):
- thePool = "%spool.res" % (mytree["treeprefix"])
- if (thePool in itemset):
- if(options.verbose>0):
- print("Removing %s because tree %s is empty." % (thePool, tree))
- remove.add(thePool)
- else:
- print("tree %s - no ONLY")
- for l in range(len(mytree["locs"])):
- loc = mytree["locs"][l]
- if (only is not None) and not loc in only:
- # REMOVE loc
- toRemove = "%s%s%s" % (mytree["treeprefix"], loc, mytree["extension"])
- if(options.verbose>6):
- print("Queueing for removal: %s" % toRemove)
- remove.add(toRemove)
-
-def addTreeByType(tree, mytree):
- if(options.verbose>1):
- print("(considering %s): %s" % (tree, mytree))
- trees[tree] = mytree
- mytree["locs"]=[]
- for i in range(len(items)):
- item = items[i]
- if item.startswith(mytree["treeprefix"]) and item.endswith(mytree["extension"]):
- mytree["locs"].append(item[len(mytree["treeprefix"]):-4])
- # now, process
- queueForRemoval(tree)
-
-addTreeByType("converters",{"treeprefix":"", "extension":".cnv"})
-addTreeByType("stringprep",{"treeprefix":"", "extension":".spp"})
-addTreeByType("translit",{"treeprefix":"translit/", "extension":".res"})
-addTreeByType("brkfiles",{"treeprefix":"brkitr/", "extension":".brk"})
-addTreeByType("brkdict",{"treeprefix":"brkitr/", "extension":"dict"})
-addTreeByType("confusables",{"treeprefix":"", "extension":".cfu"})
-
-for i in range(len(items)):
- item = items[i]
- if item.endswith(RES_INDX):
- treeprefix = item[0:item.rindex(RES_INDX)]
- tree = None
- if treeprefix == "":
- tree = "ROOT"
- else:
- tree = treeprefix[0:-1]
- if(options.verbose>6):
- print("procesing %s" % (tree))
- trees[tree] = { "extension": ".res", "treeprefix": treeprefix, "hasIndex": True }
- # read in the resource list for the tree
- treelistfile = os.path.join(options.tmpdir,"%s.lst" % tree)
- runcmd("iculslocs", "-i %s -N %s -T %s -l > %s" % (outfile, dataname, tree, treelistfile))
- with io.open(treelistfile, 'r', encoding='utf-8') as fi:
- treeitems = fi.readlines()
- trees[tree]["locs"] = [line.strip() for line in treeitems]
- if tree not in config.get("trees", {}):
- print(" Warning: filter file %s does not mention trees.%s - will be kept as-is" % (options.filterfile, tree))
- else:
- queueForRemoval(tree)
-
-def removeList(count=0):
- # don't allow "keep" items to creep in here.
- global remove
- remove = remove - keep
- if(count > 10):
- print("Giving up - %dth attempt at removal." % count)
- sys.exit(1)
- if(options.verbose>1):
- print("%d items to remove - try #%d" % (len(remove),count))
- if(len(remove)>0):
- oldcount = len(remove)
- hackerrfile=os.path.join(options.tmpdir, "REMOVE.err")
- removefile = os.path.join(options.tmpdir, "REMOVE.lst")
- with open(removefile, 'wb') as fi:
- fi.write('\n'.join(remove).encode("utf-8") + b'\n')
- rc = runcmd("icupkg","-r %s %s 2> %s" % (removefile,outfile,hackerrfile),True)
- if rc != 0:
- if(options.verbose>5):
- print("## Damage control, trying to parse stderr from icupkg..")
- fi = open(hackerrfile, 'rb')
- erritems = fi.readlines()
- fi.close()
- #Item zone/zh_Hant_TW.res depends on missing item zone/zh_Hant.res
- pat = re.compile(br"^Item ([^ ]+) depends on missing item ([^ ]+).*")
- for i in range(len(erritems)):
- line = erritems[i].strip()
- m = pat.match(line)
- if m:
- toDelete = m.group(1).decode("utf-8")
- if(options.verbose > 5):
- print("<< %s added to delete" % toDelete)
- remove.add(toDelete)
- else:
- print("ERROR: could not match errline: %s" % line)
- sys.exit(1)
- if(options.verbose > 5):
- print(" now %d items to remove" % len(remove))
- if(oldcount == len(remove)):
- print(" ERROR: could not add any mor eitems to remove. Fail.")
- sys.exit(1)
- removeList(count+1)
-
-# fire it up
-removeList(1)
-
-# now, fixup res_index, one at a time
-for tree, value in trees.items():
- # skip trees that don't have res_index
- if "hasIndex" not in value:
- continue
- treebunddir = options.tmpdir
- if(value["treeprefix"]):
- treebunddir = os.path.join(treebunddir, value["treeprefix"])
- if not (os.path.isdir(treebunddir)):
- os.mkdir(treebunddir)
- treebundres = os.path.join(treebunddir,RES_INDX)
- treebundtxt = "%s.txt" % (treebundres[0:-4])
- runcmd("iculslocs", "-i %s -N %s -T %s -b %s" % (outfile, dataname, tree, treebundtxt))
- runcmd("genrb","-d %s -s %s res_index.txt" % (treebunddir, treebunddir))
- runcmd("icupkg","-s %s -a %s%s %s" % (options.tmpdir, value["treeprefix"], RES_INDX, outfile))
diff --git a/tools/icu/no-op.cc b/tools/icu/no-op.cc
deleted file mode 100644
index 08d1599a264..00000000000
--- a/tools/icu/no-op.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-**********************************************************************
-* Copyright (C) 2014, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-*
-*/
-
-//
-// ICU needs the C++, not the C linker to be used, even if the main function
-// is in C.
-//
-// This is a dummy function just to get gyp to compile some internal
-// tools as C++.
-//
-// It should not appear in production node binaries.
-
-extern void icu_dummy_cxx() {}
diff --git a/tools/icu/patches/75/source/common/unicode/platform.h b/tools/icu/patches/75/source/common/unicode/platform.h
deleted file mode 100644
index 59176005f33..00000000000
--- a/tools/icu/patches/75/source/common/unicode/platform.h
+++ /dev/null
@@ -1,849 +0,0 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
-******************************************************************************
-*
-* Copyright (C) 1997-2016, International Business Machines
-* Corporation and others. All Rights Reserved.
-*
-******************************************************************************
-*
-* FILE NAME : platform.h
-*
-* Date Name Description
-* 05/13/98 nos Creation (content moved here from ptypes.h).
-* 03/02/99 stephen Added AS400 support.
-* 03/30/99 stephen Added Linux support.
-* 04/13/99 stephen Reworked for autoconf.
-******************************************************************************
-*/
-
-#ifndef _PLATFORM_H
-#define _PLATFORM_H
-
-#include "unicode/uconfig.h"
-#include "unicode/uvernum.h"
-
-/**
- * \file
- * \brief Basic types for the platform.
- *
- * This file used to be generated by autoconf/configure.
- * Starting with ICU 49, platform.h is a normal source file,
- * to simplify cross-compiling and working with non-autoconf/make build systems.
- *
- * When a value in this file does not work on a platform, then please
- * try to derive it from the U_PLATFORM value
- * (for which we might need a new value constant in rare cases)
- * and/or from other macros that are predefined by the compiler
- * or defined in standard (POSIX or platform or compiler) headers.
- *
- * As a temporary workaround, you can add an explicit \#define for some macros
- * before it is first tested, or add an equivalent -D macro definition
- * to the compiler's command line.
- *
- * Note: Some compilers provide ways to show the predefined macros.
- * For example, with gcc you can compile an empty .c file and have the compiler
- * print the predefined macros with
- * \code
- * gcc -E -dM -x c /dev/null | sort
- * \endcode
- * (You can provide an actual empty .c file rather than /dev/null.
- * -x c++ is for C++.)
- */
-
-/**
- * Define some things so that they can be documented.
- * @internal
- */
-#ifdef U_IN_DOXYGEN
-/*
- * Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented.
- * Solution: #define any defines for non @internal API here, so that they are visible in the docs. If you just set PREDEFINED in Doxyfile.in, they won't be documented.
- */
-
-/* None for now. */
-#endif
-
-/**
- * \def U_PLATFORM
- * The U_PLATFORM macro defines the platform we're on.
- *
- * We used to define one different, value-less macro per platform.
- * That made it hard to know the set of relevant platforms and macros,
- * and hard to deal with variants of platforms.
- *
- * Starting with ICU 49, we define platforms as numeric macros,
- * with ranges of values for related platforms and their variants.
- * The U_PLATFORM macro is set to one of these values.
- *
- * Historical note from the Solaris Wikipedia article:
- * AT&T and Sun collaborated on a project to merge the most popular Unix variants
- * on the market at that time: BSD, System V, and Xenix.
- * This became Unix System V Release 4 (SVR4).
- *
- * @internal
- */
-
-/** Unknown platform. @internal */
-#define U_PF_UNKNOWN 0
-/** Windows @internal */
-#define U_PF_WINDOWS 1000
-/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */
-#define U_PF_MINGW 1800
-/**
- * Cygwin. Windows, calls to cygwin1.dll for Posix functions,
- * using MSVC or GNU gcc and binutils.
- * @internal
- */
-#define U_PF_CYGWIN 1900
-/* Reserve 2000 for U_PF_UNIX? */
-/** HP-UX is based on UNIX System V. @internal */
-#define U_PF_HPUX 2100
-/** Solaris is a Unix operating system based on SVR4. @internal */
-#define U_PF_SOLARIS 2600
-/** BSD is a UNIX operating system derivative. @internal */
-#define U_PF_BSD 3000
-/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */
-#define U_PF_AIX 3100
-/** IRIX is based on UNIX System V with BSD extensions. @internal */
-#define U_PF_IRIX 3200
-/**
- * Darwin is a POSIX-compliant operating system, composed of code developed by Apple,
- * as well as code derived from NeXTSTEP, BSD, and other projects,
- * built around the Mach kernel.
- * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.
- * (Original description modified from WikiPedia.)
- * @internal
- */
-#define U_PF_DARWIN 3500
-/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */
-#define U_PF_IPHONE 3550
-/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */
-#define U_PF_QNX 3700
-/** Linux is a Unix-like operating system. @internal */
-#define U_PF_LINUX 4000
-/**
- * Native Client is pretty close to Linux.
- * See https://developer.chrome.com/native-client and
- * http://www.chromium.org/nativeclient
- * @internal
- */
-#define U_PF_BROWSER_NATIVE_CLIENT 4020
-/** Android is based on Linux. @internal */
-#define U_PF_ANDROID 4050
-/** Fuchsia is a POSIX-ish platform. @internal */
-#define U_PF_FUCHSIA 4100
-/* Maximum value for Linux-based platform is 4499 */
-/**
- * Emscripten is a C++ transpiler for the Web that can target asm.js or
- * WebAssembly. It provides some POSIX-compatible wrappers and stubs and
- * some Linux-like functionality, but is not fully compatible with
- * either.
- * @internal
- */
-#define U_PF_EMSCRIPTEN 5010
-/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
-#define U_PF_OS390 9000
-/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
-#define U_PF_OS400 9400
-
-#ifdef U_PLATFORM
- /* Use the predefined value. */
-#elif defined(__MINGW32__)
-# define U_PLATFORM U_PF_MINGW
-#elif defined(__CYGWIN__)
-# define U_PLATFORM U_PF_CYGWIN
-#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
-# define U_PLATFORM U_PF_WINDOWS
-#elif defined(__ANDROID__)
-# define U_PLATFORM U_PF_ANDROID
- /* Android wchar_t support depends on the API level. */
-# include
-#elif defined(__pnacl__) || defined(__native_client__)
-# define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT
-#elif defined(__Fuchsia__)
-# define U_PLATFORM U_PF_FUCHSIA
-#elif defined(linux) || defined(__linux__) || defined(__linux)
-# define U_PLATFORM U_PF_LINUX
-#elif defined(__APPLE__) && defined(__MACH__)
-# include
-# if (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && (defined(TARGET_OS_MACCATALYST) && !TARGET_OS_MACCATALYST) /* variant of TARGET_OS_MAC */
-# define U_PLATFORM U_PF_IPHONE
-# else
-# define U_PLATFORM U_PF_DARWIN
-# endif
-#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)
-# if defined(__FreeBSD__)
-# include
-# endif
-# define U_PLATFORM U_PF_BSD
-#elif defined(sun) || defined(__sun)
- /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */
-# define U_PLATFORM U_PF_SOLARIS
-# if defined(__GNUC__)
- /* Solaris/GCC needs this header file to get the proper endianness. Normally, this
- * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h
- * is included which does not include this header file.
- */
-# include
-# endif
-#elif defined(_AIX) || defined(__TOS_AIX__)
-# define U_PLATFORM U_PF_AIX
-#elif defined(_hpux) || defined(hpux) || defined(__hpux)
-# define U_PLATFORM U_PF_HPUX
-#elif defined(sgi) || defined(__sgi)
-# define U_PLATFORM U_PF_IRIX
-#elif defined(__QNX__) || defined(__QNXNTO__)
-# define U_PLATFORM U_PF_QNX
-#elif defined(__TOS_MVS__)
-# define U_PLATFORM U_PF_OS390
-#elif defined(__OS400__) || defined(__TOS_OS400__)
-# define U_PLATFORM U_PF_OS400
-#elif defined(__EMSCRIPTEN__)
-# define U_PLATFORM U_PF_EMSCRIPTEN
-#else
-# define U_PLATFORM U_PF_UNKNOWN
-#endif
-
-/**
- * \def U_REAL_MSVC
- * Defined if the compiler is the real MSVC compiler (and not something like
- * Clang setting _MSC_VER in order to compile Windows code that requires it).
- * Otherwise undefined.
- * @internal
- */
-#if (defined(_MSC_VER) && !(defined(__clang__) && __clang__)) || defined(U_IN_DOXYGEN)
-# define U_REAL_MSVC
-#endif
-
-/**
- * \def CYGWINMSVC
- * Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
- * Otherwise undefined.
- * @internal
- */
-/* Commented out because this is already set in mh-cygwin-msvc
-#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
-# define CYGWINMSVC
-#endif
-*/
-#ifdef U_IN_DOXYGEN
-# define CYGWINMSVC
-#endif
-
-/**
- * \def U_PLATFORM_USES_ONLY_WIN32_API
- * Defines whether the platform uses only the Win32 API.
- * Set to 1 for Windows/MSVC, ClangCL and MinGW but not Cygwin.
- * @internal
- */
-#ifdef U_PLATFORM_USES_ONLY_WIN32_API
- /* Use the predefined value. */
-#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)
-# define U_PLATFORM_USES_ONLY_WIN32_API 1
-#else
- /* Cygwin implements POSIX. */
-# define U_PLATFORM_USES_ONLY_WIN32_API 0
-#endif
-
-/**
- * \def U_PLATFORM_HAS_WIN32_API
- * Defines whether the Win32 API is available on the platform.
- * Set to 1 for Windows/MSVC, ClangCL, MinGW and Cygwin.
- * @internal
- */
-#ifdef U_PLATFORM_HAS_WIN32_API
- /* Use the predefined value. */
-#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
-# define U_PLATFORM_HAS_WIN32_API 1
-#else
-# define U_PLATFORM_HAS_WIN32_API 0
-#endif
-
-/**
- * \def U_PLATFORM_HAS_WINUWP_API
- * Defines whether target is intended for Universal Windows Platform API
- * Set to 1 for Windows10 Release Solution Configuration
- * @internal
- */
-#ifdef U_PLATFORM_HAS_WINUWP_API
- /* Use the predefined value. */
-#else
-# define U_PLATFORM_HAS_WINUWP_API 0
-#endif
-
-/**
- * \def U_PLATFORM_IMPLEMENTS_POSIX
- * Defines whether the platform implements (most of) the POSIX API.
- * Set to 1 for Cygwin and most other platforms.
- * @internal
- */
-#ifdef U_PLATFORM_IMPLEMENTS_POSIX
- /* Use the predefined value. */
-#elif U_PLATFORM_USES_ONLY_WIN32_API
-# define U_PLATFORM_IMPLEMENTS_POSIX 0
-#else
-# define U_PLATFORM_IMPLEMENTS_POSIX 1
-#endif
-
-/**
- * \def U_PLATFORM_IS_LINUX_BASED
- * Defines whether the platform is Linux or one of its derivatives.
- * @internal
- */
-#ifdef U_PLATFORM_IS_LINUX_BASED
- /* Use the predefined value. */
-#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499
-# define U_PLATFORM_IS_LINUX_BASED 1
-#else
-# define U_PLATFORM_IS_LINUX_BASED 0
-#endif
-
-/**
- * \def U_PLATFORM_IS_DARWIN_BASED
- * Defines whether the platform is Darwin or one of its derivatives.
- * @internal
- */
-#ifdef U_PLATFORM_IS_DARWIN_BASED
- /* Use the predefined value. */
-#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE
-# define U_PLATFORM_IS_DARWIN_BASED 1
-#else
-# define U_PLATFORM_IS_DARWIN_BASED 0
-#endif
-
-/*===========================================================================*/
-/** @{ Compiler and environment features */
-/*===========================================================================*/
-
-/**
- * \def U_GCC_MAJOR_MINOR
- * Indicates whether the compiler is gcc (test for != 0),
- * and if so, contains its major (times 100) and minor version numbers.
- * If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.
- *
- * For example, for testing for whether we have gcc, and whether it's 4.6 or higher,
- * use "#if U_GCC_MAJOR_MINOR >= 406".
- * @internal
- */
-#ifdef __GNUC__
-# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)
-#else
-# define U_GCC_MAJOR_MINOR 0
-#endif
-
-/**
- * \def U_IS_BIG_ENDIAN
- * Determines the endianness of the platform.
- * @internal
- */
-#ifdef U_IS_BIG_ENDIAN
- /* Use the predefined value. */
-#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)
-# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
-#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
- /* gcc */
-# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
-#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
-# define U_IS_BIG_ENDIAN 1
-#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
-# define U_IS_BIG_ENDIAN 0
-#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__)
- /* These platforms do not appear to predefine any endianness macros. */
-# define U_IS_BIG_ENDIAN 1
-#elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0)
- /* HPPA do not appear to predefine any endianness macros. */
-# define U_IS_BIG_ENDIAN 1
-#elif defined(sparc) || defined(__sparc) || defined(__sparc__)
- /* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */
-# define U_IS_BIG_ENDIAN 1
-#else
-# define U_IS_BIG_ENDIAN 0
-#endif
-
-/**
- * \def U_HAVE_PLACEMENT_NEW
- * Determines whether to override placement new and delete for STL.
- * @stable ICU 2.6
- */
-#ifdef U_HAVE_PLACEMENT_NEW
- /* Use the predefined value. */
-#elif defined(__BORLANDC__)
-# define U_HAVE_PLACEMENT_NEW 0
-#else
-# define U_HAVE_PLACEMENT_NEW 1
-#endif
-
-/**
- * \def U_HAVE_DEBUG_LOCATION_NEW
- * Define this to define the MFC debug version of the operator new.
- *
- * @stable ICU 3.4
- */
-#ifdef U_HAVE_DEBUG_LOCATION_NEW
- /* Use the predefined value. */
-#elif defined(_MSC_VER)
-# define U_HAVE_DEBUG_LOCATION_NEW 1
-#else
-# define U_HAVE_DEBUG_LOCATION_NEW 0
-#endif
-
-/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
-#ifdef __has_attribute
-# define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x)
-#else
-# define UPRV_HAS_ATTRIBUTE(x) 0
-#endif
-#ifdef __has_cpp_attribute
-# define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
-#else
-# define UPRV_HAS_CPP_ATTRIBUTE(x) 0
-#endif
-#ifdef __has_declspec_attribute
-# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
-#else
-# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0
-#endif
-#ifdef __has_builtin
-# define UPRV_HAS_BUILTIN(x) __has_builtin(x)
-#else
-# define UPRV_HAS_BUILTIN(x) 0
-#endif
-#ifdef __has_feature
-# define UPRV_HAS_FEATURE(x) __has_feature(x)
-#else
-# define UPRV_HAS_FEATURE(x) 0
-#endif
-#ifdef __has_extension
-# define UPRV_HAS_EXTENSION(x) __has_extension(x)
-#else
-# define UPRV_HAS_EXTENSION(x) 0
-#endif
-#ifdef __has_warning
-# define UPRV_HAS_WARNING(x) __has_warning(x)
-#else
-# define UPRV_HAS_WARNING(x) 0
-#endif
-
-
-#if defined(__clang__)
-#define UPRV_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
-#else
-#define UPRV_NO_SANITIZE_UNDEFINED
-#endif
-
-/**
- * \def U_MALLOC_ATTR
- * Attribute to mark functions as malloc-like
- * @internal
- */
-#if defined(__GNUC__) && __GNUC__>=3
-# define U_MALLOC_ATTR __attribute__ ((__malloc__))
-#else
-# define U_MALLOC_ATTR
-#endif
-
-/**
- * \def U_ALLOC_SIZE_ATTR
- * Attribute to specify the size of the allocated buffer for malloc-like functions
- * @internal
- */
-#if (defined(__GNUC__) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
- UPRV_HAS_ATTRIBUTE(alloc_size)
-# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))
-# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))
-#else
-# define U_ALLOC_SIZE_ATTR(X)
-# define U_ALLOC_SIZE_ATTR2(X,Y)
-#endif
-
-/**
- * \def U_CPLUSPLUS_VERSION
- * 0 if no C++; 1, 11, 14, ... if C++.
- * Support for specific features cannot always be determined by the C++ version alone.
- * @internal
- */
-#ifdef U_CPLUSPLUS_VERSION
-# if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus)
-# undef U_CPLUSPLUS_VERSION
-# define U_CPLUSPLUS_VERSION 0
-# endif
- /* Otherwise use the predefined value. */
-#elif !defined(__cplusplus)
-# define U_CPLUSPLUS_VERSION 0
-#elif __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
-# define U_CPLUSPLUS_VERSION 17
-#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
-# define U_CPLUSPLUS_VERSION 14
-#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
-# define U_CPLUSPLUS_VERSION 11
-#else
- // C++98 or C++03
-# define U_CPLUSPLUS_VERSION 1
-#endif
-
-/**
- * \def U_FALLTHROUGH
- * Annotate intentional fall-through between switch labels.
- * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
- * @internal
- */
-#ifndef __cplusplus
- // Not for C.
-#elif defined(U_FALLTHROUGH)
- // Use the predefined value.
-#elif defined(__clang__)
- // Test for compiler vs. feature separately.
- // Other compilers might choke on the feature test.
-# if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \
- (UPRV_HAS_FEATURE(cxx_attributes) && \
- UPRV_HAS_WARNING("-Wimplicit-fallthrough"))
-# define U_FALLTHROUGH [[clang::fallthrough]]
-# endif
-#elif defined(__GNUC__) && (__GNUC__ >= 7)
-# define U_FALLTHROUGH __attribute__((fallthrough))
-#endif
-
-#ifndef U_FALLTHROUGH
-# define U_FALLTHROUGH
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Character data types */
-/*===========================================================================*/
-
-/**
- * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
- * @stable ICU 2.0
- */
-#define U_ASCII_FAMILY 0
-
-/**
- * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
- * @stable ICU 2.0
- */
-#define U_EBCDIC_FAMILY 1
-
-/**
- * \def U_CHARSET_FAMILY
- *
- * These definitions allow to specify the encoding of text
- * in the char data type as defined by the platform and the compiler.
- * It is enough to determine the code point values of "invariant characters",
- * which are the ones shared by all encodings that are in use
- * on a given platform.
- *
- * Those "invariant characters" should be all the uppercase and lowercase
- * latin letters, the digits, the space, and "basic punctuation".
- * Also, '\\n', '\\r', '\\t' should be available.
- *
- * The list of "invariant characters" is:
- * \code
- * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _
- * \endcode
- *
- * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)
- *
- * This matches the IBM Syntactic Character Set (CS 640).
- *
- * In other words, all the graphic characters in 7-bit ASCII should
- * be safely accessible except the following:
- *
- * \code
- * '\'
- * '['
- * ']'
- * '{'
- * '}'
- * '^'
- * '~'
- * '!'
- * '#'
- * '|'
- * '$'
- * '@'
- * '`'
- * \endcode
- * @stable ICU 2.0
- */
-#ifdef U_CHARSET_FAMILY
- /* Use the predefined value. */
-#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)
-# define U_CHARSET_FAMILY U_EBCDIC_FAMILY
-#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)
-# define U_CHARSET_FAMILY U_EBCDIC_FAMILY
-#else
-# define U_CHARSET_FAMILY U_ASCII_FAMILY
-#endif
-
-/**
- * \def U_CHARSET_IS_UTF8
- *
- * Hardcode the default charset to UTF-8.
- *
- * If this is set to 1, then
- * - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
- * contain UTF-8 text, regardless of what the system API uses
- * - some ICU code will use fast functions like u_strFromUTF8()
- * rather than the more general and more heavy-weight conversion API (ucnv.h)
- * - ucnv_getDefaultName() always returns "UTF-8"
- * - ucnv_setDefaultName() is disabled and will not change the default charset
- * - static builds of ICU are smaller
- * - more functionality is available with the UCONFIG_NO_CONVERSION build-time
- * configuration option (see unicode/uconfig.h)
- * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
- *
- * @stable ICU 4.2
- * @see UCONFIG_NO_CONVERSION
- */
-#ifdef U_CHARSET_IS_UTF8
- /* Use the predefined value. */
-#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \
- U_PLATFORM == U_PF_EMSCRIPTEN
-# define U_CHARSET_IS_UTF8 1
-#else
-# define U_CHARSET_IS_UTF8 0
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Information about wchar support */
-/*===========================================================================*/
-
-/**
- * \def U_HAVE_WCHAR_H
- * Indicates whether is available (1) or not (0). Set to 1 by default.
- *
- * @stable ICU 2.0
- */
-#ifdef U_HAVE_WCHAR_H
- /* Use the predefined value. */
-#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9
- /*
- * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.
- * The type and header existed, but the library functions did not work as expected.
- * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.
- */
-# define U_HAVE_WCHAR_H 0
-#else
-# define U_HAVE_WCHAR_H 1
-#endif
-
-/**
- * \def U_SIZEOF_WCHAR_T
- * U_SIZEOF_WCHAR_T==sizeof(wchar_t)
- *
- * @stable ICU 2.0
- */
-#ifdef U_SIZEOF_WCHAR_T
- /* Use the predefined value. */
-#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9)
- /*
- * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.
- * Newer Mac OS X has size 4.
- */
-# define U_SIZEOF_WCHAR_T 1
-#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN
-# define U_SIZEOF_WCHAR_T 2
-#elif U_PLATFORM == U_PF_AIX
- /*
- * AIX 6.1 information, section "Wide character data representation":
- * "... the wchar_t datatype is 32-bit in the 64-bit environment and
- * 16-bit in the 32-bit environment."
- * and
- * "All locales use Unicode for their wide character code values (process code),
- * except the IBM-eucTW codeset."
- */
-# ifdef __64BIT__
-# define U_SIZEOF_WCHAR_T 4
-# else
-# define U_SIZEOF_WCHAR_T 2
-# endif
-#elif U_PLATFORM == U_PF_OS390
- /*
- * z/OS V1R11 information center, section "LP64 | ILP32":
- * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.
- * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."
- */
-# ifdef _LP64
-# define U_SIZEOF_WCHAR_T 4
-# else
-# define U_SIZEOF_WCHAR_T 2
-# endif
-#elif U_PLATFORM == U_PF_OS400
-# if defined(__UTF32__)
- /*
- * LOCALETYPE(*LOCALEUTF) is specified.
- * Wide-character strings are in UTF-32,
- * narrow-character strings are in UTF-8.
- */
-# define U_SIZEOF_WCHAR_T 4
-# elif defined(__UCS2__)
- /*
- * LOCALETYPE(*LOCALEUCS2) is specified.
- * Wide-character strings are in UCS-2,
- * narrow-character strings are in EBCDIC.
- */
-# define U_SIZEOF_WCHAR_T 2
-# else
- /*
- * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
- * Wide-character strings are in 16-bit EBCDIC,
- * narrow-character strings are in EBCDIC.
- */
-# define U_SIZEOF_WCHAR_T 2
-# endif
-#else
-# define U_SIZEOF_WCHAR_T 4
-#endif
-
-#ifndef U_HAVE_WCSCPY
-#define U_HAVE_WCSCPY U_HAVE_WCHAR_H
-#endif
-
-/** @} */
-
-/**
- * \def U_HAVE_CHAR16_T
- * Defines whether the char16_t type is available for UTF-16
- * and u"abc" UTF-16 string literals are supported.
- * This is a new standard type and standard string literal syntax in C++11
- * but has been available in some compilers before.
- * @internal
- */
-#ifdef U_HAVE_CHAR16_T
- /* Use the predefined value. */
-#else
- /*
- * Notes:
- * C++11 and C11 require support for UTF-16 literals
- * Doesn't work on Mac C11 (see workaround in ptypes.h).
- */
-# if defined(__cplusplus) || !U_PLATFORM_IS_DARWIN_BASED
-# define U_HAVE_CHAR16_T 1
-# else
-# define U_HAVE_CHAR16_T 0
-# endif
-#endif
-
-/**
- * @{
- * \def U_DECLARE_UTF16
- * Do not use this macro because it is not defined on all platforms.
- * Use the UNICODE_STRING or U_STRING_DECL macros instead.
- * @internal
- */
-#ifdef U_DECLARE_UTF16
- /* Use the predefined value. */
-#elif U_HAVE_CHAR16_T \
- || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
- || (defined(__HP_aCC) && __HP_aCC >= 035000) \
- || (defined(__HP_cc) && __HP_cc >= 111106) \
- || (defined(U_IN_DOXYGEN))
-# define U_DECLARE_UTF16(string) u ## string
-#elif U_SIZEOF_WCHAR_T == 2 \
- && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))
-# define U_DECLARE_UTF16(string) L ## string
-#else
- /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */
-#endif
-
-/** @} */
-
-/*===========================================================================*/
-/** @{ Symbol import-export control */
-/*===========================================================================*/
-
-#ifdef U_EXPORT
- /* Use the predefined value. */
-#elif defined(U_STATIC_IMPLEMENTATION)
-# define U_EXPORT
-#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \
- UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
-# define U_EXPORT __declspec(dllexport)
-#elif defined(__GNUC__)
-# define U_EXPORT __attribute__((visibility("default")))
-#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
- || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
-# define U_EXPORT __global
-/*#elif defined(__HP_aCC) || defined(__HP_cc)
-# define U_EXPORT __declspec(dllexport)*/
-#else
-# define U_EXPORT
-#endif
-
-/* U_CALLCONV is related to U_EXPORT2 */
-#ifdef U_EXPORT2
- /* Use the predefined value. */
-#elif defined(_MSC_VER)
-# define U_EXPORT2 __cdecl
-#else
-# define U_EXPORT2
-#endif
-
-#ifdef U_IMPORT
- /* Use the predefined value. */
-#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \
- UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
- /* Windows needs to export/import data. */
-# define U_IMPORT __declspec(dllimport)
-#else
-# define U_IMPORT
-#endif
-
-/**
- * \def U_HIDDEN
- * This is used to mark internal structs declared within external classes,
- * to prevent the internal structs from having the same visibility as the
- * class within which they are declared.
- * @internal
- */
-#ifdef U_HIDDEN
- /* Use the predefined value. */
-#elif defined(__GNUC__)
-# define U_HIDDEN __attribute__((visibility("hidden")))
-#else
-# define U_HIDDEN
-#endif
-
-/**
- * \def U_CALLCONV
- * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
- * in callback function typedefs to make sure that the calling convention
- * is compatible.
- *
- * This is only used for non-ICU-API functions.
- * When a function is a public ICU API,
- * you must use the U_CAPI and U_EXPORT2 qualifiers.
- *
- * Please note, you need to use U_CALLCONV after the *.
- *
- * NO : "static const char U_CALLCONV *func( . . . )"
- * YES: "static const char* U_CALLCONV func( . . . )"
- *
- * @stable ICU 2.0
- */
-#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
-# define U_CALLCONV __cdecl
-#else
-# define U_CALLCONV U_EXPORT2
-#endif
-
-/**
- * \def U_CALLCONV_FPTR
- * Similar to U_CALLCONV, but only used on function pointers.
- * @internal
- */
-#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
-# define U_CALLCONV_FPTR U_CALLCONV
-#else
-# define U_CALLCONV_FPTR
-#endif
-/** @} */
-
-#endif // _PLATFORM_H
diff --git a/tools/icu/patches/75/source/tools/genccode/genccode.c b/tools/icu/patches/75/source/tools/genccode/genccode.c
deleted file mode 100644
index 0f243952a7d..00000000000
--- a/tools/icu/patches/75/source/tools/genccode/genccode.c
+++ /dev/null
@@ -1,226 +0,0 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/*
- *******************************************************************************
- * Copyright (C) 1999-2016, International Business Machines
- * Corporation and others. All Rights Reserved.
- *******************************************************************************
- * file name: gennames.c
- * encoding: UTF-8
- * tab size: 8 (not used)
- * indentation:4
- *
- * created on: 1999nov01
- * created by: Markus W. Scherer
- *
- * This program reads a binary file and creates a C source code file
- * with a byte array that contains the data of the binary file.
- *
- * 12/09/1999 weiv Added multiple file handling
- */
-
-#include "unicode/utypes.h"
-
-#if U_PLATFORM_HAS_WIN32_API
-# define VC_EXTRALEAN
-# define WIN32_LEAN_AND_MEAN
-# define NOUSER
-# define NOSERVICE
-# define NOIME
-# define NOMCX
-#include
-#include
-#endif
-
-#if U_PLATFORM_IS_LINUX_BASED && U_HAVE_ELF_H
-# define U_ELF
-#endif
-
-#ifdef U_ELF
-# include
-# if defined(ELFCLASS64)
-# define U_ELF64
-# endif
- /* Old elf.h headers may not have EM_X86_64, or have EM_X8664 instead. */
-# ifndef EM_X86_64
-# define EM_X86_64 62
-# endif
-# define ICU_ENTRY_OFFSET 0
-#endif
-
-#include
-#include
-#include
-#include "unicode/putil.h"
-#include "cmemory.h"
-#include "cstring.h"
-#include "filestrm.h"
-#include "toolutil.h"
-#include "unicode/uclean.h"
-#include "uoptions.h"
-#include "pkg_genc.h"
-
-enum {
- kOptHelpH = 0,
- kOptHelpQuestionMark,
- kOptDestDir,
- kOptQuiet,
- kOptName,
- kOptEntryPoint,
-#ifdef CAN_GENERATE_OBJECTS
- kOptObject,
- kOptMatchArch,
- kOptCpuArch,
- kOptSkipDllExport,
-#endif
- kOptFilename,
- kOptAssembly
-};
-
-static UOption options[]={
-/*0*/UOPTION_HELP_H,
- UOPTION_HELP_QUESTION_MARK,
- UOPTION_DESTDIR,
- UOPTION_QUIET,
- UOPTION_DEF("name", 'n', UOPT_REQUIRES_ARG),
- UOPTION_DEF("entrypoint", 'e', UOPT_REQUIRES_ARG),
-#ifdef CAN_GENERATE_OBJECTS
-/*6*/UOPTION_DEF("object", 'o', UOPT_NO_ARG),
- UOPTION_DEF("match-arch", 'm', UOPT_REQUIRES_ARG),
- UOPTION_DEF("cpu-arch", 'c', UOPT_REQUIRES_ARG),
- UOPTION_DEF("skip-dll-export", '\0', UOPT_NO_ARG),
-#endif
- UOPTION_DEF("filename", 'f', UOPT_REQUIRES_ARG),
- UOPTION_DEF("assembly", 'a', UOPT_REQUIRES_ARG)
-};
-
-#define CALL_WRITECCODE 'c'
-#define CALL_WRITEASSEMBLY 'a'
-#define CALL_WRITEOBJECT 'o'
-extern int
-main(int argc, char* argv[]) {
- UBool verbose = true;
- char writeCode;
-
- U_MAIN_INIT_ARGS(argc, argv);
-
- options[kOptDestDir].value = ".";
-
- /* read command line options */
- argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);
-
- /* error handling, printing usage message */
- if(argc<0) {
- fprintf(stderr,
- "error in command line argument \"%s\"\n",
- argv[-argc]);
- }
- if(argc<0 || options[kOptHelpH].doesOccur || options[kOptHelpQuestionMark].doesOccur) {
- fprintf(stderr,
- "usage: %s [-options] filename1 filename2 ...\n"
- "\tread each binary input file and \n"
- "\tcreate a .c file with a byte array that contains the input file's data\n"
- "options:\n"
- "\t-h or -? or --help this usage text\n"
- "\t-d or --destdir destination directory, followed by the path\n"
- "\t-q or --quiet do not display warnings and progress\n"
- "\t-n or --name symbol prefix, followed by the prefix\n"
- "\t-e or --entrypoint entry point name, followed by the name (_dat will be appended)\n"
- "\t-r or --revision Specify a version\n"
- , argv[0]);
-#ifdef CAN_GENERATE_OBJECTS
- fprintf(stderr,
- "\t-o or --object write a .obj file instead of .c\n"
- "\t-m or --match-arch file.o match the architecture (CPU, 32/64 bits) of the specified .o\n"
- "\t ELF format defaults to i386. Windows defaults to the native platform.\n"
- "\t-c or --cpu-arch Specify a CPU architecture for which to write a .obj file for ClangCL on Windows\n"
- "\t Valid values for this opton are x64, x86 and arm64.\n"
- "\t--skip-dll-export Don't export the ICU data entry point symbol (for use when statically linking)\n");
-#endif
- fprintf(stderr,
- "\t-f or --filename Specify an alternate base filename. (default: symbolname_typ)\n"
- "\t-a or --assembly Create assembly file. (possible values are: ");
-
- printAssemblyHeadersToStdErr();
- } else {
- const char *message, *filename;
- /* TODO: remove void (*writeCode)(const char *, const char *); */
-
- if(options[kOptAssembly].doesOccur) {
- message="generating assembly code for %s\n";
- writeCode = CALL_WRITEASSEMBLY;
- /* TODO: remove writeCode=&writeAssemblyCode; */
-
- if (!checkAssemblyHeaderName(options[kOptAssembly].value)) {
- fprintf(stderr,
- "Assembly type \"%s\" is unknown.\n", options[kOptAssembly].value);
- return -1;
- }
- }
-#ifdef CAN_GENERATE_OBJECTS
- else if(options[kOptObject].doesOccur) {
- message="generating object code for %s\n";
- writeCode = CALL_WRITEOBJECT;
- /* TODO: remove writeCode=&writeObjectCode; */
- }
-#endif
- else
- {
- message="generating C code for %s\n";
- writeCode = CALL_WRITECCODE;
- /* TODO: remove writeCode=&writeCCode; */
- }
- if (options[kOptQuiet].doesOccur) {
- verbose = false;
- }
- while(--argc) {
- filename=getLongPathname(argv[argc]);
- if (verbose) {
- fprintf(stdout, message, filename);
- }
-
- switch (writeCode) {
- case CALL_WRITECCODE:
- writeCCode(filename, options[kOptDestDir].value,
- options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL,
- options[kOptName].doesOccur ? options[kOptName].value : NULL,
- options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL,
- NULL,
- 0);
- break;
- case CALL_WRITEASSEMBLY:
- writeAssemblyCode(filename, options[kOptDestDir].value,
- options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL,
- options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL,
- NULL,
- 0);
- break;
-#ifdef CAN_GENERATE_OBJECTS
- case CALL_WRITEOBJECT:
- if(options[kOptCpuArch].doesOccur) {
- if (!checkCpuArchitecture(options[kOptCpuArch].value)) {
- fprintf(stderr,
- "CPU architecture \"%s\" is unknown.\n", options[kOptCpuArch].value);
- return -1;
- }
- }
- writeObjectCode(filename, options[kOptDestDir].value,
- options[kOptEntryPoint].doesOccur ? options[kOptEntryPoint].value : NULL,
- options[kOptMatchArch].doesOccur ? options[kOptMatchArch].value : NULL,
- options[kOptCpuArch].doesOccur ? options[kOptCpuArch].value : NULL,
- options[kOptFilename].doesOccur ? options[kOptFilename].value : NULL,
- NULL,
- 0,
- !options[kOptSkipDllExport].doesOccur);
- break;
-#endif
- default:
- /* Should never occur. */
- break;
- }
- /* TODO: remove writeCode(filename, options[kOptDestDir].value); */
- }
- }
-
- return 0;
-}
diff --git a/tools/icu/patches/75/source/tools/genccode/pkg_genc.h b/tools/icu/patches/75/source/tools/genccode/pkg_genc.h
deleted file mode 100644
index 76474ec7df6..00000000000
--- a/tools/icu/patches/75/source/tools/genccode/pkg_genc.h
+++ /dev/null
@@ -1,111 +0,0 @@
-// © 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/pkgdata.cpp b/tools/icu/patches/75/source/tools/pkgdata/pkgdata.cpp
deleted file mode 100644
index 51452a51bb3..00000000000
--- a/tools/icu/patches/75/source/tools/pkgdata/pkgdata.cpp
+++ /dev/null
@@ -1,2292 +0,0 @@
-// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/******************************************************************************
- * Copyright (C) 2000-2016, International Business Machines
- * Corporation and others. All Rights Reserved.
- *******************************************************************************
- * file name: pkgdata.cpp
- * encoding: ANSI X3.4 (1968)
- * tab size: 8 (not used)
- * indentation:4
- *
- * created on: 2000may15
- * created by: Steven \u24C7 Loomis
- *
- * This program packages the ICU data into different forms
- * (DLL, common data, etc.)
- */
-
-// Defines _XOPEN_SOURCE for access to POSIX functions.
-// Must be before any other #includes.
-#include "uposixdefs.h"
-
-#include "unicode/utypes.h"
-
-#include "unicode/putil.h"
-#include "putilimp.h"
-
-#if U_HAVE_POPEN
-#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__)
-/* popen/pclose aren't defined in strict ANSI on Cygwin and MinGW */
-#undef __STRICT_ANSI__
-#endif
-#endif
-
-#include "cmemory.h"
-#include "cstring.h"
-#include "filestrm.h"
-#include "toolutil.h"
-#include "unicode/uclean.h"
-#include "unewdata.h"
-#include "uoptions.h"
-#include "package.h"
-#include "pkg_icu.h"
-#include "pkg_genc.h"
-#include "pkg_gencmn.h"
-#include "flagparser.h"
-#include "filetools.h"
-#include "charstr.h"
-#include "uassert.h"
-
-#if U_HAVE_POPEN
-# include