icu: make darwin.ICU the default on Darwin (#360922)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
fixDarwinDylibNames,
|
||||
mkAppleDerivation,
|
||||
python3,
|
||||
stdenv, # Necessary for compatibility with python3Packages.tensorflow, which tries to override the stdenv
|
||||
testers,
|
||||
}:
|
||||
|
||||
@@ -24,6 +25,12 @@ let
|
||||
sourceRoot = "source/icu/icu4c/source";
|
||||
|
||||
patches = [
|
||||
# Apple defaults to `uint16_t` for compatibility with building one of their private frameworks,
|
||||
# but nixpkgs needs `char16_t` for compatibility with packages that expect upstream ICU with `char16_t`.
|
||||
# According to `unicode/umachine.h`, these types are bit-compatible but distinct in C++.
|
||||
./patches/define-uchar-as-char16_t.patch
|
||||
# Enable the C++ API by default to match the upstream ICU packaging in nixpkgs
|
||||
./patches/enable-cxx-api-by-default.patch
|
||||
# Skip MessageFormatTest test, which is known to crash sometimes and should be suppressed if it does.
|
||||
./patches/suppress-icu-check-crash.patch
|
||||
];
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
diff --git a/icu/icu4c/source/common/unicode/umachine.h b/icu/icu4c/source/common/unicode/umachine.h
|
||||
index 9483031569..e451ad7c02 100644
|
||||
--- a/common/unicode/umachine.h
|
||||
+++ b/common/unicode/umachine.h
|
||||
@@ -387,39 +387,6 @@
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
|
||||
-#if APPLE_ICU_CHANGES
|
||||
-// rdar://121241618 (StarlightE: VideosUI-883.40.54#24 has failed to build in install; cannot initialize a variable of type 'const UChar *' (aka 'const char16_t)
|
||||
-#if 0
|
||||
- // #if 1 is normal (Apple uses 0 to force us to still use uint16_t). UChar defaults to char16_t in C++.
|
||||
- // For configuration testing of UChar=uint16_t temporarily change this to #if 0.
|
||||
- // The intltest Makefile #defines UCHAR_TYPE=char16_t,
|
||||
- // so we only #define it to uint16_t if it is undefined so far.
|
||||
-#elif !defined(UCHAR_TYPE)
|
||||
-# define UCHAR_TYPE uint16_t
|
||||
-#endif
|
||||
-
|
||||
-#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
|
||||
- defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \
|
||||
- defined (U_TOOLUTIL_IMPLEMENTATION)
|
||||
- // Inside the ICU library code, never configurable.
|
||||
- typedef char16_t UChar;
|
||||
-#elif defined(T_CTEST_IMPLEMENTATION)
|
||||
- // internally to ctestfw, we want to use char16_t in C++ and uint_16 in C
|
||||
- #if U_CPLUSPLUS_VERSION != 0
|
||||
- typedef char16_t UChar; // C++
|
||||
- #else
|
||||
- typedef uint16_t UChar; // C
|
||||
- #endif
|
||||
-#elif defined(UCHAR_TYPE)
|
||||
- typedef UCHAR_TYPE UChar;
|
||||
-#elif U_CPLUSPLUS_VERSION != 0
|
||||
- typedef char16_t UChar; // C++
|
||||
-#else
|
||||
- typedef uint16_t UChar; // C
|
||||
-#endif
|
||||
-
|
||||
-#else
|
||||
-
|
||||
#if 1
|
||||
// #if 1 is normal. UChar defaults to char16_t in C++.
|
||||
// For configuration testing of UChar=uint16_t temporarily change this to #if 0.
|
||||
@@ -441,8 +408,6 @@
|
||||
typedef uint16_t UChar; // C
|
||||
#endif
|
||||
|
||||
-#endif // APPLE_ICU_CHANGES
|
||||
-
|
||||
/**
|
||||
* \var OldUChar
|
||||
* Default ICU 58 definition of UChar.
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
diff --git a/icu/icu4c/source/common/unicode/utypes.h b/icu/icu4c/source/common/unicode/utypes.h
|
||||
index a3e0ec911c..e361c658ef 100644
|
||||
--- a/common/unicode/utypes.h
|
||||
+++ b/common/unicode/utypes.h
|
||||
@@ -66,20 +66,6 @@
|
||||
* \def U_SHOW_CPLUSPLUS_API
|
||||
* @internal
|
||||
*/
|
||||
-#if APPLE_ICU_CHANGES
|
||||
-// rdar://60884991 #58 Replace installsrc patching with changes directly in header files
|
||||
-// Apple modifies the default to be 0, not 1
|
||||
-#ifdef __cplusplus
|
||||
-# ifndef U_SHOW_CPLUSPLUS_API
|
||||
-# define U_SHOW_CPLUSPLUS_API 0
|
||||
-# endif
|
||||
-#else
|
||||
-# undef U_SHOW_CPLUSPLUS_API
|
||||
-# define U_SHOW_CPLUSPLUS_API 0
|
||||
-#endif
|
||||
-
|
||||
-#else
|
||||
-
|
||||
#ifdef __cplusplus
|
||||
# ifndef U_SHOW_CPLUSPLUS_API
|
||||
# define U_SHOW_CPLUSPLUS_API 1
|
||||
@@ -89,28 +75,6 @@
|
||||
# define U_SHOW_CPLUSPLUS_API 0
|
||||
#endif
|
||||
|
||||
-#endif // APPLE_ICU_CHANGES
|
||||
-
|
||||
-
|
||||
-#if APPLE_ICU_CHANGES
|
||||
-// rdar://30624081 64b8ed9b89.. Add #if U_SHOW_CPLUSPLUS_API..#endif around C++ interfaces that don’t have it
|
||||
-// rdar://24075048 0f5f76d43c.. update ICU for AAS to use VS2015, remove old ICU 4.0 shims, fix build issues
|
||||
-/*
|
||||
- * Apple-specific warning if U_SHOW_CPLUSPLUS_API set and the compile
|
||||
- * is not for a build of ICU itself (ICU_DATA_DIR is always defined
|
||||
- * for ICU builds, and is unlikely to be defined for client builds).
|
||||
- * Windows VSC compliler does not like #warning, skip for it.
|
||||
- */
|
||||
-#if U_SHOW_CPLUSPLUS_API
|
||||
-#ifndef ICU_DATA_DIR
|
||||
-#if U_PLATFORM!=U_PF_WINDOWS
|
||||
-#warning Do not set U_SHOW_CPLUSPLUS_API for code that ships with the OS, it is only for local tools.
|
||||
-#warning ICU C++ functionality may not be used by any OS client, it is not binary compatible across updates.
|
||||
-#endif
|
||||
-#endif
|
||||
-#endif
|
||||
-#endif // APPLE_ICU_CHANGES
|
||||
-
|
||||
/** @{ API visibility control */
|
||||
|
||||
/**
|
||||
@@ -9376,7 +9376,12 @@ with pkgs;
|
||||
icu76
|
||||
;
|
||||
|
||||
icu = icu74;
|
||||
# Use Apple’s fork of ICU by default, which provides additional APIs that are not present in upstream ICU.
|
||||
#
|
||||
# `icuReal` is provided in case the upstream icu package is needed on Darwin instead of the fork.
|
||||
# Note that the versioned icu packages always correspond to the upstream versions.
|
||||
icuReal = icu74;
|
||||
icu = if stdenv.hostPlatform.isDarwin then darwin.ICU else icuReal;
|
||||
|
||||
idasen = with python3Packages; toPythonApplication idasen;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user