Discussion:
Building on MingW
Gisle Vanem
2013-12-03 13:20:56 UTC
Permalink
Hello list.

Trying to build the latest version with MingW showed some problems.
sleep() is in LYUtils.c, but inside a '!defined(__MINGW32__)'
section. My MingW doesn't have that function. But it do have _sleep()
marked as '__attribute__ ((__deprecated__))' in <stdlib.h>. Thus:

--- orig/src/LYUtils.c 2013-11-29 00:52:56 +0000
+++ src/LYUtils.c 2013-12-02 20:58:16 +0000
@@ -4583,7 +4583,6 @@
return FALSE;
}

-#if !defined(__MINGW32__)
void sleep(unsigned sec)
{
unsigned int i, j;
@@ -4598,7 +4597,6 @@
}
}
}
-#endif /* !__MINGW32__ */
#endif /* _WINDOWS */

-------------------

Or I can do 'CFLAGS += -Dsleep=_sleep -Wno-deprecated-declarations'.

Then there's an issue with 'USE_ALT_BINDINGS'. I don't use it (what's it for?).
Thus I needed this:

--- orig/src/LYEditmap.c 2013-11-29 00:52:56 +0000
+++ src/LYEditmap.c 2013-12-02 20:49:20 +0000
@@ -1750,9 +1750,11 @@
LYEditorNames[j] = LYLineEditors[j].name;
initLineEditor(&LYLineEditors[j]);
}
+#ifdef USE_ALT_BINDINGS
for (j = 0; j < TABLESIZE(LYModifierBindings); ++j) {
initLineEditor(&LYModifierBindings[j]);
}
+#endif
}

-------------------

Then the most difficult line was in LYCurses.c (line 1756):
bb = getbkgd(stdscr);

which expands to here:
bb = ((SLcurses_Stdscr)->_bkgd)

This doesn't work in my SLang 2.2.x since it has no '_bkgd' in
'SLcurses_Window_Type'. w/o knowing if this is correct, but patching
this like:

--- orig/src/LYCurses.c 2013-11-29 00:52:56 +0000
+++ src/LYCurses.c 2013-12-02 20:48:09 +0000
@@ -1749,7 +1749,7 @@
#endif /* __DJGPP__ */

/* ifdef's for non-Unix curses or slang */
-#if defined(__MINGW32__)
+#if !defined(USE_SLANG)
{
chtype bb;

@@ -1763,7 +1763,7 @@
endwin();
#endif /* PDCURSES */

-#elif defined(DOSPATH) && !(defined(USE_SLANG) || defined(_WIN_CC))
+#elif defined(DOSPATH) && !defined(_WIN_CC)

#if defined(PDCURSES)
endwin();

--------------------

everything seems to work fine. I have no idea why MingW is treated specially in that
section. What about MSVC + SLang?

--gv

Loading...