diff --git a/Makefile b/Makefile index 72fb878..5ac826c 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,7 @@ $(LIBUNISTRING_DIR)/lib/.libs/libunistring.a: vendor/libunistring-$(LIBUNISTRING cd $(LIBUNISTRING_DIR) ; ./configure --enable-static ; $(MAKE) vendor/libncurses-$(LIBNCURSES_VERSION).tar.gz: | vendor - curl -L http://invisible-mirror.net/archives/ncurses/ncurses-$(LIBNCURSES_VERSION).tar.gz --output $@ + curl -L https://invisible-mirror.net/archives/ncurses/ncurses-$(LIBNCURSES_VERSION).tar.gz --output $@ $(LIBNCURSES_DIR)/lib/libncurses.a: vendor/libncurses-$(LIBNCURSES_VERSION).tar.gz tar -C vendor -xzf vendor/libncurses-$(LIBNCURSES_VERSION).tar.gz diff --git a/src/Makefile b/src/Makefile index 8226b2c..7686418 100644 --- a/src/Makefile +++ b/src/Makefile @@ -72,7 +72,7 @@ boxes.static: $(ALL_OBJ) | check_dir if [ "$(STRIP)" = "true" ] ; then strip $(BOXES_EXECUTABLE_NAME) ; fi boxes.exe: $(ALL_OBJ) | check_dir - $(CC) $(LDFLAGS) $^ -o $@ -lkernel32 -l:libunistring.a -l:libpcre2-32.a -l:libiconv.a -l:libncurses.a + $(CC) $(LDFLAGS) $^ -o $@ -lkernel32 -l:libunistring.a -l:libpcre2-32.a -l:libiconv.a if [ "$(STRIP)" = "true" ] ; then strip $@ ; fi @@ -91,8 +91,8 @@ flags_static: echo $(filter-out boxes.o,$(ALL_OBJ)) > $(OUT_DIR)/modules.txt flags_win32: - $(eval CFLAGS := -Os -s -m32 -I. -I$(SRC_DIR) -I$(LIBNCURSES_WIN_INCLUDE) -Wall -W $(CFLAGS_ADDTL)) - $(eval LDFLAGS := $(LDFLAGS) -s -m32) + $(eval CFLAGS := -Os -s -m32 -I. -I$(SRC_DIR) -Wall -W $(CFLAGS_ADDTL)) + $(eval LDFLAGS := $(LDFLAGS) -s -m32 $(LDFLAGS_ADDTL)) $(eval BOXES_EXECUTABLE_NAME := boxes.exe) $(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o)) echo $(filter-out boxes.o,$(ALL_OBJ)) > $(OUT_DIR)/modules.txt diff --git a/src/boxes.c b/src/boxes.c index 3f9e423..999f6ac 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -15,7 +15,9 @@ #include "config.h" +#ifndef __MINGW32__ #include +#endif #include #include #include @@ -400,19 +402,30 @@ static void handle_remove_box() -/* These two functions are actually declared in term.h, but for some reason, that can't be included. */ -extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *, int, int *); -extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); +#ifndef __MINGW32__ + /* These two functions are actually declared in term.h, but for some reason, that can't be included. */ + extern NCURSES_EXPORT(int) setupterm(NCURSES_CONST char *, int, int *); + extern NCURSES_EXPORT(int) tigetnum(NCURSES_CONST char *); +#endif static int terminal_has_colors() { int result = 0; char *termtype = getenv("TERM"); - if (termtype != NULL && setupterm(termtype, STDOUT_FILENO, NULL) == OK && tigetnum("colors") >= 8) { - result = 1; - } + #ifdef __MINGW32__ + result = 1; /* On Windows, we always assume color capability. */ + UNUSED(termtype); + #else + if (termtype != NULL && setupterm(termtype, STDOUT_FILENO, NULL) == OK && tigetnum("colors") >= 8) { + result = 1; + } + #endif #if defined(DEBUG) - int num_colors = result ? tigetnum("colors") : 0; + #ifdef __MINGW32__ + int num_colors = 1; + #else + int num_colors = result ? tigetnum("colors") : 0; + #endif fprintf(stderr, "Terminal \"%s\" %s colors (number of colors = %d).\n", termtype != NULL ? termtype : "(null)", result ? "has" : "does NOT have", num_colors); #endif