Skip to content

Commit c75f17d

Browse files
jcfrcertik
andcommitted
Support building on Alpine Linux. See #22
Co-authored-by: Ondřej Čertík <[email protected]>
1 parent f5c5ce4 commit c75f17d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,14 @@ if(BUILD_FROM_SOURCE)
111111
# Build from source
112112
#-----------------------------------------------------------------------------
113113
set(ninja_executable ${Ninja_SOURCE_DIR}/ninja${CMAKE_EXECUTABLE_SUFFIX})
114+
115+
set(bootstrap_command ${PYTHON_EXECUTABLE} configure.py --bootstrap)
116+
# Explicitly defining _BSD_SOURCE is required to support building the wheel on Alpine. See issue #22
117+
if(UNIX AND NOT APPLE)
118+
set(bootstrap_command -E env ${CMAKE_COMMAND} CXXFLAGS=-D_BSD_SOURCE ${bootstrap_command})
119+
endif()
114120
add_custom_command(
115-
COMMAND ${PYTHON_EXECUTABLE} configure.py --bootstrap
121+
COMMAND ${bootstrap_command}
116122
OUTPUT ${ninja_executable}
117123
WORKING_DIRECTORY ${Ninja_SOURCE_DIR}
118124
)

0 commit comments

Comments
 (0)