File required-freetype.patch of Package java-1_6_0-openjdk

--- openjdk/jdk/make/tools/freetypecheck/freetypecheck.c	2020-04-16 10:48:18.975845246 +0200
+++ openjdk/jdk/make/tools/freetypecheck/freetypecheck.c	2020-04-16 10:49:11.779846289 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,32 +26,113 @@
 /* Test program for freetype sanity check.
    Prints "Failed" messages to STDOUT if check fails. */
 
+#include <stdio.h>
+#include <string.h>
+
 #include "ft2build.h"
 #include FT_FREETYPE_H
 
+#ifdef _MSC_VER
+#if _MSC_VER > 1400 && _MSC_VER < 1600
+
+/*
+ * When building for Microsoft Windows, your program has a dependency
+ * on msvcr??.dll.
+ *
+ * When using Visual Studio 2005 or later, that must be recorded in
+ * the <program>.exe.manifest file.
+ *
+ * Reference:
+ *     C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h
+ */
+#include <crtassem.h>
+#ifdef _M_IX86
+
+#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
+        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
+        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
+        "processorArchitecture='x86' "                                  \
+        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
+
+#endif /* _M_IX86 */
+
+//This may not be necessary yet for the Windows 64-bit build, but it
+//will be when that build environment is updated.  Need to test to see
+//if it is harmless:
+#ifdef _M_AMD64
+
+#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
+        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
+        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
+        "processorArchitecture='amd64' "                                \
+        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
+
+#endif  /* _M_AMD64 */
+#endif  /* _MSC_VER > 1400 && _MSC_VER < 1600 */
+#endif  /* _MSC_VER */
+
 #define QUOTEMACRO(x) QUOTEME(x)
 #define QUOTEME(x) #x
 
+int compare_versions(FT_Int req_major, FT_Int req_minor, FT_Int req_patch,
+                     FT_Int major, FT_Int minor, FT_Int patch) {
+    if (major > req_major) {
+        printf("Major version %d greater than required major version %d\n",
+               major, req_major);
+        return 0;
+    }
+    if (major < req_major) {
+        printf("Major version %d less than required major version %d\n",
+               major, req_major);
+        return -1;
+    }
+    printf("Major version %d equal to required major version %d\n",
+           major, req_major);
+    if (minor > req_minor) {
+        printf("Minor version %d greater than required minor version %d\n",
+               minor, req_minor);
+        return 0;
+    }
+    if (minor < req_minor) {
+        printf("Minor version %d less than required minor version %d\n",
+               minor, req_minor);
+        return -2;
+    }
+    printf("Minor version %d equal to required minor version %d\n",
+           minor, req_minor);
+    if (patch >= req_patch) {
+        printf("Patch version %d greater than or equal to required patch version %d\n",
+               patch, req_patch);
+        return 0;
+    }
+    printf("Patch version %d less than required patch version %d\n",
+           patch, req_patch);
+    return -3;
+}
+
 int main(int argc, char** argv) {
-   char v[50];
-   FT_Int major, minor, patch;
+   FT_Int major, minor, patch, req_major, req_minor, req_patch;
    FT_Library library;
-   sprintf(v, "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
-
-   printf("Required version of freetype: %s\n",
-       QUOTEMACRO(REQUIRED_FREETYPE_VERSION));
 
-   printf("Detected freetype headers: %s\n", v);
-   if (strcmp(v, QUOTEMACRO(REQUIRED_FREETYPE_VERSION)) < 0) {
+   sscanf(QUOTEMACRO(REQUIRED_FREETYPE_VERSION),
+          "%d.%d.%d", &req_major, &req_minor, &req_patch);
+   printf("Required version of freetype: %d.%d.%d\n",
+          req_major, req_minor, req_patch);
+
+   printf("Detected freetype headers: %d.%d.%d\n",
+          FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
+   if (compare_versions(req_major, req_minor, req_patch,
+                        FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH) < 0) {
        printf("Failed: headers are too old.\n");
    }
 
    FT_Init_FreeType(&library);
    FT_Library_Version(library, &major, &minor, &patch);
-   sprintf(v, "%d.%d.%d", major, minor, patch);
 
-   printf("Detected freetype library: %s\n", v);
-   if (strcmp(v, QUOTEMACRO(REQUIRED_FREETYPE_VERSION)) < 0) {
+   printf("Detected freetype library: %d.%d.%d\n",
+          major, minor, patch);
+   if (compare_versions(req_major, req_minor, req_patch,
+                        major, minor, patch) < 0) {
       printf("Failed: too old library.\n");
    }
openSUSE Build Service is sponsored by