Skip to content

Commit

Permalink
MSVC: Enable building ocspcheck.
Browse files Browse the repository at this point in the history
- Add `STDIN_FILENO` to compat unistd header.
- Use quotes to include compat getopt header in the compat unistd.
- Export additional symbols needed by ocspcheck (optarg, optind,
  ftruncate)
  • Loading branch information
FtZPetruska authored and busterb committed Oct 29, 2023
1 parent 8048941 commit c4bb6b7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions apps/ocspcheck/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
if(NOT MSVC)

set(
OCSPCHECK_SRC
http.c
Expand Down Expand Up @@ -33,5 +31,3 @@ if(ENABLE_LIBRESSL_INSTALL)
install(FILES ocspcheck.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)

endif(ENABLE_LIBRESSL_INSTALL)

endif()
2 changes: 2 additions & 0 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ endif()
if(NOT HAVE_GETOPT)
set(CRYPTO_SRC ${CRYPTO_SRC} compat/getopt_long.c)
set(EXTRA_EXPORT ${EXTRA_EXPORT} getopt)
set(EXTRA_EXPORT ${EXTRA_EXPORT} optarg)
set(EXTRA_EXPORT ${EXTRA_EXPORT} optind)
endif()

if(NOT HAVE_GETPAGESIZE)
Expand Down
3 changes: 2 additions & 1 deletion include/compat/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset);
#include <io.h>
#include <process.h>

#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2

Expand Down Expand Up @@ -65,7 +66,7 @@ int getentropy(void *buf, size_t buflen);
#endif

#ifndef HAVE_GETOPT
#include <getopt.h>
#include "getopt.h"
#endif

#ifndef HAVE_GETPAGESIZE
Expand Down
2 changes: 2 additions & 0 deletions tls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ if(WIN32)
compat/pread.c
compat/pwrite.c
)

set(LIBTLS_EXTRA_EXPORT ${LIBTLS_EXTRA_EXPORT} ftruncate)
endif()

if(NOT "${OPENSSLDIR}" STREQUAL "")
Expand Down

0 comments on commit c4bb6b7

Please sign in to comment.