Skip to content

Commit a954ebe

Browse files
committed
Merge pull request #713 from dcci/stdlib
[stdlib] Initial FreeBSD port.
2 parents 569a80c + 8f301b6 commit a954ebe

File tree

4 files changed

+378
-1
lines changed

4 files changed

+378
-1
lines changed

stdlib/public/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2727
endif()
2828
endif()
2929

30-
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
30+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
3131
add_subdirectory(Glibc)
3232
endif()

stdlib/public/Glibc/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ if (NOT EXISTS "${GLIBC_ARCH_INCLUDE_PATH}/sys")
1717
endif()
1818

1919
# Generate module.map
20+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
2021
configure_file(module.map.in "${CMAKE_CURRENT_BINARY_DIR}/module.map" @ONLY)
22+
endif()
23+
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
24+
configure_file(module.freebsd.map.in "${CMAKE_CURRENT_BINARY_DIR}/module.map" @ONLY)
25+
endif()
2126

2227
add_custom_command_target(unused_var
2328
COMMAND

stdlib/public/Glibc/Glibc.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@
1818

1919
public var errno: Int32 {
2020
get {
21+
#if os(FreeBSD)
22+
return __error().memory
23+
#else
2124
return __errno_location().memory
25+
#endif
2226
}
2327
set(val) {
28+
#if os(FreeBSD)
29+
return __error().memory = val
30+
#else
2431
return __errno_location().memory = val
32+
#endif
2533
}
2634
}
2735

0 commit comments

Comments
 (0)