icu: make darwin.ICU the default on Darwin (#360922)

authored by Emily and committed by GitHub a44f4af0 10ba47da

+120 -1
+7
pkgs/os-specific/darwin/apple-source-releases/ICU/package.nix
··· 5 fixDarwinDylibNames, 6 mkAppleDerivation, 7 python3, 8 testers, 9 }: 10 ··· 24 sourceRoot = "source/icu/icu4c/source"; 25 26 patches = [ 27 # Skip MessageFormatTest test, which is known to crash sometimes and should be suppressed if it does. 28 ./patches/suppress-icu-check-crash.patch 29 ];
··· 5 fixDarwinDylibNames, 6 mkAppleDerivation, 7 python3, 8 + stdenv, # Necessary for compatibility with python3Packages.tensorflow, which tries to override the stdenv 9 testers, 10 }: 11 ··· 25 sourceRoot = "source/icu/icu4c/source"; 26 27 patches = [ 28 + # Apple defaults to `uint16_t` for compatibility with building one of their private frameworks, 29 + # but nixpkgs needs `char16_t` for compatibility with packages that expect upstream ICU with `char16_t`. 30 + # According to `unicode/umachine.h`, these types are bit-compatible but distinct in C++. 31 + ./patches/define-uchar-as-char16_t.patch 32 + # Enable the C++ API by default to match the upstream ICU packaging in nixpkgs 33 + ./patches/enable-cxx-api-by-default.patch 34 # Skip MessageFormatTest test, which is known to crash sometimes and should be suppressed if it does. 35 ./patches/suppress-icu-check-crash.patch 36 ];
+53
pkgs/os-specific/darwin/apple-source-releases/ICU/patches/define-uchar-as-char16_t.patch
···
··· 1 + diff --git a/icu/icu4c/source/common/unicode/umachine.h b/icu/icu4c/source/common/unicode/umachine.h 2 + index 9483031569..e451ad7c02 100644 3 + --- a/common/unicode/umachine.h 4 + +++ b/common/unicode/umachine.h 5 + @@ -387,39 +387,6 @@ 6 + * @stable ICU 4.4 7 + */ 8 + 9 + -#if APPLE_ICU_CHANGES 10 + -// 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) 11 + -#if 0 12 + - // #if 1 is normal (Apple uses 0 to force us to still use uint16_t). UChar defaults to char16_t in C++. 13 + - // For configuration testing of UChar=uint16_t temporarily change this to #if 0. 14 + - // The intltest Makefile #defines UCHAR_TYPE=char16_t, 15 + - // so we only #define it to uint16_t if it is undefined so far. 16 + -#elif !defined(UCHAR_TYPE) 17 + -# define UCHAR_TYPE uint16_t 18 + -#endif 19 + - 20 + -#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ 21 + - defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \ 22 + - defined (U_TOOLUTIL_IMPLEMENTATION) 23 + - // Inside the ICU library code, never configurable. 24 + - typedef char16_t UChar; 25 + -#elif defined(T_CTEST_IMPLEMENTATION) 26 + - // internally to ctestfw, we want to use char16_t in C++ and uint_16 in C 27 + - #if U_CPLUSPLUS_VERSION != 0 28 + - typedef char16_t UChar; // C++ 29 + - #else 30 + - typedef uint16_t UChar; // C 31 + - #endif 32 + -#elif defined(UCHAR_TYPE) 33 + - typedef UCHAR_TYPE UChar; 34 + -#elif U_CPLUSPLUS_VERSION != 0 35 + - typedef char16_t UChar; // C++ 36 + -#else 37 + - typedef uint16_t UChar; // C 38 + -#endif 39 + - 40 + -#else 41 + - 42 + #if 1 43 + // #if 1 is normal. UChar defaults to char16_t in C++. 44 + // For configuration testing of UChar=uint16_t temporarily change this to #if 0. 45 + @@ -441,8 +408,6 @@ 46 + typedef uint16_t UChar; // C 47 + #endif 48 + 49 + -#endif // APPLE_ICU_CHANGES 50 + - 51 + /** 52 + * \var OldUChar 53 + * Default ICU 58 definition of UChar.
+54
pkgs/os-specific/darwin/apple-source-releases/ICU/patches/enable-cxx-api-by-default.patch
···
··· 1 + diff --git a/icu/icu4c/source/common/unicode/utypes.h b/icu/icu4c/source/common/unicode/utypes.h 2 + index a3e0ec911c..e361c658ef 100644 3 + --- a/common/unicode/utypes.h 4 + +++ b/common/unicode/utypes.h 5 + @@ -66,20 +66,6 @@ 6 + * \def U_SHOW_CPLUSPLUS_API 7 + * @internal 8 + */ 9 + -#if APPLE_ICU_CHANGES 10 + -// rdar://60884991 #58 Replace installsrc patching with changes directly in header files 11 + -// Apple modifies the default to be 0, not 1 12 + -#ifdef __cplusplus 13 + -# ifndef U_SHOW_CPLUSPLUS_API 14 + -# define U_SHOW_CPLUSPLUS_API 0 15 + -# endif 16 + -#else 17 + -# undef U_SHOW_CPLUSPLUS_API 18 + -# define U_SHOW_CPLUSPLUS_API 0 19 + -#endif 20 + - 21 + -#else 22 + - 23 + #ifdef __cplusplus 24 + # ifndef U_SHOW_CPLUSPLUS_API 25 + # define U_SHOW_CPLUSPLUS_API 1 26 + @@ -89,28 +75,6 @@ 27 + # define U_SHOW_CPLUSPLUS_API 0 28 + #endif 29 + 30 + -#endif // APPLE_ICU_CHANGES 31 + - 32 + - 33 + -#if APPLE_ICU_CHANGES 34 + -// rdar://30624081 64b8ed9b89.. Add #if U_SHOW_CPLUSPLUS_API..#endif around C++ interfaces that don’t have it 35 + -// rdar://24075048 0f5f76d43c.. update ICU for AAS to use VS2015, remove old ICU 4.0 shims, fix build issues 36 + -/* 37 + - * Apple-specific warning if U_SHOW_CPLUSPLUS_API set and the compile 38 + - * is not for a build of ICU itself (ICU_DATA_DIR is always defined 39 + - * for ICU builds, and is unlikely to be defined for client builds). 40 + - * Windows VSC compliler does not like #warning, skip for it. 41 + - */ 42 + -#if U_SHOW_CPLUSPLUS_API 43 + -#ifndef ICU_DATA_DIR 44 + -#if U_PLATFORM!=U_PF_WINDOWS 45 + -#warning Do not set U_SHOW_CPLUSPLUS_API for code that ships with the OS, it is only for local tools. 46 + -#warning ICU C++ functionality may not be used by any OS client, it is not binary compatible across updates. 47 + -#endif 48 + -#endif 49 + -#endif 50 + -#endif // APPLE_ICU_CHANGES 51 + - 52 + /** @{ API visibility control */ 53 + 54 + /**
+6 -1
pkgs/top-level/all-packages.nix
··· 9376 icu76 9377 ; 9378 9379 - icu = icu74; 9380 9381 idasen = with python3Packages; toPythonApplication idasen; 9382
··· 9376 icu76 9377 ; 9378 9379 + # Use Apple’s fork of ICU by default, which provides additional APIs that are not present in upstream ICU. 9380 + # 9381 + # `icuReal` is provided in case the upstream icu package is needed on Darwin instead of the fork. 9382 + # Note that the versioned icu packages always correspond to the upstream versions. 9383 + icuReal = icu74; 9384 + icu = if stdenv.hostPlatform.isDarwin then darwin.ICU else icuReal; 9385 9386 idasen = with python3Packages; toPythonApplication idasen; 9387