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 29e6a4f
Show file tree
Hide file tree
Showing 4 changed files with 16 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 -DHAVE_PTY_H ${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
4 changes: 4 additions & 0 deletions def.h
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,10 @@ extern int tcinsl;
extern int tcdell;
extern int rptcount; /* successive invocation count */

long long strtonum(const char *nptr, long long minval, long long maxval,
const char **errstr);


/* https://github.com/hboetes/mg/issues/7#issuecomment-475869095 */
#if defined(__APPLE__) || defined(__NetBSD__)
#define st_atim st_atimespec
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 29e6a4f

Please sign in to comment.