Skip to content

Commit

Permalink
Merge pull request swiftlang#713 from dcci/stdlib
Browse files Browse the repository at this point in the history
[stdlib] Initial FreeBSD port.
  • Loading branch information
gribozavr committed Dec 25, 2015
2 parents 569a80c + 8f301b6 commit a954ebe
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif()
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
add_subdirectory(Glibc)
endif()
5 changes: 5 additions & 0 deletions stdlib/public/Glibc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ if (NOT EXISTS "${GLIBC_ARCH_INCLUDE_PATH}/sys")
endif()

# Generate module.map
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
configure_file(module.map.in "${CMAKE_CURRENT_BINARY_DIR}/module.map" @ONLY)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
configure_file(module.freebsd.map.in "${CMAKE_CURRENT_BINARY_DIR}/module.map" @ONLY)
endif()

add_custom_command_target(unused_var
COMMAND
Expand Down
8 changes: 8 additions & 0 deletions stdlib/public/Glibc/Glibc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,18 @@

public var errno: Int32 {
get {
#if os(FreeBSD)
return __error().memory
#else
return __errno_location().memory
#endif
}
set(val) {
#if os(FreeBSD)
return __error().memory = val
#else
return __errno_location().memory = val
#endif
}
}

Expand Down
Loading

0 comments on commit a954ebe

Please sign in to comment.