Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 11a5971

Browse files
Peter Jasjanvorli
authored andcommitted
Link libintl in case of Alpine (#5731)
This delta detects Alpine Linux by using `uname -v` (kernel version) and add the `libintl` in the linker list. This is because `gettext` is not part of (per-installed in) Alpine Linux but available via the package manager. To build CoreCLR, `gettext-dev` is one unlisted per-requisite.
1 parent 7f7d827 commit 11a5971

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/pal/src/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 2.8.12.2)
22

33
include_directories(SYSTEM /usr/local/include)
44

5+
# set kernel version to detect Alpine
6+
EXEC_PROGRAM(uname ARGS -v OUTPUT_VARIABLE CMAKE_SYSTEM_KERNEL_VERSION)
7+
string(FIND "${CMAKE_SYSTEM_KERNEL_VERSION}" "Alpine" PAL_SYSTEM_ALPINE)
8+
if(PAL_SYSTEM_ALPINE EQUAL -1)
9+
unset(PAL_SYSTEM_ALPINE)
10+
endif()
11+
512
include(configure.cmake)
613

714
project(coreclrpal)
@@ -245,6 +252,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
245252
find_library(UNWIND_ARCH NAMES unwind-x86_64)
246253
endif()
247254

255+
if(PAL_SYSTEM_ALPINE)
256+
find_library(INTL intl)
257+
endif()
258+
248259
find_library(UNWIND NAMES unwind)
249260
find_library(UNWIND_GENERIC NAMES unwind-generic)
250261

@@ -270,6 +281,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
270281
target_link_libraries(coreclrpal ${UNWIND_ARCH})
271282
endif(NOT UNWIND_ARCH STREQUAL UNWIND_ARCH-NOTFOUND)
272283

284+
if(NOT INTL STREQUAL INTL-NOTFOUND)
285+
target_link_libraries(coreclrpal ${INTL})
286+
endif(NOT INTL STREQUAL INTL-NOTFOUND)
287+
273288
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
274289

275290
if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)

0 commit comments

Comments
 (0)