Files
MINGW-packages/mingw-w64-libxml2/0031-apply-msvc-relocation.patch
Christoph Reiter 4b5373a3b5 libxml: fix dll name for relocation
the preprocessor only replaces identifiers

We could stringify here, but lets keep it simply and just hardcode the name.
2022-10-01 09:05:21 +02:00

40 lines
1.1 KiB
Diff

--- a/catalog.c
+++ b/catalog.c
@@ -74,7 +74,7 @@
#define XML_SGML_DEFAULT_CATALOG "file://" SYSCONFDIR "/sgml/catalog"
#endif
-#if defined(_WIN32) && defined(_MSC_VER)
+#if defined(_WIN32)
#undef XML_XML_DEFAULT_CATALOG
static char XML_XML_DEFAULT_CATALOG[256] = "file://" SYSCONFDIR "/xml/catalog";
#if !defined(_WINDOWS_)
@@ -3117,10 +3117,14 @@
catalogs = (const char *) getenv("XML_CATALOG_FILES");
if (catalogs == NULL)
-#if defined(_WIN32) && defined(_MSC_VER)
+#if defined(_WIN32)
{
void* hmodule;
+#ifdef _MSC_VER
hmodule = GetModuleHandleA("libxml2.dll");
+#else
+ hmodule = GetModuleHandleA("libxml2-2.dll");
+#endif
if (hmodule == NULL)
hmodule = GetModuleHandleA(NULL);
if (hmodule != NULL) {
@@ -3136,7 +3136,11 @@
p--;
if (p != buf) {
xmlChar* uri;
+#ifdef _MSC_VER
strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf));
+#else
+ strncpy(p, "\\..\\etc\\xml\\catalog", 255 - (p - buf));
+#endif
uri = xmlCanonicPath((const xmlChar*)buf);
if (uri != NULL) {
strncpy(XML_XML_DEFAULT_CATALOG, uri, 255);