[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev MINGW port of lynx (long) [PATCH]
From: |
Doug Kaufman |
Subject: |
lynx-dev MINGW port of lynx (long) [PATCH] |
Date: |
Sun, 7 Sep 2003 18:35:56 -0700 (PDT) |
I know that there has been mention of mingw ports of lynx over the
last few years, but I haven't heard of successful builds recently. I
have built mingw versions of lynx with SSL support using both PDCurses
and SLang. Neither one builds as smoothly as I would like, but I
thought I would submit my experience and a patch to the list. Perhaps
others can fix some of the problems that I either didn't get to or
can't do myself.
These were built on Win98SE in a Cygwin environment. I used the
"-mno-cygwin" option, rather than putting in a pure Mingw build
environment. The configure script gives three incorrect defines for
lynx_cfg.h. It defines "HAVE_SYS_IOCTL" and "HAVE_SYS_WAIT" when it
shouldn't and doesn't define "USE_FCNTL", when it should. I had to
correct these by hand after running configure.
The SLang version seems to work fine, but you can't do COLOR_STYLE
with SLang (or at least I couldn't design a patch for it to work). In
the PDCurses version, the arrow keys only work properly with NUMLOCK
off. I couldn't figure out how to fix this, but it seems to be a
PDCurses problem, since the same applies to the option screen of
"testcurs.exe" in the PDCurses distribution. See comments at the end of
this message.
I built with lynx2.8.5dev.16 with Tom's patches "a" and "b" applied,
PDCurses 2.6, SLang 1.4.9, OpenSSL 0.9.7c (development build from
August 15, 2003) and libz 1.1.4. I put these libraries in a separate
directory under cygwin, so as not to mess up my base cygwin files, so
the -I and -L are specific to my system. I haven't built without the
"-static" flag so I am not sure if it is really necessary or not. The
libgdi32 is only required for builds with OpenSSL. I have the pdcurses
library in my directory as "libcurses.a".
The configuration script to build the PDCurses version was:
#!/bin/sh
LDFLAGS="-static" \
LIBS="-L/mingw/lib -lwsock32 -lgdi32 -lmsvcrt" \
CFLAGS="-mno-cygwin -I/mingw/include -I/mingw/include/openssl -W -Wall -O2
-DALL_STATIC \
-D_WINDOWS -DSH_EX -DWIN_EX -DNOUSERS -DNOSIGHUP -DDOSPATH
-DUSE_ALT_BLAT_MAILER -DHAVE_CBREAK" \
./configure --prefix=/mingw/lynx2.8.5dev.16/lynx-conf \
--disable-dired-override \
--disable-full-paths \
--enable-addrlist-page \
--enable-change-exec \
--enable-charset-choice \
--enable-color-style \
--enable-default-colors \
--enable-exec-links \
--enable-externs \
--enable-file-upload \
--enable-gzip-help \
--enable-nested-tables \
--enable-prettysrc \
--enable-read-eta \
--enable-source-cache \
--enable-vertrace \
--libdir=/mingw/lynx2.8.5dev.16/lynx-conf \
--with-screen=curses \
--with-ssl \
--with-zlib
The configuration script to build the SLang version was:
#!/bin/sh
LDFLAGS="-static" \
LIBS="-L/mingw/lib -lwsock32 -lgdi32 -lmsvcrt" \
CFLAGS="-mno-cygwin -I/mingw/include -I/mingw/include/openssl -W -Wall -O2
-DALL_STATIC \
-D_WINDOWS -DSH_EX -DWIN_EX -DNOUSERS -DNOSIGHUP -DDOSPATH
-DUSE_ALT_BLAT_MAILER -DHAVE_CBREAK" \
./configure --prefix=/mingw/lynx2.8.5dev.16/lynx-slang-conf \
--disable-dired-override \
--disable-full-paths \
--enable-addrlist-page \
--enable-change-exec \
--enable-charset-choice \
--enable-default-colors \
--enable-exec-links \
--enable-externs \
--enable-file-upload \
--enable-gzip-help \
--enable-nested-tables \
--enable-prettysrc \
--enable-read-eta \
--enable-source-cache \
--enable-vertrace \
--libdir=/mingw/lynx2.8.5dev.16/lynx-slang-conf \
--with-screen=slang \
--with-ssl \
--with-zlib
The patch to the PDCurses makefile was:
--- mingwin32.mak.ori 2001-01-10 00:30:46.000000000 -0800
+++ mingwin32.mak 2003-09-01 01:04:34.000000000 -0800
@@ -12,8 +12,8 @@
# Change these for your environment...
#
################################################################################
-PDCURSES_HOME =f:/curses
-CC_HOME =f:/mingw32
+PDCURSES_HOME =/mingw/pdcurs26
+CC_HOME =/mingw
################################################################################
# Nothing below here should required changing.
################################################################################
@@ -37,8 +37,8 @@
CFLAGS = -c -g -Wall -DPDCDEBUG -D_NO_OLDNAMES
LDFLAGS = -g
else
- CFLAGS = -c -O -Wall -D_NO_OLDNAMES
- LDFLAGS =
+ CFLAGS = -c -O -W -Wall -D_NO_OLDNAMES -mno-cygwin
+ LDFLAGS = -mno-cygwin
endif
CPPFLAGS = -I$(PDCURSES_HOME) -I$(CCINCDIR)
@@ -48,7 +48,7 @@
LINK = gcc
COFF2EXE =coff2exe $*
-CCLIBS = -L$(CCLIBDIR) -lkernel32 -luser32
+CCLIBS = -L$(CCLIBDIR) -lmsvcrt -lkernel32 -luser32
LIBEXE = ar
LIBFLAGS =rcv
I also made the following change to PDCurses (although I am not sure it
made a difference):
--- pdcurses2.6/win32/pdckbd.c.ori 2002-12-17 03:18:34.000000000 -0800
+++ pdcurses2.6/win32/pdckbd.c 2003-09-01 11:43:06.000000000 -0800
@@ -518,7 +518,7 @@
switch(save_ip.Event.KeyEvent.wVirtualKeyCode)
{
case 16: /* shift */
- if ( SP->return_key_modifiers ) return KEY_SHIFT_R;
+ if ( SP->return_key_modifiers & SHIFT_PRESSED) return
KEY_SHIFT_R;
ignore_key = 1;
break;
case 17: /* control */
The configuration script for OpenSSL was:
#!/bin/sh
./Configure no-shared no-idea no-rc5 no-mdc2 --prefix=d\:/cygwin/mingw mingw
The patch applied to lynx was:
--- lynx2.8.5dev.16/lynx2-8-5/userdefs.h.ori 2003-06-01 18:16:28.000000000
-0800
+++ lynx2.8.5dev.16/lynx2-8-5/userdefs.h 2003-08-20 21:19:56.000000000
-0800
@@ -1402,6 +1402,12 @@
#ifdef DOSPATH
#ifdef _WINDOWS
+#ifdef SYSTEM_MAIL
+#undef SYSTEM_MAIL
+#endif
+#ifdef SYSTEM_MAIL_FLAGS
+#undef SYSTEM_MAIL_FLAGS
+#endif
#ifdef USE_ALT_BLAT_MAILER
#define SYSTEM_MAIL "BLAT"
#define SYSTEM_MAIL_FLAGS ""
--- lynx2.8.5dev.16/lynx2-8-5/WWW/Library/Implementation/HTParse.c.ori
2003-08-20 23:57:14.000000000 -0700
+++ lynx2.8.5dev.16/lynx2-8-5/WWW/Library/Implementation/HTParse.c
2003-08-21 00:55:08.000000000 -0700
@@ -12,6 +12,10 @@
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
+#else
+#ifdef __MINGW32__
+#include <malloc.h>
+#endif /* __MINGW32__ */
#endif
#define HEX_ESCAPE '%'
--- lynx2.8.5dev.16/lynx2-8-5/www/Library/Implementation/HTUtils.h.ori
2003-04-27 17:38:00.000000000 -0800
+++ lynx2.8.5dev.16/lynx2-8-5/www/Library/Implementation/HTUtils.h
2003-08-20 21:26:44.000000000 -0800
@@ -181,7 +181,7 @@
#endif
#if defined(UNIX)
-# if (defined(__BEOS__) || defined(__CYGWIN__) || defined(__DJGPP__) ||
defined(__EMX__))
+# if (defined(__BEOS__) || defined(__CYGWIN__) || defined(__DJGPP__) ||
defined(__EMX__) || defined(__MINGW32__))
# define SINGLE_USER_UNIX /* well, at least they try */
# else
# define MULTI_USER_UNIX
--- lynx2.8.5dev.16/lynx2-8-5/src/LYCgi.c.ori 2003-04-27 17:38:00.000000000
-0800
+++ lynx2.8.5dev.16/lynx2-8-5/src/LYCgi.c 2003-08-20 22:56:30.000000000
-0800
@@ -140,6 +144,16 @@
}
}
+#ifdef __MINGW32__
+PRIVATE int LYLoadCGI ARGS4(
+ CONST char *, arg,
+ HTParentAnchor *, anAnchor,
+ HTFormat, format_out,
+ HTStream*, sink)
+{
+ return -1;
+}
+#else
PRIVATE int LYLoadCGI ARGS4(
CONST char *, arg,
HTParentAnchor *, anAnchor,
@@ -684,6 +698,7 @@
#endif /* LYNXCGI_LINKS */
return(status);
}
+#endif /* __MINGW32__ */
#ifdef GLOBALDEF_IS_MACRO
#define _LYCGI_C_GLOBALDEF_1_INIT { "lynxcgi", LYLoadCGI, 0 }
--- lynx2.8.5dev.16/lynx2-8-5/src/LYCurses.c.ori 2003-08-20
23:58:04.000000000 -0700
+++ lynx2.8.5dev.16/lynx2-8-5/src/LYCurses.c 2003-08-21 22:22:38.000000000
-0700
@@ -1,6 +1,11 @@
#include <HTUtils.h>
#include <HTAlert.h>
+#ifdef __MINGW32__
+#ifdef UNIX
+#undef UNIX
+#endif /* UNIX */
+#endif /* __MINGW32__ */
#include <LYCurses.h>
#include <LYStyle.h>
#include <LYUtils.h>
@@ -1274,8 +1274,12 @@
#ifdef __DJGPP__
ScreenClear();
#else
+#ifdef __MINGW32__
+ clear();
+#else
clrscr();
#endif
+#endif
#else
if(LYCursesON == TRUE) {
--- lynx2.8.5dev.16/lynx2-8-5/src/LYExtern.c.ori 2003-04-27
17:38:00.000000000 -0800
+++ lynx2.8.5dev.16/lynx2-8-5/src/LYExtern.c 2003-08-20 23:01:56.000000000
-0800
@@ -323,7 +323,7 @@
/* command running. */
#ifdef WIN_EX /* 1997/10/17 (Fri) 14:07:50 */
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MINGW32__)
status = system(cmdbuf);
#else
status = xsystem(cmdbuf);
--- lynx2.8.5dev.16/lynx2-8-5/src/LYStrings.c.ori 2003-06-01
18:16:28.000000000 -0700
+++ lynx2.8.5dev.16/lynx2-8-5/src/LYStrings.c 2003-09-07 11:54:54.000000000
-0700
@@ -1316,6 +1316,18 @@
INTERN_KEY( "\033OP", F1, KEY_F(1) ),
INTERN_KEY( "\033[OP", F1, KEY_F(1) ),
INTERN_KEY( "\033[29~", DO_KEY, KEY_F(16) ),
+#if defined(USE_SLANG) && defined(__MINGW32__)
+ INTERN_KEY( "\xE0H", UPARROW, KEY_UP ),
+ INTERN_KEY( "\xE0P", DNARROW, KEY_DOWN ),
+ INTERN_KEY( "\xE0M", RTARROW, KEY_RIGHT ),
+ INTERN_KEY( "\xE0K", LTARROW, KEY_LEFT ),
+ INTERN_KEY( "\xE0R", INSERT_KEY, KEY_IC ),
+ INTERN_KEY( "\xE0S", REMOVE_KEY, KEY_DC ),
+ INTERN_KEY( "\xE0I", PGUP, KEY_PPAGE ),
+ INTERN_KEY( "\xE0Q", PGDOWN, KEY_NPAGE ),
+ INTERN_KEY( "\xE0G", HOME, KEY_HOME),
+ INTERN_KEY( "\xE0O", END_KEY, KEY_END ),
+#endif
#if defined(USE_SLANG) && !defined(VMS)
INTERN_KEY( "^(ku)", UPARROW, KEY_UP ),
INTERN_KEY( "^(kd)", DNARROW, KEY_DOWN ),
@@ -1509,8 +1521,30 @@
current_sl_modifier = 0;
key = SLang_do_key (Keymap_List, myGetChar);
- if ((key == NULL) || (key->type != SLKEY_F_KEYSYM))
+ if ((key == NULL) || (key->type != SLKEY_F_KEYSYM)) {
+#ifdef __MINGW32__
+ if ((key == NULL) && (current_sl_modifier == LKC_ISLKC)) {
+ key = SLang_do_key (Keymap_List, myGetChar);
+ keysym = key->f.keysym;
+ switch (keysym) {
+ case 'H': keysym = UPARROW; break;
+ case 'P': keysym = DNARROW; break;
+ case 'M': keysym = RTARROW; break;
+ case 'K': keysym = LTARROW; break;
+ case 'R': keysym = INSERT_KEY; break;
+ case 'S': keysym = REMOVE_KEY; break;
+ case 'I': keysym = PGUP; break;
+ case 'Q': keysym = PGDOWN; break;
+ case 'G': keysym = HOME; break;
+ case 'O': keysym = END_KEY; break;
+ case ';': keysym = F1; break;
+ }
+ return(keysym);
+ }
+#endif
+
return (current_sl_modifier ? 0 : DO_NOTHING);
+ }
keysym = key->f.keysym;
--- lynx2.8.5dev.16/lynx2-8-5/src/LYUtils.c.orig 2003-09-07
14:13:36.000000000 -0700
+++ lynx2.8.5dev.16/lynx2-8-5/src/LYUtils.c 2003-09-07 15:11:36.000000000
-0700
@@ -4,6 +4,14 @@
#include <HTAccess.h>
#include <HTCJK.h>
#include <HTAlert.h>
+
+#ifdef __MINGW32__
+int kbhit(void);
+#ifdef UNIX
+#undef UNIX
+#endif /* UNIX */
+#endif /* __MINGW32__ */
+
#include <LYCurses.h>
#include <LYHistory.h>
#include <LYStrings.h>
I am not sure that putting the mingw keysyms in the middle of the
vtxxx defines is the best place, but I haven't considered very much
where would be better.
The problem with the arrow keys under PDCurses is that when NUMLOCK
is on, the arrow keystrokes seem to be queued. If you then turn off
NUMLOCK and press an arrow key, all of the previous keypresses will
be executed, in addition to the current one. I would appreciate any
insight into this behavior. When NUMLOCK is on, holding down an arrow
key leads to execution of multiple instances of the key after a delay
of about half a second, but it is difficult to control.
I haven't spent much time trying to analyze why the configure script
give the wrong defines for the three items mentioned above.
I was playing with the mingw build because of the complexity of
distributing a Cygwin build, wherein the user would have to get the
cygwin1.dll on their own. Neither of the builds was extensively tested,
but both the PDCurses and SLang versions seem to work in normal use.
I wasn't able to build ncurses under mingw. Can ncurses be ported to the
mingw environment?
Doug
--
Doug Kaufman
Internet: address@hidden
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
- lynx-dev MINGW port of lynx (long) [PATCH],
Doug Kaufman <=