From 3b4e8fd9fa960fccc3c824da0bda8e2d7a017bf4 Mon Sep 17 00:00:00 2001 From: thepyper Date: Wed, 8 Aug 2018 16:02:20 +0200 Subject: [PATCH 1/2] 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) { From 6f1a2f6b71534538641e7ebc1ee676038808fa6d Mon Sep 17 00:00:00 2001 From: thepyper Date: Thu, 9 Aug 2018 09:00:16 +0200 Subject: [PATCH 2/2] Fixed build on non-musl systems --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 03e1f9a2..cf9720b3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,7 +43,7 @@ if(UNIX) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_definitions(-DUNIX_LINUX) - if($ENV{USE_MUSL} STREQUAL "YES") + if("$ENV{USE_MUSL}" STREQUAL "YES") add_definitions(-DUNIX_LINUX_MUSL) endif() endif()