Skip to content

Commit

Permalink
uv: enable build on z/OS
Browse files Browse the repository at this point in the history
Enable libuv to build on z/OS, by fixing the file status timestamp fields, and correcting the configurations. The GYP changes allows libuv to be built as a part of Node.js. The CMake changes enable libuv to be built standalone, and makes it possible to run the unit tests. The required header file `csrsic.h` can be found in zoslib, which can be specified using the `-DZOSLIB_DIR` option.

PR-URL: #7
  • Loading branch information
zsw007 authored May 1, 2020
1 parent 26792fb commit 57a8181
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
8 changes: 7 additions & 1 deletion deps/uv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
list(APPEND uv_defines PATH_MAX=255)
list(APPEND uv_defines PATH_MAX=1024)
list(APPEND uv_defines _AE_BIMODAL)
list(APPEND uv_defines _ALL_SOURCE)
list(APPEND uv_defines _ISOC99_SOURCE)
Expand Down Expand Up @@ -285,6 +285,9 @@ target_include_directories(uv
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
target_include_directories(uv PUBLIC $<BUILD_INTERFACE:${ZOSLIB_DIR}/include>)
endif()
target_link_libraries(uv ${uv_libraries})

add_library(uv_a STATIC ${uv_sources})
Expand All @@ -296,6 +299,9 @@ target_include_directories(uv_a
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
target_include_directories(uv_a PUBLIC $<BUILD_INTERFACE:${ZOSLIB_DIR}/include>)
endif()
target_link_libraries(uv_a ${uv_libraries})

if(LIBUV_BUILD_TESTS)
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
'cflags': [ '-g' ],
'cflags': [ '-g', '-O0' ],
'msvs_settings': {
'VCCLCompilerTool': {
'target_conditions': [
Expand All @@ -35,7 +35,7 @@
},
'conditions': [
['OS != "zos"', {
'cflags': [ '-O0', '-fno-common', '-fwrapv' ]
'cflags': [ '-fno-common', '-fwrapv' ]
}],
['OS == "android"', {
'cflags': [ '-fPIE' ],
Expand Down
3 changes: 2 additions & 1 deletion deps/uv/src/unix/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,8 @@ static void uv__to_stat(struct stat* src, uv_stat_t* dst) {
dst->st_birthtim.tv_nsec = src->st_ctimensec;
dst->st_flags = 0;
dst->st_gen = 0;
#elif !defined(_AIX) && ( \
#elif !defined(_AIX) && \
!defined(__MVS__) && ( \
defined(__DragonFly__) || \
defined(__FreeBSD__) || \
defined(__OpenBSD__) || \
Expand Down
3 changes: 2 additions & 1 deletion deps/uv/test/test-fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,8 @@ TEST_IMPL(fs_fstat) {
ASSERT(s->st_mtim.tv_nsec == t.st_mtimespec.tv_nsec);
ASSERT(s->st_ctim.tv_sec == t.st_ctimespec.tv_sec);
ASSERT(s->st_ctim.tv_nsec == t.st_ctimespec.tv_nsec);
#elif defined(_AIX)
#elif defined(_AIX) || \
defined(__MVS__)
ASSERT(s->st_atim.tv_sec == t.st_atime);
ASSERT(s->st_atim.tv_nsec == 0);
ASSERT(s->st_mtim.tv_sec == t.st_mtime);
Expand Down
7 changes: 6 additions & 1 deletion deps/uv/uv.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,12 @@
'src/unix/pthread-fixes.c',
'src/unix/os390.c',
'src/unix/os390-syscalls.c'
]
],
'cflags': [
'-qenum=int',
'-qexportall',
'-qascii',
],
}],
]
},
Expand Down

0 comments on commit 57a8181

Please sign in to comment.