From 3b4e8fd9fa960fccc3c824da0bda8e2d7a017bf4 Mon Sep 17 00:00:00 2001 From: thepyper Date: Wed, 8 Aug 2018 16:02:20 +0200 Subject: [PATCH] musl support Internat.c: fix iconv() with musl by removing unrecognized EUCJP encoding src/CMakeFiles.txt: recognize USE_MUSL=YES environment variable to compile with musl --- src/CMakeLists.txt | 3 +++ src/Mayaqua/Internat.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 449256d0..03e1f9a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,6 +43,9 @@ if(UNIX) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_definitions(-DUNIX_LINUX) + if($ENV{USE_MUSL} STREQUAL "YES") + add_definitions(-DUNIX_LINUX_MUSL) + endif() endif() if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") diff --git a/src/Mayaqua/Internat.c b/src/Mayaqua/Internat.c index 71f476f4..98f96100 100644 --- a/src/Mayaqua/Internat.c +++ b/src/Mayaqua/Internat.c @@ -789,11 +789,11 @@ void InitInternational() d = IconvWideToStrInternal(); if (d == (void *)-1) { -#ifdef UNIX_MACOS +#if defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) StrCpy(charset, sizeof(charset), "utf-8"); -#else // UNIX_MACOS +#else // defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) StrCpy(charset, sizeof(charset), "EUCJP"); -#endif // UNIX_MACOS +#endif // defined (UNIX_MACOS) || defined (UNIX_LINUX_MUSL) d = IconvWideToStrInternal(); if (d == (void *)-1) {