Select libraries using the ICU build time version (#79259)
authorws77.cho <ws77.cho@samsung.com>
Sun, 11 Dec 2022 23:54:30 +0000 (08:54 +0900)
committerGitHub <noreply@github.com>
Sun, 11 Dec 2022 23:54:30 +0000 (15:54 -0800)
src/native/libs/System.Globalization.Native/pal_icushim.c

index c5c3ccbcf293e453ba01d32d04a728571dcdb141..a9388786e79460b50af7efc786958c1d23d2a82d 100644 (file)
@@ -294,18 +294,28 @@ static int FindLibUsingOverride(const char* versionPrefix, char* symbolName, cha
     char* versionOverride = getenv("CLR_ICU_VERSION_OVERRIDE");
     if (versionOverride != NULL)
     {
-        int first = -1;
-        int second = -1;
-        int third = -1;
-
-        int matches = sscanf(versionOverride, "%d.%d.%d", &first, &second, &third);
-        if (matches > 0)
+        if (strcmp(versionOverride, "build") == 0)
         {
-            if (OpenICULibraries(first, second, third, versionPrefix, symbolName, symbolVersion))
+            if (OpenICULibraries(U_ICU_VERSION_MAJOR_NUM, -1, -1, versionPrefix, symbolName, symbolVersion))
             {
                 return true;
             }
         }
+        else
+        {
+            int first = -1;
+            int second = -1;
+            int third = -1;
+
+            int matches = sscanf(versionOverride, "%d.%d.%d", &first, &second, &third);
+            if (matches > 0)
+            {
+                if (OpenICULibraries(first, second, third, versionPrefix, symbolName, symbolVersion))
+                {
+                    return true;
+                }
+            }
+        }
     }
 
     return false;