The XView toolkit was part of the Openwindows distribution from Sun. This page contains details of my port of Openwindows and the XView toolkit to work with Cygwin under Microsoft Windows.
Update: Current installations of Cygwin 1.7 already include the XView toolkit. There is no need for most of the additional steps listed on this page. You only need to follow the instructions in the Building XView applications section.
However, if you are running an older version of Cygwin (prior to ~ 2012) and the xview-dev package is not available through the usual setup, you can still follow the instructions on this page.
Wouldn't it have been better to spend the time adapting my software to use a newer, supported, and 'better' graphical toolkit such as GTK, rather than port XView to Cygwin? Yes. But... sticking with XView also has advantages for compiling graphical software on multi-platform UNIX systems, in particular if it is to compile on old SunOS systems with only a K&R C compiler installed, no root access and limited disk space. The XView toolkit is also available for a range of other non-Sun UNIX distributions (see links below).
I'm a scientist, not a computer programmer. My motivation for porting XView to Cygwin was to use my existing software on Windows with as little amount of effort as possible. I don't understand the XView source code, how the make files work on a project of this scale or the philosophy behind graphical toolkits.
Except for the one case noted below, all changes to the source code are
commented in #ifdef __CYGWIN__
blocks. I assumed that the Linux
port would be the best starting point for Cygwin and then tried to fix those
Linux ports that didn't work with Cygwin. This is likely to mean that I've
introduced some bugs by failing to spot difference between Linux and Cygwin.
Below, I've listed the major points of contention.
struct sigcontext *
or
ucontext_t
from notify_get_signal_context()
in
lib/libxview/notify/ndet_loop.c depending on flags related to the
operating system, base the choice on whether SYSV_UCONTEXT
is
defined or not which is more consistent with the function definition in the
related header file.
_select
, _fcntl
, and _read
as
defined by Cygwin and the portion of code defined for __GLIBC__
in
linux_select.c seems to work.
The Cygwin patch has been tested on version -21.1 of the XView source code from Debian. It is likely to work on future versions as well, as not much is changing in the xview source code. In addition to the default Cygwin install options you will need to select and download some additional items - I suggest those listed here.
tar xzfX xview_3.2p1.4.orig.tar.gz xview_cygwin_exclude.txt
gunzip xview_3.2p1.4-21.1.diff.gz sed "s/aux/aaux/g" xview_3.2p1.4-21.1.diff > xview_3.2p1.4-21.1a.diff cd xview-3.2p1.4 patch -p1 < ../xview_3.2p1.4-21.1a.diffThe file aaux.h isn't present to be patched. This file isn't used by default anyway so can be skipped if queried by the above patch (to the question File to patch: press <return> and accept y to Skip this path?). It will be added again during the next step.
zcat ../xview_3.2p1.4_cygwin_20060622.diff.gz | patch -p1
. ./Build-CygwinXView.bash all
You will first need to define some environment variables which may be done in your start-up files, e.g. add the following line to the end of your .bash_profile file
export OPENWINHOME=/usr/openwinTo prevent warning messages, also do
cd /usr/lib ln -s ../openwin/lib/text_extras_menu .text_extras_menu ln -s ../openwin/lib/textswrc .textswrcAn additional library must be included during compilation. Also, the order in which the XView libraries are specified is important. I use
-L/usr/X11R6/lib -L${OPENWINHOME}/lib -lxview -lolgx -lrpc -lX11
A compiled version of XView and OpenWindows for Cygwin may be downloaded (5 Mb). It was compiled using the current Cygwin version as of 10th May 2007 on Windows XP. To install, copy the downloaded file to /usr in Cygwin and extract by typing
cd /usr tar xjf cygwin_openwin_20070510dll.tar.bz2Then edit the .bash_profile file in your home directory and add the following line to the bottom of the file
export OPENWINHOME=/usr/openwin export PATH=${PATH}:${OPENWINHOME}/bin
Multi-platform XView libraries and source code