diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2025-08-08 08:03:17 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-08 08:03:17 +0300 |
| commit | 887a8e91398c88daea64b95ed66308541be7f2ff (patch) | |
| tree | 53ff8cfcec8438c0af2764523aefb4a6222846ec | |
| parent | 3fd08c4049620930c282237707b9d3b497989020 (diff) | |
| parent | 822575c6b15777da7c279596aa76ae9e8f392d73 (diff) | |
| download | accel-ppp-887a8e91398c88daea64b95ed66308541be7f2ff.tar.gz accel-ppp-887a8e91398c88daea64b95ed66308541be7f2ff.zip | |
Merge pull request #252 from nuclearcat/fix-musl-linking
feat(build): Add MUSL detection and conditional linking
| -rw-r--r-- | CMakeLists.txt | 15 | ||||
| -rw-r--r-- | accel-pppd/ctrl/pppoe/CMakeLists.txt | 7 |
2 files changed, 21 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b606898a..9a3ff73b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,21 @@ IF (NOT DEFINED LIB_SUFFIX) ENDIF (ARCH STREQUAL x86_64) ENDIF (NOT DEFINED LIB_SUFFIX) +# Set flag if we are building with MUSL +IF (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_C_COMPILER_ID STREQUAL GNU) + execute_process( + COMMAND sh -c "ldd --version 2>&1 || true" + OUTPUT_VARIABLE LDD_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if (LDD_VERSION MATCHES "[Mm]usl") + set(MUSL ON) + else () + set(MUSL OFF) + endif () + message(STATUS "Building with MUSL: ${MUSL}") +ENDIF (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_C_COMPILER_ID STREQUAL GNU) + #color console example message(FATAL_ERROR "${Esc}[31m Red Text ${Esc}[m Restore Normal Text") string(ASCII 27 Esc) diff --git a/accel-pppd/ctrl/pppoe/CMakeLists.txt b/accel-pppd/ctrl/pppoe/CMakeLists.txt index fd4f9a36..b6f4a98f 100644 --- a/accel-pppd/ctrl/pppoe/CMakeLists.txt +++ b/accel-pppd/ctrl/pppoe/CMakeLists.txt @@ -13,7 +13,12 @@ SET(sources ${sources} tr101.c) ENDIF(RADIUS) ADD_LIBRARY(pppoe SHARED ${sources}) -TARGET_LINK_LIBRARIES(pppoe vlan-mon connlimit) +# if MUSL is set then we need to link with the connlimit library +IF (MUSL) + TARGET_LINK_LIBRARIES(pppoe vlan-mon connlimit) +ELSE (MUSL) + TARGET_LINK_LIBRARIES(pppoe vlan-mon) +ENDIF (MUSL) set_property(TARGET pppoe PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set_property(TARGET pppoe PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) |
