Skip to content

Commit 65c1bd6

Browse files
Merge pull request #131 from rashil2000/build-fixes
Reset TERM variable on Windows
2 parents eb2fd2a + 867da9c commit 65c1bd6

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ cscope.in.out
2525
cscope.po.out
2626
cscope.files
2727
cmatrix
28+
cmatrix.exe
2829
*.o
2930
*.core
3031
CMakeCache.txt

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ effect, you must specify `-s` on the command line. For usage info, use `cmatrix
1212
[![Build Status](https://travis-ci.org/abishekvashok/cmatrix.svg?branch=master)](https://travis-ci.org/abishekvashok/cmatrix)
1313

1414
### Dependencies
15-
You'll probably need a decent ncurses library (or PDCurses on native Windows) to get this to work.
15+
You'll probably need a decent ncurses library to get this to work. On Windows, using mingw-w64-ncurses is recommended (PDCurses will also work, but it does not support colors or bold text).
1616

1717
### Building and installing cmatrix
1818
To install cmatrix, use either of the following methods from within the cmatrix directory.
1919

20-
#### Using `configure` (recommended for most linux user)
21-
```
20+
#### Using `configure` (recommended for most linux/mingw users)
21+
```shell
2222
autoreconf -i # skip if using released tarball
2323
./configure
2424
make
@@ -27,8 +27,8 @@ make install
2727

2828
#### Using CMake
2929
Here we also show an out-of-source build in the sub directory "build".
30-
Don't use CMake if you want to use PDCurses, it won't work (for now).
31-
```
30+
(Doesn't work on Windows, for now).
31+
```shell
3232
mkdir -p build
3333
cd build
3434
# to install to "/usr/local"

cmatrix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@
4848
#ifdef HAVE_NCURSES_H
4949
#include <ncurses.h>
5050
#else
51+
#ifdef _WIN32
52+
#include <ncurses/curses.h>
53+
#else
5154
#include <curses.h>
5255
#endif
56+
#endif
5357

5458
#ifdef HAVE_SYS_IOCTL_H
5559
#include <sys/ioctl.h>
@@ -421,6 +425,11 @@ int main(int argc, char *argv[]) {
421425
}
422426
}
423427

428+
/* Clear TERM variable on Windows */
429+
#ifdef _WIN32
430+
_putenv_s("TERM", "");
431+
#endif
432+
424433
if (force && strcmp("linux", getenv("TERM"))) {
425434
#ifdef _WIN32
426435
SetEnvironmentVariableW(L"TERM", L"linux");

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ if test "$ac_cv_prog_CC" = gcc -o "$ac_cv_prog_CC" = g++; then
7878
CFLAGS="$CFLAGS -Wall -Wno-comment"
7979
fi
8080

81+
dnl Build static executable on native Windows
82+
if test x$native_windows != xno; then
83+
CFLAGS="$CFLAGS -static"
84+
fi
85+
8186
dnl cmatrix terminal font disable option (default enabled)
8287
AC_ARG_WITH([fonts],
8388
AS_HELP_STRING([--without-fonts], [Install cmatrix without cmatrix font]),

0 commit comments

Comments
 (0)