Skip to content

Commit

Permalink
Fix build errors on MSYS platform
Browse files Browse the repository at this point in the history
  • Loading branch information
carlzhc committed Apr 9, 2024
1 parent 5b132a2 commit e28a2c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
string (REPLACE ";" " " LIBBSD_FLAGS "${BSD_CFLAGS}")
target_link_libraries (mg ${BSD_LIBRARIES})
set (CMAKE_C_FLAGS "-Wall -DREGEX -D_GNU_SOURCE ${LIBBSD_FLAGS} ${NCURSES_FLAGS} -L${NCURSES_LIBRARY_DIRS}")
elseif(CMAKE_SYSTEM_NAME MATCHES "MSYS")
pkg_check_modules (BSD REQUIRED libbsd-overlay)
link_directories (${BSD_LIBRARY_DIRS})
string (REPLACE ";" " " LIBBSD_FLAGS "${BSD_CFLAGS}")
target_link_libraries (mg ${BSD_LIBRARIES})
set (CMAKE_C_FLAGS "-Wall -DREGEX -isystem /usr/include -D_GNU_SOURCE ${LIBBSD_FLAGS} ${NCURSES_FLAGS}")
else()
set (CMAKE_C_FLAGS "-Wall -DREGEX ${LIBBSD_FLAGS} ${NCURSES_FLAGS} -L${NCURSES_LIBRARY_DIRS}")
endif()
3 changes: 3 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ endif

ifdef STATIC
LDFLAGS=-static -static-libgcc
ifneq ($(MSYSTEM),)
CURSES_LIBS:= $(CURSES_LIBS).dll
endif
endif

CC?= gcc
Expand Down
3 changes: 3 additions & 0 deletions ttyio.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <sys/queue.h>
#include <sys/time.h>
#include <sys/types.h>
#if defined(__MSYS__)
#include <sys/socket.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
Expand Down

0 comments on commit e28a2c0

Please sign in to comment.